See also, http://libraryofalexandria.io/cgo/
cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.
So, Here collect materials.
See also, http://libraryofalexandria.io/cgo/
cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.
So, Here collect materials.
| package main | |
| import ( | |
| "crypto/tls" | |
| "fmt" | |
| "net/http" | |
| "golang.org/x/crypto/acme/autocert" | |
| ) |
| 1. GOCACHE=off , go 1.11这个环境变量会被去除 | |
| 2. -count=1 | |
| 3. go clean -cache | |
| 4. -a 重编译 | |
| 5. -gcflags="all=-a" 重编译 |
| # | |
| # Wide-open CORS config for nginx | |
| # | |
| location / { | |
| if ($request_method = 'OPTIONS') { | |
| add_header 'Access-Control-Allow-Origin' '*'; | |
| add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; | |
| # | |
| # Custom headers and headers various browsers *should* be OK with but aren't | |
| # |
| package main | |
| // | |
| // Starting point is from http://gcmurphy.wordpress.com/2012/11/30/using-epoll-in-go/ | |
| // | |
| import ( | |
| "fmt" | |
| "os" | |
| "syscall" |
| package main | |
| import ( | |
| "log" | |
| "os" | |
| "syscall" | |
| ) | |
| func main() { | |
| f, err := os.Open("/tmp/pipe") |
| package main | |
| import ( | |
| "fmt" | |
| "math/rand" | |
| "sort" | |
| "time" | |
| "github.com/psilva261/timsort" | |
| ) |
| import ( | |
| "bytes" | |
| "io/ioutil" | |
| "golang.org/x/text/encoding/traditionalchinese" | |
| "golang.org/x/text/encoding/simplifiedchinese" | |
| "golang.org/x/text/transform" | |
| ) | |
| //convert GBK to UTF-8 | |
| func Decodegbk(s []byte) ([]byte, error) { | |
| I := bytes.NewReader(s) |
| import ( | |
| "bytes" | |
| "io/ioutil" | |
| "golang.org/x/text/encoding/traditionalchinese" | |
| "golang.org/x/text/encoding/simplifiedchinese" | |
| "golang.org/x/text/transform" | |
| ) | |
| //convert GBK to UTF-8 | |
| func Decodegbk(s []byte) ([]byte, error) { | |
| I := bytes.NewReader(s) |
| package main | |
| import ( | |
| iconv "github.com/djimenez/iconv-go" | |
| "io/ioutil" | |
| "log" | |
| "net/http" |