Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What's New in Go 1.14

What's New in Go 1.14

A lightening talk looking at what is new in Go 1.14 presented at the London Gophers Meetup.

Dominic Green

February 19, 2020
Tweet

More Decks by Dominic Green

Other Decks in Technology

Transcript

  1. @domgreen • GOPRIVATE environment variable ◦ Allows the setting of

    private repositories to get modules • GOPROXY environment variable ◦ Allows the setting of proxies to request modules from https://golang.org/doc/go1.13#modules Go 1.13 Module Improvements
  2. @domgreen Go 1.14 Runtime: defer benchcmp ./defer_1.13.1.out ./defer_1.14beta1.out benchmark [1.13.1]

    ns/op [1.14beta1] ns/op delta BenchmarkNotDefered-12 1.32 1.32 +0.00% BenchmarkDefered-12 31.1 2.76 -91.13% More details: https://gist.github.com/bwplotka/9e68b5be3e76b253166dbeea222efac7
  3. @domgreen Go 1.14 Runtime: defer import "sync" var mtx sync.Mutex

    func performanceCriticalMethod() { mtx.Lock() defer mtx.Unlock() // ...do something FAST! } More details: https://gist.github.com/bwplotka/9e68b5be3e76b253166dbeea222efac7 // Write writes data to the connection. func (c *Conn) Write(b []byte) (int, error) { // interlock with Close below for { x := atomic.LoadInt32(&c.activeCall) if x&1 != 0 { return 0, errClosed } if atomic.CompareAndSwapInt32(&c.activeCall, x, x+2) { defer atomic.AddInt32(&c.activeCall, -2) break } } // ... } Excerpt from: https://github.com/golang/go/blob/go1.11.4/src/crypto/tls/conn.go#L1036
  4. @domgreen Go 2.0 The three biggest hurdles on this path

    to improved scalability for Go are package and version management, better error handling support, and generics. https://blog.golang.org/go2-here-we-come https://blog.golang.org/go2-next-steps