golang

  • GOMEMLIMIT to control heap size to avoid GC
  • disable default proxy
    • go env -w GOPROXY=direct
    • go env -w GOSUMDB=off
  • raw syscalls vs libc
    • CGOENABLED to toggle libc linkage
  • 6 month release cycle
  • export with capitalization
  • vendors dependencies by default
  • large std library
    • can have ossification issues such as ed25519 signature malleability update cadence
      • ed25519-comparison.png
  • TCP NODELAY set by default (no batching with nagle's algorithm)
  • http2 pusher (chrome removing support)
// Send HTML and push image
func handlerHtml(w http.ResponseWriter, r *http.Request) {
        pusher, ok := w.(http.Pusher)
        if ok {
                Info.Println("Pushing image")
                pusher.Push("/image", nil)
        }
        Info.Println("Writing HTML")
        w.Header().Add("Content-Type", "text/html")
        fmt.Fprintf(w, `<html><body><img src="/image"></body></html>`)
}
  • One can use generatecert.go in crypto/tls to generate cert.pem and key.pem.