What's coming in Go 1.12 01 Nov 2018 Daniel Martí https://mvdan.cc * Go 1.11 - Modules - WebAssembly - XP dropped - `go`test` runs `go`vet` * Go 1.12 - Freeze on November 5th - Release early February 2019 But what sources? .link https://github.com/golang/go/issues?q=is:issue+milestone:Go1.12 .link https://github.com/golang/go/commits/master .link https://go-review.googlesource.com/q/status:merged+RELNOTE%253Dyes * Let's start with merged proposals They tend to be more interesting. * fmt: print maps in sorted order .link https://github.com/golang/go/issues/21095 - Easier debugging - fmt output is now deterministic * testing: add -benchtime=100x .link https://github.com/golang/go/issues/24735 - Run a test N times, instead of for N seconds - Useful to compare before/after numbers better * cmd/godoc: remove CLI support .link https://github.com/golang/go/issues/25443 - You should now use `go`doc` instead of `godoc` - One more step towards bringing the doc tools in sync * strings: add Builder.Cap method .link https://github.com/golang/go/issues/26269 - Mirroring bytes.Buffer.Cap - Otherwise impossible to tell capacity or free space * os: add ProcessState.ExitCode method .link https://github.com/golang/go/issues/26539 - Easier to get a process's exit code - No need to type assert to a syscall type * crypto/rand: warn if blocked 60s+ on a read .link https://github.com/golang/go/issues/22614 - Otherwise programs might hang with no apparent reason - Makes the issue much easier to debug * Onto accepted but still open proposals Some of these might be pushed back to 1.13. * cmd/go: record language version to support language transitions .link https://github.com/golang/go/issues/28221 - Allow changing the Go language progressively - Smooth transition for users without 2.0, 3.0, etc * cmd/go: add a build -static flag .link https://github.com/golang/go/issues/26492 - Building a fully static binary is *not* trivial - Make it trivial forever * bytes,strings: add ToValidUTF8 .link https://github.com/golang/go/issues/25805 - To remove invalid bytes, devs do `string([]rune(s))` - The compiler may get smart enough to make that a no-op * testing: stream t.Log output as it happens .link https://github.com/golang/go/issues/24929 - Log messages have to wait until the test finishes - Makes slow/hanging tests hard to debug * runtime: non-cooperative goroutine preemption .link https://github.com/golang/go/issues/24543 - HUGE deal for large companies - Possible for certain code patterns to bully the runtime - Redesign the runtime to remove those edge cases * cmd/compile: enable mid-stack inlining .link https://github.com/golang/go/issues/19348 - Has been shelved every release since 1.9 - Likely won't make it into 1.12, very tricky - Would mean considerable speed-ups for most programs * Now onto random stuff Randomly picked from what I've seen and found. * io: add StringWriter interface .link https://github.com/golang/go/issues/27946 - Lots of copy-paste definitions are no more * cmd/go: add GOFLAGS environment variable .link https://go-review.googlesource.com/c/go/+/126656 - Easy way to configure executed Go tools - Can configure global build flags for a user * os: add UserHomeDir .link https://github.com/golang/go/issues/26463 - Using os/user.Current directly is actually bad - $HOME should be tried first * cmd/doc: support printing full documentation .link https://github.com/golang/go/issues/25595 - Another feature ported over from `godoc` * math/bits: add extended precision Add, Sub, Mul, Div .link https://github.com/golang/go/issues/24813 - Multi-word arithmetic now much easier (uint128, etc) - Faster than manual code too, thanks to compiler help * text/template: catch panics during func calls .link https://github.com/golang/go/issues/28242 - Panics in user code are now returned as errors - Simpler to use template, friendlier errors to users * Many many more issues - Modules support is getting better and more stable - WebAssembly port is improving every week - More ports incoming - AIX, HURD