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.
// This is a test where I was trying to isolate how much we lost to `reflect` | |
// with channel operations in a tight loop. | |
// | |
// PREAMBLE | |
// We do a lot of processing of stream data where ordering with respect to a | |
// shard indicator like user ID matters. We've done this a few times where we | |
// implement fanout based on hashing into an slice/array of channels, and it's | |
// lightning fast but it ends up leaving a lot of boilerplate in your code. | |
// | |
// So I started writing a library that would do the non-critical boilerplate |
package main | |
import ( | |
"flag" | |
"log" | |
"net/http" | |
"strings" | |
) | |
func main() { |
FROM gliderlabs/alpine | |
RUN apk add --update git build-base linux-headers wget tar perl zlib zlib-dev bzip2 bzip2-dev && \ | |
cd /tmp && \ | |
wget https://gflags.googlecode.com/files/gflags-2.0-no-svn-files.tar.gz && \ | |
tar -xzvf gflags-2.0-no-svn-files.tar.gz && \ | |
cd gflags-2.0 && \ | |
./configure && make && make install && \ | |
cd /tmp && \ | |
wget https://snappy.googlecode.com/files/snappy-1.1.1.tar.gz && \ |
package main | |
import ( | |
"fmt" | |
"syscall" | |
) | |
type DiskStatus struct { | |
All uint64 `json:"all"` | |
Used uint64 `json:"used"` |
// v2 of the great example of SSE in go by @ismasan. | |
// includes fixes: | |
// * infinite loop ending in panic | |
// * closing a client twice | |
// * potentially blocked listen() from closing a connection during multiplex step. | |
package main | |
import ( | |
"fmt" | |
"log" |
// v2 of the great example of SSE in go by @ismasan. | |
// includes fixes: | |
// * infinite loop ending in panic | |
// * closing a client twice | |
// * potentially blocked listen() from closing a connection during multiplex step. | |
package main | |
import ( | |
"fmt" | |
"log" |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 65; | |
upstream myappget { | |
server 127.0.0.1:3000; |
1 普通匹配,遵循最长匹配规则,假设一个请求匹配到了两个普通规则,则选择匹配长度大的那个 | |
例如: | |
location /{ | |
[matches] | |
} | |
location /test{ | |
[matches] | |
} | |
2 精确匹配 | |
location = /{ |
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 | |
// | |
// Starting point is from http://gcmurphy.wordpress.com/2012/11/30/using-epoll-in-go/ | |
// | |
import ( | |
"fmt" | |
"os" | |
"syscall" |