DRAFT RELEASE NOTES — Introduction to Go 1.15

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

Changes to the language

TODO

Ports

TODO

Tools

TODO

Go command

The GOPROXY environment variable now supports skipping proxies that return errors. Proxy URLs may now be separated with either commas (,) or pipe characters (|). If a proxy URL is followed by a comma, the go command will only try the next proxy in the list after a 404 or 410 HTTP response. If a proxy URL is followed by a pipe character, the go command will try the next proxy in the list after any error. Note that the default value of GOPROXY remains https://proxy.golang.org,direct, which does not fall back to direct in case of errors.

TODO

go test

Changing the -timeout flag now invalidates cached test results. A cached result for a test run with a long timeout will no longer count as passing when go test is re-invoked with a short one.

Flag parsing

Various flag parsing issues in go test and go vet have been fixed. Notably, flags specified in GOFLAGS are handled more consistently, and the -outputdir flag now interprets relative paths relative to the working directory of the go command (rather than the working directory of each individual test).

Module cache

The location of the module cache may now be set with the GOMODCACHE environment variable. The default value of GOMODCACHE is GOPATH[0]/pkg/mod, the location of the module cache before this change.

A workaround is now available for Windows "Access is denied" errors in go commands that access the module cache, caused by external programs concurrently scanning the file system (see issue #36568). The workaround is not enabled by default because it is not safe to use when Go versions lower than 1.14.2 and 1.13.10 are running concurrently with the same module cache. It can be enabled by explictly setting the environment variable GODEBUG=modcacheunzipinplace=1.

Runtime

TODO

Compiler

Package unsafe's safety rules allow converting an unsafe.Pointer into uintptr when calling certain functions. Previously, in some cases, the compiler allowed multiple chained conversions (for example, syscall.Syscall(…, uintptr(uintptr(ptr)), …)). The compiler now requires exactly one conversion. Code that used multiple conversions should be updated to satisfy the safety rules.

Core library

New embedded tzdata package

Go 1.15 includes a new package, time/tzdata, that permits embedding the timezone database into a program. Importing this package (as import _ "time/tzdata") permits the program to find timezone information even if the timezone database is not available on the local system. You can also embed the timezone database by building with -tags timetzdata. Either approach increases the size of the program by about 800 KB.

TODO

testing

The testing.T type now has a Deadline method that reports the time at which the test binary will have exceeded its timeout.

A TestMain function is no longer required to call os.Exit. If a TestMain function returns, the test binary will call os.Exit with the value returned by m.Run.

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.

TODO

crypto/tls

The new Dialer type and its DialContext method permits using a context to both connect and handshake with a TLS server.

flag

When the flag package sees -h or -help, and those flags are not defined, the flag package prints a usage message. If the FlagSet was created with ExitOnError, FlagSet.Parse would then exit with a status of 2. In this release, the exit status for -h or -help has been changed to 0. In particular, this applies to the default handling of command line flags.

net

If an I/O operation exceeds a deadline set by the Conn.SetDeadline, Conn.SetReadDeadline, or Conn.SetWriteDeadline methods, it will now return an error that is or wraps os.ErrDeadlineExceeded. This may be used to reliably detect whether an error is due to an exceeded deadline. Earlier releases recommended calling the Timeout method on the error, but I/O operations can return errors for which Timeout returns true although a deadline has not been exceeded.

net/http/pprof

All profile endpoints now support a "seconds" parameter. When present, the endpoint profiles for the specified number of seconds and reports the difference. The meaning of the "seconds" parameter in the cpu profile and the trace endpoints is unchanged.

net/url

The new URL field RawFragment and method EscapedFragment provide detail about and control over the exact encoding of a particular fragment. These are analogous to RawPath and EscapedPath.

The new URL method Redacted returns the URL in string form with any password replaced with xxxxx.

os

If an I/O operation exceeds a deadline set by the File.SetDeadline, File.SetReadDeadline, or File.SetWriteDeadline methods, it will now return an error that is or wraps os.ErrDeadlineExceeded. This may be used to reliably detect whether an error is due to an exceeded deadline. Earlier releases recommended calling the Timeout method on the error, but I/O operations can return errors for which Timeout returns true although a deadline has not been exceeded.

reflect

Package reflect now disallows accessing methods of all non-exported fields, whereas previously it allowed accessing those of non-exported, embedded fields. Code that relies on the previous behavior should be updated to instead access the corresponding promoted method of the enclosing variable.

runtime

If panic is invoked with a value whose type is derived from any of: bool, complex64, complex128, float32, float64, int, int8, int16, int32, int64, string, uint, uint8, uint16, uint32, uint64, uintptr, then the value will be printed, instead of just its address.

On a Unix system, if the kill command or kill system call is used to send a SIGSEGV, SIGBUS, or SIGFPE signal to a Go program, and if the signal is not being handled via os/signal.Notify, the Go program will now reliably crash with a stack trace. In earlier releases the behavior was unpredictable.

runtime/pprof

The goroutine profile includes the profile labels associated with each goroutine at the time of profiling. This feature is not yet implemented for the profile reported with debug=2.

sync

The new method Map.LoadAndDelete atomically deletes a key and returns the previous value if present.

The method Map.Delete is more efficient.

testing

The new methods T.TempDir and B.TempDir and return temporary directories that are automatically cleaned up at the end of the test.

time

The new method Ticker.Reset supports changing the duration of a ticker.