Here's a thread of highlights from the release ✨💥
All user-visible changes are in the release notes 👇
golang.org/doc/go1.13
New number literals and signed shift counts.
No more ugly "x << uint(n)".
golang.org/design/19308-n…
golang.org/design/19113-s…
Language changes are module scoped and gated on the language version in the go.mod, so each module can update on its own schedule.
blog.golang.org/go2-next-steps
· GO111MODULE=auto is on whenever a go.mod is found (even in GOPATH/src)
· +incompatible and pseudo-versions are now checked for validity (yay robustness)
· "go env -w" sets environment variables, stored at os.UserConfigDir()/go/env
· "go build -trimpath" for more reproducible builds
· "go build -o dir" supports building multiple binaries
· "go version [-m] binary.exe" prints Go/module version
TLS 1.3 on by default! (And SSLv3 is deprecated.)
Use GODEBUG=tls13=off to opt-out and report issues!
golang.org/pkg/crypto/ed2…
This will enable secure, reasonably fast, readable Go implementations like my Poly1305. blog.filippo.io/a-literate-go-…
An error can wrap another by returning it from an "Unwrap() error" method.
golang.org/doc/go1.13#err…
fmt.Errorf("failed to send tweet: %w", err)
· New escape analysis engine! golang.org/issue/23109
· Keep-alives on by default server-side. (Configure or disable with ListenConfig.KeepAlive.)
· Testing multiple packages prints a summary at the end.
· defer is up to 30% faster. github.com/golang/go/comm…
· Mutex.Lock, Mutex.Unlock, RWMutex.Lock, RWMutex.RUnlock, and Once.Do fast paths are inlined.
· json.Decoder is 15-20% faster. github.com/golang/go/issu…
Before: runtime error: index out of range
After: runtime error: index out of range [3] with length 1
sync.Pool does not cause allocations at all in steady state.
Every GC instead of draining the pool, the contents are set aside to be collected at the next round. If they are reused before that, no allocations! github.com/golang/go/comm…