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.
There are no changes to the language.
As announced in the Go 1.14 release notes, Go 1.15 now requires macOS 10.12 Sierra or later; support for previous versions has been discontinued.
As announced in the Go 1.14 release
notes, Go 1.15 drops support for 32-bit binaries on macOS, iOS,
iPadOS, watchOS, and tvOS (the darwin/386
and darwin/arm
ports). Go continues to support the
64-bit darwin/amd64
and darwin/arm64
ports.
Go 1.15 now generates Windows ASLR executables when -buildmode=pie cmd/link flag is provided. Go command uses -buildmode=pie by default on Windows.
Go-built DLLs no longer cause the process to exit when it receives a signal (such as Ctrl-C at a terminal).
When linking binaries for Android, Go 1.15 explicitly selects
the lld
linker available in recent versions of the NDK.
The lld
linker avoids crashes on some devices, and is
planned to become the default NDK linker in a future NDK version.
Go 1.15 adds support for OpenBSD 6.7 on GOARCH=arm
and GOARCH=arm64
. Previous versions of Go already
supported OpenBSD 6.7 on GOARCH=386
and GOARCH=amd64
.
There has been progress in improving the stability and performance
of the 64-bit RISC-V port on Linux (GOOS=linux
,
GOARCH=riscv64
). It also now supports asynchronous
preemption.
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.
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.
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).
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
.
The vet tool now warns about conversions of the
form string(x)
where x
has an integer type
other than rune
or byte
.
Experience with Go has shown that many conversions of this form
erroneously assume that string(x)
evaluates to the
string representation of the integer x
.
It actually evaluates to a string containing the UTF-8 encoding of
the value of x
.
For example, string(9786)
does not evaluate to the
string "9786"
; it evaluates to the
string "\xe2\x98\xba"
, or "☺"
.
Code that is using string(x)
correctly can be rewritten
to string(rune(x))
.
Or, in some cases, calling utf8.EncodeRune(buf, x)
with
a suitable byte slice buf
may be the right solution.
Other code should most likely use strconv.Itoa
or fmt.Sprint
.
This new vet check is enabled by default when using go test
.
We are considering prohibiting the conversion in a future release of Go.
That is, the language would change to only
permit string(x)
for integer x
when the
type of x
is rune
or byte
.
Such a language change would not be backward compatible.
We are using this vet check as a first trial step toward changing
the language.
The vet tool now warns about type assertions from one interface type to another interface type when the type assertion will always fail. This will happen if both interface types implement a method with the same name but with a different type signature.
There is no reason to write a type assertion that always fails, so any code that triggers this vet check should be rewritten.
This new vet check is enabled by default when using go test
.
We are considering prohibiting impossible interface type assertions in a future release of Go. Such a language change would not be backward compatible. We are using this vet check as a first trial step toward changing the language.
Go now retries system calls that return EINTR
. This
became more common in Go 1.14 with the addition of asynchronous
preemption, but is now handled transparently.
Allocation of small objects now performs much better at high core counts, and has lower worst-case latency.
TODO
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.
Go 1.15 reduces typical binary sizes by around 5% compared to Go 1.14 by eliminating certain types of GC metadata and more aggressively eliminating unused type metadata.
TODO: -spectre flags
This release includes substantial improvements to the Go linker, which reduce linker resource usage (both time and memory) and improve code robustness/maintainability.
For a representative set of large Go programs, linking is 20% faster
and requires 30% less memory on average, for ELF
-based
OSes running on amd64
architectures, with more modest
improvements for other architecture/OS combinations.
The key contributors to better linker performance are a newly redesigned object file format, and a revamping of internal phases to increase concurrency (for example, applying relocations to symbols in parallel). Object files in Go 1.15 are slightly larger than their 1.14 equivalents.
These changes are part of a multi-release project to modernize the Go linker, meaning that there will be additional linker improvements expected in future releases.
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
Go 1.15 will translate the C type EGLConfig
to the
Go type uintptr
. This change is similar to how Go
1.12 and newer treats EGLDisplay
, Darwin's CoreFoundation and
Java's JNI types. See the cgo
documentation for more information.
As always, there are various minor changes and updates to the library, made with the Go 1 promise of compatibility in mind.
TODO
TODO: https://golang.org/cl/222637: copy some consts from cmd/link/internal/ld
VerifyPKCS1v15 now rejects invalid short signatures with missing leading zeroes.
The new
Dialer
type and its
DialContext
method permits using a context to both connect and handshake with a TLS server.
TODO: https://golang.org/cl/205237: load roots from colon separated SSL_CERT_DIR in loadSystemRoots
TODO: https://golang.org/cl/203417: fix reserved namespace check to be case-insensitive
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.
TODO: https://golang.org/cl/215001: do not remove trailing zeros for %g and %G with #(sharp) flag
TODO: https://golang.org/cl/212597: reject path separators in TempDir, TempFile pattern
TODO: https://golang.org/cl/230397: add (*Int).FillBytes
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.
The new Resolver.LookupIP
method supports IP lookups that are both network-specific and accept a context.
TODO: https://golang.org/cl/231418: only support "chunked" in inbound Transfer-Encoding headers
ReverseProxy
now supports not modifying the X-Forwarded-For
header when the incoming Request.Header
map entry
for that field is nil
.
TODO: https://golang.org/cl/224897: make Switching Protocol requests (e.g. Websockets) cancelable
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.
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
.
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.
DWARF generation is now supported (and enabled by default) for -buildmode=plugin
on macOS.
Building with -buildmode=plugin
is now supported on freebsd/amd64
.
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.
TODO: https://golang.org/cl/187919: add (*Regexp).SubexpIndex
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.
Previously, this was only true for values of exactly these types.
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.
Several functions, including
ReadMemStats
and
GoroutineProfile
,
no longer block if a garbage collection is in progress.
Converting small integer values into an interface value no longer causes allocation.
Non-blocking receives on closed channels now perform as well as non-blocking receives on open channels.
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
.
FormatComplex
and ParseComplex
are added for working with complex numbers.
FormatComplex
converts a complex number into a string of the form (a+bi), where a and b are the real and imaginary parts.
ParseComplex
converts a string into a complex number of a specificed precision. ParseComplex
accepts complex numbers in the format N+Ni
.
The new method
Map.LoadAndDelete
atomically deletes a key and returns the previous value if present.
The method
Map.Delete
is more efficient.
On Unix systems, functions that use
SysProcAttr
will now reject attempts to set both the Setctty
and Foreground
fields, as they both use
the Ctty
field but do so in incompatible ways.
We expect that few existing programs set both fields.
Setting the Setctty
field now requires that the
Ctty
field be set to a file descriptor number in the
child process, as determined by the ProcAttr.Files
field.
Using a child descriptor always worked, but there were certain
cases where using a parent file descriptor also happened to work.
Some programs that set Setctty
will need to change
the value of Ctty
to use a child descriptor number.
It is now possible to call
system calls that return floating point values
on windows/amd64
.
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
.
The new methods
T.TempDir
and
B.TempDir
and
return temporary directories that are automatically cleaned up
at the end of the test.
The new method
Ticker.Reset
supports changing the duration of a ticker.
When returning an error, ParseDuration
now quotes the original value.