DRAFT RELEASE NOTES - Introduction to Go 1.11

Go 1.11 is not yet released. These are work-in-progress release notes. Go 1.11 is expected to be released in August 2018.

The latest Go release, version 1.11, arrives six months after Go 1.10. Most of its changes are in the implementation of the toolchain, runtime, and libraries. 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

As announced in the Go 1.10 release notes, Go 1.11 now requires OpenBSD 6.2 or later, macOS 10.10 Yosemite or later, or Windows 7 or later; Support for previous versions of these operating systems has been removed.

There are known issues with NetBSD on i386 hardware.

The race detector is now supported on linux/ppc64le and, to a lesser extent, on netbsd/amd64. The NetBSD race detector support has known issues.

The build modes c-shared and c-archive are now supported on freebsd/amd64.

On 64-bit MIPS systems, the new environment variable settings GOMIPS64=hardfloat (the default) and GOMIPS64=softfloat select whether to use hardware instructions or software emulation for floating-point computations. For 32-bit systems, the environment variable is still GOMIPS, as added in Go 1.10.

WebAssembly

Go 1.11 adds an experimental port to WebAssembly (js/wasm).

Go programs currently compile to one WebAssembly module that includes the Go runtime for goroutine scheduling, garbage collection, maps, etc. As a result, the resulting size is at minimum around 2 MB, or 500 KB compressed. Go programs can call into JavaScript using the new experimental syscall/js package. Binary size and interop with other languages has not yet been a priority but may be addressed in future releases.

As a result of the addition of the new GOOS value "js" and GOARCH value "wasm", Go files named *_js.go or *_wasm.go will now be ignored by Go tools except when those GOOS/GOARCH values are being used. If you have existing filenames matching those patterns, you will need to rename them.

Tools

Modules, package versioning, and dependency management

NOTE: This is not present in go1.11beta1 but will be available in future betas and subsequent releases. Go 1.11 adds experimental support for a new concept called “modules,” an alternative to GOPATH with integrated support for versioning and package distribution. Using modules, developers are no longer confined to working inside GOPATH, version dependency information is explicit yet lightweight, and builds are more reliable and reproducible.

Module support is considered experimental. Details are likely to change in response to feedback from Go 1.11 users, and we have more tools planned. Although the details of module support may change, projects that convert to modules using Go 1.11 will continue to work with Go 1.12 and later. If you encounter bugs using modules, please file issues so we can fix them.

TODO: Link to intro doc.

Import path restriction

Because Go module support assigns special meaning to the @ symbol in command line operations, the go command now disallows the use of import paths containing @ symbols. Such import paths were never allowed by go get, so this restriction can only affect users building custom GOPATH trees by other means.

Package loading

TODO: Note about go/build versus golang.org/x/tools/go/packages.

Build cache requirement

Go 1.11 will be the last release to support setting the environment variable GOCACHE=off to disable the build cache, introduced in Go 1.10. Starting in Go 1.12, the build cache will be required, as a step toward eliminating $GOPATH/pkg. The module and package loading support described above already require that the build cache be enabled. If you have disabled the build cache to avoid problems you encountered, please file an issue to let us know about them.

Tools

Test

Since Go1.10, the go test command runs go vet on the package being tested, to identify problems before running the test. Since vet typechecks the code with go/types before running, tests that do not typecheck will now fail. In particular, tests that contain an unused variable inside a closure compiled with Go1.10, because the Go compiler incorrectly accepted them (Issue #3059), but will now fail, since go/types correctly reports an "unused variable" error in this case.

Vet

The go vet command now reports a fatal error when the package under analysis does not typecheck. Previously, a type checking error simply caused a warning to be printed, and vet to exit with status 1.

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.

crypto

Certain crypto operations, including ecdsa.Sign, rsa.EncryptPKCS1v15 and rsa.GenerateKey, now randomly read an extra byte of randomness to ensure tests don't rely on internal behavior.

crypto/cipher

The new function NewGCMWithTagSize implements Galois Counter Mode with non-standard tag lengths for compatibility with existing cryptosystems.

crypto/rsa

PublicKey now implements a Size method that returns the modulus size in bytes.

crypto/tls

ConnectionState's new ExportKeyingMaterial field allows exporting keying material bound to the connection according to RFC 5705.

crypto/x509

The deprecated, legacy behavior of treating the CommonName field as a hostname when no Subject Alternative Names are present is now disabled when the CN is not a valid hostname. The CommonName can be completely ignored by adding the experimental value x509ignoreCN=1 to the GODEBUG environment variable. When the CN is ignored, certificates without SANs validate under chains with name constraints instead of returning NameConstraintsWithoutSANs.

Extended key usage restrictions are again checked only if they appear in the KeyUsages field of VerifyOptions, instead of always being checked. This matches the behavior of Go 1.9 and earlier.

The value returned by SystemCertPool is now cached and might not reflect system changes between invocations.

debug/elf

TODO: https://golang.org/cl/112115: add machine and OSABI constants

encoding/asn1

TODO: https://golang.org/cl/110561: allow Marshaling and Unmarshaling private tag class

encoding/base32

TODO: https://golang.org/cl/112516: handle surplus padding consistently

encoding/csv

TODO: https://golang.org/cl/99696: disallow quote for use as Comma

go/build, runtime/internal/sys

TODO: https://golang.org/cl/106256: reserve RISC-V arch names

go/scanner

TODO: https://golang.org/cl/100235: report errors for incorrect line directives

html/template

TODO: https://golang.org/cl/121815: ignore untyped nil arguments to default escapers

image/gif

TODO: https://golang.org/cl/93076: support non-looping animated gifs (LoopCount=-1)

io/ioutil

TODO: https://golang.org/cl/105675: change TempFile prefix to a pattern

math/big

TODO: https://golang.org/cl/74851: speed-up addMulVVW on amd64

ModInverse now returns nil when g and n are not relatively prime. The result was previously undefined.

mime/multipart

TODO: https://golang.org/cl/121055: restore 1.9 handling of missing/empty form-data file name

mime/quotedprintable

To support invalid input found in the wild, the package now permits non-ASCII bytes but does not validate their encoding.

net

The new ListenConfig type and the new Dialer.Control field permit setting socket options before accepting and creating connections, respectively.

TODO: https://golang.org/cl/76391: implement (*syscall.RawConn).Read/Write on Windows

The net package now automatically uses the splice system call on Linux when calling copying data between TCP connections in TCPConn.ReadFrom, as called by io.Copy. The result is faster, more efficient TCP proxying.

TODO: https://golang.org/cl/108297: calling File leaves the socket in nonblocking mode

net/http

The Transport has a new MaxConnsPerHost option that permits limiting the maximum number of connections per host.

The Cookie type has a new The SameSite field (of new type also named SameSite) to represent the new cookie attribute recently supported by most browsers. The net/http's Transport does not use the SameSite attribute itself, but the package supports parsing and serializing the attribute for browsers to use.

It is no longer allowed to reuse a Server after a call to Shutdown or Close. It was never officially supported in the past and had often surprising behavior. Now, all future calls to the server's Serve methods will return errors after a shutdown or close.

The HTTP server will no longer automatically set the Content-Type if a Handler sets the "X-Content-Type-Options" header to "nosniff".

The constant StatusMisdirectedRequest is now defined for HTTP status code 421.

The HTTP server will no longer cancel contexts or send on CloseNotifier channels upon receiving pipelined HTTP/1.1 requests. Browsers do not use HTTP pipelining, but some clients (such as Debian's apt) may be configured to do so.

ProxyFromEnvironment, which is used by the DefaultTransport, now supports CIDR notation and ports in the NO_PROXY environment variable.

net/http/httputil

The ReverseProxy has a new ErrorHandler option to permit changing how errors are handled.

os

The new UserCacheDir function returns the default root directory to use for user-specific cached data.

The new ModeIrregular is a FileMode bit to represent that a file is not a regular file, but nothing else is known about it, or that it's not a socket, device, named pipe, symlink, or other file type for which Go has a defined mode bit.

TODO: https://golang.org/cl/99337: enable symlink creation on Windows 10

TODO: https://golang.org/cl/100077: use poller when NewFile is called with a blocking descriptor.

os/signal

The new Ignored function reports whether a signal is currently ignored.

os/user

The os/user package can now be built in pure Go mode using the build tag "osusergo", independent of the use of the environment variable CGO_ENABLED=0. Previously the only way to use the package's pure Go implementation was to disable cgo support across the entire program.

runtime

TODO: https://golang.org/cl/85887: use sparse mappings for the heap

TODO: https://golang.org/cl/94076: use native CAS and memory barrier on ARMv7

TODO: https://golang.org/cl/106156: use fixed TLS offsets on darwin/amd64 and darwin/386

TODO: https://golang.org/cl/109255: enable memory sanitizer on arm64

TODO: https://golang.org/cl/109699: support for debugger function calls

TODO: https://golang.org/cl/121657: remap stack spans with MAP_STACK on OpenBSD

TODO: https://golang.org/cl/70993: support tracking goroutine ancestor tracebacks with GODEBUG="tracebackancestors=N"

runtime,cmd/ld

TODO: https://golang.org/cl/108679: on darwin, create theads using libc

runtime/pprof

TODO: https://golang.org/cl/102696: introduce "allocs" profile

runtime/trace

TODO: https://golang.org/cl/63274: user annotation API

runtime,cmd/ld

TODO: https://golang.org/cl/108679: on darwin, create theads using libc

runtime/trace

TODO: https://golang.org/cl/63274: user annotation API

runtime/traceback

TODO: https://golang.org/cl/70993: support tracking goroutine ancestor tracebacks with GODEBUG="tracebackancestors=N"

sync

TODO: https://golang.org/cl/87095: enable profiling of RWMutex

syscall

On Windows, several fields were changed from uintptr to a new Pointer type to avoid problems with Go's garbage collector. The same change was made to the golang.org/x/sys/windows package. For any code affected, users should first migrate away from the syscall package to the golang.org/x/sys/windows package, and then change to using the Pointer, while obeying the unsafe.Pointer conversion rules.

TODO: https://golang.org/cl/118658: check Fchmodat flags parameter on Linux

text/scanner

TODO: https://golang.org/cl/112037: return RawString token rather than String for raw string literals

text/template

TODO: https://golang.org/cl/84480: add variable assignments

TODO: https://golang.org/cl/95215: differentiate nil from missing arg

time

TODO: https://golang.org/cl/98157: add support for parsing timezones denoted by sign and offset