DRAFT RELEASE NOTES - Introduction to Go 1.12

Go 1.12 is not yet released. These are work-in-progress release notes. Go 1.12 is expected to be released in February 2019.

The latest Go release, version 1.12, arrives six months after Go 1.11. Most of its changes are in TODO. As always, the release maintains the Go 1 promise of compatibility. We expect almost all Go programs to continue to compile and run as before.

Changes to the language

There are no changes to the language specification.

Ports

FreeBSD

Go 1.12 is the last release that is supported on FreeBSD 10.x, which has already reached end-of-life. Go 1.13 will require FreeBSD 11.2+ or FreeBSD 12.0+.

Darwin

Go 1.12 is the last release that will run on macOS 10.10 Yosemite. Go 1.13 will require macOS 10.11 El Capitan or later.

Tools

go tool vet no longer supported

The go vet command has been rewritten to serve as the base for a range of different source code analysis tools. See the golang.org/x/tools/go/analysis package for details. A side-effect is that go tool vet is no longer supported. External tools that use go tool vet must be changed to use go vet. Using go vet instead of go tool vet should work with all supported versions of Go.

Build cache requirement

The build cache is now required as a step toward eliminating $GOPATH/pkg. Setting the environment variable GOCACHE=off to disable the build cache has no effect in Go 1.12.

Compiler toolchain

The compiler's live variable analysis has improved. This may mean that finalizers will be executed sooner in this release than in previous releases. If that is a problem, consider the appropriate addition of a runtime.KeepAlive call.

More functions are now eligible for inlining by default, including functions that do nothing but call another function. This extra inlining makes it additionally important to use runtime.CallersFrames instead of iterating over the result of runtime.Callers directly.

// Old code which no longer works correctly (it will miss inlined call frames).
var pcs [10]uintptr
n := runtime.Callers(1, pcs[:])
for _, pc := range pcs[:n] {
	f := runtime.FuncForPC(pc)
	if f != nil {
		fmt.Println(f.Name())
	}
}
// New code which will work correctly.
var pcs [10]uintptr
n := runtime.Callers(1, pcs[:])
frames := runtime.CallersFrames(pcs[:n])
for {
	frame, more := frames.Next()
	fmt.Println(frame.Function)
	if !more {
		break
	}
}

Godoc

In Go 1.12, godoc no longer has a command-line interface and is only a web server. Users should use go doc for command-line help output instead.

Core library

All of the changes to the standard library are minor.

Minor changes to the library

As always, there are various minor changes and updates to the library, made with the Go 1 promise of compatibility in mind.

bufio

TODO: https://golang.org/cl/149297: make Reader.Peek invalidate Unreads

build

TODO: https://golang.org/cl/61511: support frame-pointer for arm64

bytes, strings

TODO: https://golang.org/cl/137855: add ReplaceAll

TODO: https://golang.org/cl/145098: fix Reader.UnreadRune returning without error on a zero Reader

cmd,runtime

TODO: https://golang.org/cl/138675: enable race detector on arm64

crypto/rand

TODO: https://golang.org/cl/120055: use the new getrandom syscall on FreeBSD

TODO: https://golang.org/cl/139419: warn to stderr if blocked 60+ sec on first Reader.Read call

crypto/rc4

TODO: https://golang.org/cl/130397: remove assembler implementations

database/sql

TODO: https://golang.org/cl/145738: add support for returning cursors to client

expvar

TODO: https://golang.org/cl/139537: add Map.Delete

fmt

TODO: https://golang.org/cl/129777: print values for map keys with non-reflexive equality

TODO: https://golang.org/cl/142737: print maps in key-sorted order

go/build, cmd/go

TODO: https://golang.org/cl/146023: add "hurd" as a GOOS value

go/doc

TODO: https://golang.org/cl/140958: add new mode bit PreserveAST to control clearing of data in AST

go/token

TODO: https://golang.org/cl/134075: add (*File).LineStart, which returns Pos for a given line

godoc, cmd/godoc

TODO: https://golang.org/cl/141397: remove CLI support

image

TODO: https://golang.org/cl/118755: make RegisterFormat safe for concurrent use

image/png

TODO: https://golang.org/cl/134235: pack image data for small bitdepth paletted images

internal/cpu

TODO: https://golang.org/cl/149578: move GODEBUGCPU options into GODEBUG

internal/poll

TODO: https://golang.org/cl/130676: use F_FULLFSYNC fcntl for FD.Fsync on OS X

io

TODO: https://golang.org/cl/139457: export StringWriter

lib/time

TODO: https://golang.org/cl/151299: update tzdata to 2018g

math/bits

TODO: https://golang.org/cl/123157: add extended precision Add, Sub, Mul, Div

net

The Dialer.DualStack setting is now ignored and deprecated; RFC 6555 Fast Fallback ("Happy Eyeballs") is now enabled by default. To disable, set Dialer.FallbackDelay to a negative value.

Similarly, TCP keep-alives are now enabled by default if Dialer.KeepAlive is zero. To disable, set it to a negative value.

On Linux, the splice system call is now used when copying from a UnixConn to a TCPConn.

net/http

The HTTP server now rejects misdirected HTTP requests to HTTPS servers with a plaintext "400 Bad Request" response.

The new Client.CloseIdleConnections method calls the Client's underlying Transport's CloseIdleConnections if it has one.

The Transport no longer rejects HTTP responses which declare HTTP Trailers but don't use chunked encoding. Instead, the declared trailers are now just ignored.

The Transport no longer handles MAX_CONCURRENT_STREAMS values advertised from HTTP/2 servers as strictly as it did during Go 1.10 and Go 1.11. The default behavior is now back to how it was in Go 1.9: each connection to a server can have up to MAX_CONCURRENT_STREAMS requests active and then new TCP connections are created as needed. In Go 1.10 and Go 1.11 the http2 package would block and wait for requests to finish instead of creating new connections. To get the stricter behavior back, import the golang.org/x/net/http2 package directly and set Transport.StrictMaxConcurrentStreams to true.

net/http/httputil

The ReverseProxy now automatically proxies WebSocket requests.

os

The new ProcessState.ExitCode method returns the process's exit code.

TODO: https://golang.org/cl/135075: add ModeCharDevice to ModeType

TODO: https://golang.org/cl/139418: add UserHomeDir

TODO: https://golang.org/cl/146020: add support for long path names on unix RemoveAll

path/filepath

TODO: https://golang.org/cl/145220: change IsAbs("NUL") to return true

reflect

TODO: https://golang.org/cl/33572: add Value.MapRange method and MapIter type

regexp

TODO: https://golang.org/cl/139783: add DeepEqual test

TODO: https://golang.org/cl/139784: add partial Deprecation comment to Copy

runtime

TODO: https://golang.org/cl/135395: use MADV_FREE on Linux if available

runtime/debug

TODO: https://golang.org/cl/144220: add API to read module info in binary

strings

The new Builder.Cap method returns the capacity of the builder's underlying byte slice.

TODO: https://golang.org/cl/131495: correctly handle invalid utf8 sequences in Map

syscall

TODO: https://golang.org/cl/125456: implement Unix Socket for Windows

TODO: https://golang.org/cl/138595: FreeBSD 12 ino64 support

TODO: https://golang.org/cl/141639: implement syscalls on Darwin using libSystem

TODO: https://golang.org/cl/147117: add Syscall18 on Windows

syscall/js

TODO: https://golang.org/cl/141644: add Wrapper interface to support external Value wrapper types

TODO: https://golang.org/cl/143137: make zero js.Value represent "undefined"

TODO: https://golang.org/cl/144384: add the Value.Truthy method

testing

TODO: https://golang.org/cl/121936: exit with error if testing.Short is called before flag.Parse

TODO: https://golang.org/cl/139258: implement -benchtime=100x

text/template

TODO: https://golang.org/cl/142217: removed truncation of context in error message