Go 1.15:
https://tip.golang.org/doc/go1.15
MS Windows:
The -race and -msan flags now always enable -d=checkptr, which checks uses of unsafe.Pointer
This was previously the case on all OSes except Windows.
Android:
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.
Commands:
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.
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.
Vet:
New warning for string(x)
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.
New warning for impossible interface conversions
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.
https://tip.golang.org/doc/go1.15
MS Windows:
The -race and -msan flags now always enable -d=checkptr, which checks uses of unsafe.Pointer
This was previously the case on all OSes except Windows.
Android:
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.
Commands:
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.
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.
Vet:
New warning for string(x)
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.
New warning for impossible interface conversions
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.
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.
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.
Allocation of small objects now performs much better at high core counts, and has lower worst-case latency.
Converting a small integer value 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.
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.
Go 1.15 adds a -spectre flag to both the compiler and the assembler, to allow enabling Spectre mitigations.
These should almost never be needed and are provided mainly as a “defense in depth” mechanism.
See the Spectre wiki page for details.
The compiler now rejects //go: compiler directives that have no meaning for the declaration they are applied to with a "misplaced compiler directive" error.
Such misapplied directives were broken before, but were silently ignored by the compiler.
The compiler's -json optimization logging now reports large (>= 128 byte) copies and includes explanations of escape analysis decisions.
Linker:
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.
Objdump:
The objdump tool now supports disassembling in GNU assembler syntax with the -gnu flag.
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.
Cgo:
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.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.