Skip to content

Instantly share code, notes, and snippets.

@archever
archever / clcolor.go
Created October 23, 2018 15:26
golang colored log
// source code from https://github.com/xcltapestry/xclpkg/blob/master/clcolor/clcolor.go
package logger
import (
"fmt"
"runtime"
)
const (
@archever
archever / postgres.yaml
Created September 24, 2018 13:10
postgres docker compose file
version: '3.1'
services:
db:
image: postgres
restart: always
ports:
- 5432:5432
volumes:
@archever
archever / demo.go
Created September 21, 2018 10:44
golang ... 可变参数并不是展开传递的
package main
import "log"
func test(data ...interface{}) {
for _, i := range data {
log.Printf("data: %v", i)
}
}
@archever
archever / person.go
Created September 21, 2018 09:47
golang interface as namespace
package main
import (
"fmt"
"reflect"
)
type person struct {
Name string
}
@archever
archever / array.go
Last active September 18, 2018 03:23
golang 参数传递
package main
import (
"log"
)
func main() {
i := [...]int{1, 2, 3}
log.Printf("before show: %v", i)
show(i)