blob: f806fe0e03a3adc82acf7a8122077f059be23ce6 [file] [log] [blame]
<!--{
"Title": "Go 1.11 Release Notes",
"Path": "/doc/go1.11",
"Template": true
}-->
<!--
NOTE: In this document and others in this directory, the convention is to
set fixed-width phrases with non-fixed-width spaces, as in
<code>hello</code> <code>world</code>.
Do not send CLs removing the interior tags from such phrases.
-->
<style>
ul li { margin: 0.5em 0; }
</style>
<h2 id="introduction">DRAFT RELEASE NOTES - Introduction to Go 1.11</h2>
<p>
<strong>
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.
</strong>
</p>
<p>
The latest Go release, version 1.11, arrives six months after <a href="go1.10">Go 1.10</a>.
Most of its changes are in the implementation of the toolchain, runtime, and libraries.
As always, the release maintains the Go 1 <a href="/doc/go1compat.html">promise of compatibility</a>.
We expect almost all Go programs to continue to compile and run as before.
</p>
<h2 id="language">Changes to the language</h2>
<p>
There are no changes to the language specification.
</p>
<h2 id="ports">Ports</h2>
<p> <!-- CL 94255, CL 115038, etc -->
As <a href="go1.10#ports">announced in the Go 1.10 release notes</a>, 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.
</p>
<p> <!-- CL 121657 -->
Go 1.11 supports the upcoming OpenBSD 6.4 release. Due to changes in
the OpenBSD kernel, older versions of Go will not work on OpenBSD 6.4.
</p>
<p>
There are <a href="https://golang.org/issue/25206">known issues</a> with NetBSD on i386 hardware.
</p>
<p><!-- CL 107935 -->
The race detector is now supported on <code>linux/ppc64le</code>
and, to a lesser extent, on <code>netbsd/amd64</code>. The NetBSD race detector support
has <a href="https://golang.org/issue/26403">known issues</a>.
</p>
<p><!-- CL 109255 -->
The memory sanitizer (<code>-msan</code>) is now supported on <code>linux/arm64</code>.
</p>
<p><!-- CL 93875 -->
The build modes <code>c-shared</code> and <code>c-archive</code> are now supported on
<code>freebsd/amd64</code>.
</p>
<p id="mips"><!-- CL 108475 -->
On 64-bit MIPS systems, the new environment variable settings
<code>GOMIPS64=hardfloat</code> (the default) and
<code>GOMIPS64=softfloat</code> select whether to use
hardware instructions or software emulation for floating-point computations.
For 32-bit systems, the environment variable is still <code>GOMIPS</code>,
as <a href="go1.10#mips">added in Go 1.10</a>.
</p>
<p><!-- CL 107475 -->
On soft-float ARM systems (<code>GOARM=5</code>), Go now uses a more
efficient software floating point interface. This is transparent to
Go code, but ARM assembly that uses floating-point instructions not
guarded on GOARM will break and must be ported to
the <a href="https://golang.org/cl/107475">new interface</a>.
</p>
<p><!-- CL 94076 -->
Go 1.11 on ARMv7 no longer requires a Linux kernel configured
with <code>KUSER_HELPERS</code>. This setting is enabled in default
kernel configurations, but is sometimes disabled in stripped-down
configurations.
</p>
<h3 id="wasm">WebAssembly</h3>
<p>
Go 1.11 adds an experimental port to WebAssembly (<code>js/wasm</code>).
</p>
<p>
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
<a href="/pkg/syscall/js/"><code>syscall/js</code></a> package.
Binary size and interop with other languages has not yet been a
priority but may be addressed in future releases.
</p>
<p>
As a result of the addition of the new <code>GOOS</code> value
"<code>js</code>" and <code>GOARCH</code> value "<code>wasm</code>",
Go files named <code>*_js.go</code> or <code>*_wasm.go</code> will
now be <a href="/pkg/go/build/#hdr-Build_Constraints">ignored by Go
tools</a> except when those GOOS/GOARCH values are being used.
If you have existing filenames matching those patterns, you will need to rename them.
</p>
<h3 id="riscv">RISC-V GOARCH values reserved</h3>
<p><!-- CL 106256 -->
The main Go compiler does not yet support the RISC-V architecture
but we've reserved the <code>GOARCH</code> values
"<code>riscv</code>" and "<code>riscv64</code>", as used by Gccgo,
which does support RISC-V. This means that Go files
named <code>*_riscv.go</code> will now also
be <a href="/pkg/go/build/#hdr-Build_Constraints">ignored by Go
tools</a> except when those GOOS/GOARCH values are being used.
</p>
<h2 id="tools">Tools</h2>
<h3 id="modules">Modules, package versioning, and dependency management</h3>
<p>
Go 1.11 adds preliminary support for a <a href="/cmd/go/#hdr-Modules__module_versions__and_more">new concept called “modules,”</a>
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.
</p>
<p>
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 <a href="https://golang.org/issue/new">file issues</a>
so we can fix them.
</p>
<h3 id="importpath">Import path restriction</h3>
<p>
Because Go module support assigns special meaning to the
<code>@</code> symbol in command line operations,
the <code>go</code> command now disallows the use of
import paths containing <code>@</code> symbols.
Such import paths were never allowed by <code>go</code> <code>get</code>,
so this restriction can only affect users building
custom GOPATH trees by other means.
</p>
<h3 id="gopackages">Package loading</h3>
<p>
TODO: Note about go/build versus golang.org/x/tools/go/packages.
</p>
<h3 id="gocache">Build cache requirement</h3>
<p>
Go 1.11 will be the last release to support setting the environment
variable <code>GOCACHE=off</code> to disable the
<a href="/cmd/go/#hdr-Build_and_test_caching">build cache</a>,
introduced in Go 1.10.
Starting in Go 1.12, the build cache will be required,
as a step toward eliminating <code>$GOPATH/pkg</code>.
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 <a href="https://golang.org/issue/new">file an issue</a> to let us know about them.
</p>
<h3 id="compiler">Compiler toolchain</h3>
<p><!-- CL 109918 -->
More functions are now eligible for inlining by default, including
functions that call <code>panic</code>.
</p>
<p><!-- CL 97375 -->
The compiler toolchain now supports column information
in <a href="/cmd/compile/#hdr-Compiler_Directives">line
directives</a>.
</p>
<p><!-- CL 106797 -->
A new package export data format has been introduced.
This should be transparent to end users, except for speeding up
build times for large Go projects.
If it does cause problems, it can be turned off again by
passing <code>-gcflags=all=-iexport=false</code> to
the <code>go</code> tool when building a binary.
</p>
<p><!-- CL 100459 -->
The compiler now rejects unused variables declared in a type switch
guard, such as <code>x</code> in the following example:
</p>
<pre>
func f(v interface{}) {
switch x := v.(type) {
}
}
</pre>
<p>
This was already rejected by both <code>gccgo</code>
and <a href="/pkg/go/types/">go/types</a>.
</p>
<h3 id="assembler">Assembler</h3>
<p><!-- CL 113315 -->
The assembler for <code>amd64</code> now accepts AVX512 instructions.
</p>
<h3 id="debugging">Debugging</h3>
<p><!-- CL 100738, CL 93664 -->
The compiler now produces significantly more accurate debug
information for optimized binaries, including variable location
information, line numbers, and breakpoint locations.
This should make it possible to debug binaries
compiled <em>without</em> <code>-N</code>&nbsp;<code>-l</code>.
There are still limitations to the quality of the debug information,
some of which are fundamental, and some of which will continue to
improve with future releases.
</p>
<p><!-- CL 118276 -->
DWARF sections are now compressed by default because of the expanded
and more accurate debug information produced by the compiler.
This is transparent to most ELF tools (such as debuggers on Linux
and *BSD) and is supported by the Delve debugger on all platforms,
but has limited support in the native tools on macOS and Windows.
To disable DWARF compression,
pass <code>-ldflags=-compressdwarf=false</code> to
the <code>go</code> tool when building a binary.
</p>
<p><!-- CL 109699 -->
Go 1.11 adds experimental support for calling Go functions from
within a debugger.
This is useful, for example, to call <code>String</code> methods
when paused at a breakpoint.
<!-- TODO(austin): Make sure methods calls are actually supported by Delve -->
This is currently only supported by Delve.
</p>
<h2 id="tools">Tools</h2>
<h3 id="test">Test</h3>
<p>
Since Go 1.10, the <code>go</code>&nbsp;<code>test</code> command runs
<code>go</code>&nbsp;<code>vet</code> on the package being tested,
to identify problems before running the test. Since <code>vet</code>
typechecks the code with <a href="/pkg/go/types/">go/types</a>
before running, tests that do not typecheck will now fail.
In particular, tests that contain an unused variable inside a
closure compiled with Go 1.10, because the Go compiler incorrectly
accepted them (<a href="https://golang.org/issues/3059">Issue #3059</a>),
but will now fail, since <code>go/types</code> correctly reports an
"unused variable" error in this case.
</p>
<p><!-- CL 102696 -->
The <code>-memprofile</code> flag
to <code>go</code>&nbsp;<code>test</code> now defaults to the
"allocs" profile, which records the total bytes allocated since the
test began (including garbage-collected bytes).
</p>
<h3 id="vet">Vet</h3>
<p><!-- CL 108555 -->
The <a href="/cmd/vet/"><code>go</code>&nbsp;<code>vet</code></a>
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 <code>vet</code> to exit with status 1.
</p>
<h2 id="runtime">Runtime</h2>
<p><!-- CL 85887 -->
The runtime now uses a sparse heap layout so there is no longer a
limit to the size of the Go heap (previously, the limit was 512GiB).
This also fixes rare "address space conflict" failures in mixed Go/C
binaries or binaries compiled with <code>-race</code>.
</p>
<p><!-- CL 108679, CL 106156 -->
On macOS and iOS, the runtime now uses <code>libSystem.so</code> instead of
calling the kernel directly. This should make Go binaries more
compatible with future versions of macOS and iOS.
The <a href="/pkg/syscall">syscall</a> package still makes direct
system calls; fixing this is planned for a future release.
</p>
<h2 id="library">Core library</h2>
<p>
All of the changes to the standard library are minor.
</p>
<h3 id="minor_library_changes">Minor changes to the library</h3>
<p>
As always, there are various minor changes and updates to the library,
made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
in mind.
</p>
<!-- CL 115095: https://golang.org/cl/115095: yes (`go test pkg` now always builds pkg even if there are no test files): cmd/go: output coverage report even if there are no test files -->
<!-- CL 110395: https://golang.org/cl/110395: cmd/go, cmd/compile: use Windows response files to avoid arg length limits -->
<!-- CL 112436: https://golang.org/cl/112436: cmd/pprof: add readline support similar to upstream -->
<dl id="crypto"><dt><a href="/pkg/crypto/">crypto</a></dt>
<dd>
<p><!-- CL 64451 -->
Certain crypto operations, including
<a href="/pkg/crypto/ecdsa/#Sign"><code>ecdsa.Sign</code></a>,
<a href="/pkg/crypto/rsa/#EncryptPKCS1v15"><code>rsa.EncryptPKCS1v15</code></a> and
<a href="/pkg/crypto/rsa/#GenerateKey"><code>rsa.GenerateKey</code></a>,
now randomly read an extra byte of randomness to ensure tests don't rely on internal behavior.
</p>
</dl><!-- crypto -->
<dl id="crypto/cipher"><dt><a href="/pkg/crypto/cipher/">crypto/cipher</a></dt>
<dd>
<p><!-- CL 48510, CL 116435 -->
The new function <a href="/pkg/crypto/cipher/#NewGCMWithTagSize"><code>NewGCMWithTagSize</code></a>
implements Galois Counter Mode with non-standard tag lengths for compatibility with existing cryptosystems.
</p>
</dl><!-- crypto/cipher -->
<dl id="crypto/rsa"><dt><a href="/pkg/crypto/rsa/">crypto/rsa</a></dt>
<dd>
<p><!-- CL 103876 -->
<a href="/pkg/crypto/rsa/#PublicKey"><code>PublicKey</code></a> now implements a
<a href="/pkg/crypto/rsa/#PublicKey.Size"><code>Size</code></a> method that
returns the modulus size in bytes.
</p>
</dl><!-- crypto/rsa -->
<dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
<dd>
<p><!-- CL 85115 -->
<a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a>'s new
<code>ExportKeyingMaterial</code> field allows exporting keying material bound to the
connection according to RFC 5705.
</p>
</dl><!-- crypto/tls -->
<dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
<dd>
<p><!-- CL 123355, CL 123695 -->
The deprecated, legacy behavior of treating the <code>CommonName</code> field as
a hostname when no Subject Alternative Names are present is now disabled when the CN is not a
valid hostname.
The <code>CommonName</code> can be completely ignored by adding the experimental value
<code>x509ignoreCN=1</code> to the <code>GODEBUG</code> environment variable.
When the CN is ignored, certificates without SANs validate under chains with name constraints
instead of returning <code>NameConstraintsWithoutSANs</code>.
</p>
<p><!-- CL 113475 -->
Extended key usage restrictions are again checked only if they appear in the <code>KeyUsages</code>
field of <a href="/pkg/crypto/x509/#VerifyOptions"><code>VerifyOptions</code></a>, instead of always being checked.
This matches the behavior of Go 1.9 and earlier.
</p>
<p><!-- CL 102699 -->
The value returned by <a href="/pkg/crypto/x509/#SystemCertPool"><code>SystemCertPool</code></a>
is now cached and might not reflect system changes between invocations.
</p>
</dl><!-- crypto/x509 -->
<dl id="debug/elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt>
<dd>
<p><!-- CL 112115 -->
TODO: <a href="https://golang.org/cl/112115">https://golang.org/cl/112115</a>: add machine and OSABI constants
</p>
</dl><!-- debug/elf -->
<dl id="encoding/asn1"><dt><a href="/pkg/encoding/asn1/">encoding/asn1</a></dt>
<dd>
<p><!-- CL 110561 -->
TODO: <a href="https://golang.org/cl/110561">https://golang.org/cl/110561</a>: allow Marshaling and Unmarshaling private tag class
</p>
</dl><!-- encoding/asn1 -->
<dl id="encoding/base32"><dt><a href="/pkg/encoding/base32/">encoding/base32</a></dt>
<dd>
<p><!-- CL 112516 -->
TODO: <a href="https://golang.org/cl/112516">https://golang.org/cl/112516</a>: handle surplus padding consistently
</p>
</dl><!-- encoding/base32 -->
<dl id="encoding/csv"><dt><a href="/pkg/encoding/csv/">encoding/csv</a></dt>
<dd>
<p><!-- CL 99696 -->
TODO: <a href="https://golang.org/cl/99696">https://golang.org/cl/99696</a>: disallow quote for use as Comma
</p>
</dl><!-- encoding/csv -->
<dl id="go/scanner"><dt><a href="/pkg/go/scanner/">go/scanner</a></dt>
<dd>
<p><!-- CL 100235 -->
TODO: <a href="https://golang.org/cl/100235">https://golang.org/cl/100235</a>: report errors for incorrect line directives
</p>
</dl><!-- go/scanner -->
<dl id="html/template"><dt><a href="/pkg/html/template/">html/template</a></dt>
<dd>
<p><!-- CL 121815 -->
TODO: <a href="https://golang.org/cl/121815">https://golang.org/cl/121815</a>: ignore untyped nil arguments to default escapers
</p>
</dl><!-- html/template -->
<dl id="image/gif"><dt><a href="/pkg/image/gif/">image/gif</a></dt>
<dd>
<p><!-- CL 93076 -->
TODO: <a href="https://golang.org/cl/93076">https://golang.org/cl/93076</a>: support non-looping animated gifs (LoopCount=-1)
</p>
</dl><!-- image/gif -->
<dl id="io/ioutil"><dt><a href="/pkg/io/ioutil/">io/ioutil</a></dt>
<dd>
<p><!-- CL 105675 -->
TODO: <a href="https://golang.org/cl/105675">https://golang.org/cl/105675</a>: change TempFile prefix to a pattern
</p>
</dl><!-- io/ioutil -->
<dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
<dd>
<p><!-- CL 74851 -->
TODO: <a href="https://golang.org/cl/74851">https://golang.org/cl/74851</a>: speed-up addMulVVW on amd64
</p>
<p><!-- CL 108996 -->
<a href="/pkg/math/bin/#Int.ModInverse"><code>ModInverse</code></a> now returns nil when g and n are not relatively prime. The result was previously undefined.
</p>
</dl><!-- math/big -->
<dl id="mime/multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt>
<dd>
<p><!-- CL 121055 -->
TODO: <a href="https://golang.org/cl/121055">https://golang.org/cl/121055</a>: restore 1.9 handling of missing/empty form-data file name
</p>
</dl><!-- mime/multipart -->
<dl id="mime/quotedprintable"><dt><a href="/pkg/mime/quotedprintable/">mime/quotedprintable</a></dt>
<dd>
<p><!-- CL 121095 -->
To support invalid input found in the wild, the package now
permits non-ASCII bytes but does not validate their encoding.
</p>
</dl><!-- mime/quotedprintable -->
<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
<dd>
<p><!-- CL 72810 -->
The new <a href="/pkg/net/#ListenConfig"><code>ListenConfig</code></a> type and the new
<a href="/pkg/net/#Dialer.Control"><code>Dialer.Control</code></a> field permit
setting socket options before accepting and creating connections, respectively.
</p>
<p><!-- CL 76391 -->
TODO: <a href="https://golang.org/cl/76391">https://golang.org/cl/76391</a>: implement (*syscall.RawConn).Read/Write on Windows
</p>
<p><!-- CL 107715 -->
The <code>net</code> package now automatically uses the
<a href="http://man7.org/linux/man-pages/man2/splice.2.html"><code>splice</code> system call</a>
on Linux when calling copying data between TCP connections in
<a href="/pkg/net/#TCPConn.ReadFrom"><code>TCPConn.ReadFrom</code></a>, as called by
<a href="/pkg/io/#Copy"><code>io.Copy</code>. The result is faster, more efficient TCP proxying.
</p>
<p><!-- CL 108297 -->
TODO: <a href="https://golang.org/cl/108297">https://golang.org/cl/108297</a>: calling File leaves the socket in nonblocking mode
</p>
</dl><!-- net -->
<dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
<dd>
<p><!-- CL 71272 -->
The <a href="/pkg/net/http/#Transport"><code>Transport</code></a> has a
new <a href="/pkg/net/http/#Transport.MaxConnsPerHost"><code>MaxConnsPerHost</code></a>
option that permits limiting the maximum number of connections
per host.
</p>
<p><!-- CL 79919 -->
The <a href="/pkg/net/http/#Cookie"><code>Cookie</code></a> type has a new
The <a href="/pkg/net/http/#Cookie.SameSite"><code>SameSite</code></a> field
(of new type also named
<a href="/pkg/net/http/#SameSite"><code>SameSite</code></a>) to represent the new cookie attribute recently supported by most browsers.
The <code>net/http</code>'s <code>Transport</code> does not use the <code>SameSite</code>
attribute itself, but the package supports parsing and serializing the
attribute for browsers to use.
</p>
<p><!-- CL 81778 -->
It is no longer allowed to reuse a <a href="/pkg/net/http/#Server"><code>Server</code></a>
after a call to
<a href="/pkg/net/http/#Server.Shutdown"><code>Shutdown</code></a> or
<a href="/pkg/net/http/#Server.Close"><code>Close</code></a>. It was never officially supported
in the past and had often surprising behavior. Now, all future calls to the server's <code>Serve</code>
methods will return errors after a shutdown or close.
</p>
<p><!-- CL 89275 -->
The HTTP server will no longer automatically set the Content-Type if a
<code>Handler</code> sets the "<code>X-Content-Type-Options</code>" header to "<code>nosniff</code>".
</p>
<p><!-- CL 93296 -->
The constant <code>StatusMisdirectedRequest</code> is now defined for HTTP status code 421.
</p>
<p><!-- CL 123875 -->
The HTTP server will no longer cancel contexts or send on
<a href="/pkg/net/http/#CloseNotifier"><code>CloseNotifier</code></a>
channels upon receiving pipelined HTTP/1.1 requests. Browsers do
not use HTTP pipelining, but some clients (such as
Debian's <code>apt</code>) may be configured to do so.
</p>
<p><!-- CL 115255 -->
<a href="/pkg/net/http/#ProxyFromEnvironment"><code>ProxyFromEnvironment</code></a>, which is used by the
<a href="/pkg/net/http/#DefaultTransport"><code>DefaultTransport</code></a>, now
supports CIDR notation and ports in the <code>NO_PROXY</code> environment variable.
</p>
</dl><!-- net/http -->
<dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
<dd>
<p><!-- CL 77410 -->
The
<a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a>
has a new
<a href="/pkg/net/http/httputil/#ReverseProxy.ErrorHandler"><code>ErrorHandler</code></a>
option to permit changing how errors are handled.
</p>
</dl><!-- net/http/httputil -->
<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
<dd>
<p><!-- CL 78835 -->
The new <a href="/pkg/os/#UserCacheDir"><code>UserCacheDir</code></a> function
returns the default root directory to use for user-specific cached data.
</p>
<p><!-- CL 94856 -->
The new <a href="/pkg/os/#ModeIrregular"><code>ModeIrregular</code></a>
is a <a href="/pkg/os/#FileMode"><code>FileMode</code></a> 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.
</p>
<p><!-- CL 99337 -->
TODO: <a href="https://golang.org/cl/99337">https://golang.org/cl/99337</a>: enable symlink creation on Windows 10
</p>
<p><!-- CL 100077 -->
TODO: <a href="https://golang.org/cl/100077">https://golang.org/cl/100077</a>: use poller when NewFile is called with a blocking descriptor.
</p>
</dl><!-- os -->
<dl id="os/signal"><dt><a href="/pkg/os/signal/">os/signal</a></dt>
<dd>
<p><!-- CL 108376 -->
The new <a href="/pkg/os/signal/#Ignored"><code>Ignored</code></a> function reports
whether a signal is currently ignored.
</p>
</dl><!-- os/signal -->
<dl id="os/user"><dt><a href="/pkg/os/user/">os/user</a></dt>
<dd>
<p><!-- CL 92456 -->
The <code>os/user</code> package can now be built in pure Go
mode using the build tag "<code>osusergo</code>",
independent of the use of the environment
variable <code>CGO_ENABLED=0</code>. Previously the only way to use
the package's pure Go implementation was to disable <code>cgo</code>
support across the entire program.
</p>
</dl><!-- os/user -->
<!-- CL 101715 was reverted -->
<dl id="runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
<dd>
<p><!-- CL 70993 -->
Setting the <code>GODEBUG=tracebackancestors=<em>N</em></code>
environment variable now extends tracebacks with the stacks at
which goroutines were created, where <em>N</em> limits the
number of ancestor goroutines to report.
</p>
</dl><!-- runtime -->
<dl id="runtime/pprof"><dt><a href="/pkg/runtime/pprof/">runtime/pprof</a></dt>
<dd>
<p><!-- CL 102696 -->
This release adds a new "allocs" profile type that profiles
total number of bytes allocated since the program began
(including garbage-collected bytes). This is identical to the
existing "heap" profile viewed in <code>-alloc_space</code> mode.
Now <code>go test -memprofile=...</code> reports an "allocs" profile
instead of "heap" profile.
</p>
</dl><!-- runtime/pprof -->
<dl id="runtime/trace"><dt><a href="/pkg/runtime/trace/">runtime/trace</a></dt>
<dd>
<p><!-- CL 63274 -->
This release adds a new user annotation API.
It introduces three basic building blocks: Log, Span, and Task.
</p>
<p>
Log is for basic logging. When called, the message will be recorded
to the trace along with timestamp, goroutine id, and stack info.
</p>
<pre>trace.Log(ctx, messageType message)</pre>
<p>
Span can be thought as an extension of log to record interesting
time interval during a goroutine's execution. A span is local to a
goroutine by definition.
</p>
<pre>
trace.WithSpan(ctx, "doVeryExpensiveOp", func(ctx context) {
/* do something very expensive */
})</pre>
<p>
Task is higher-level concept that aids tracing of complex operations
that encompass multiple goroutines or are asynchronous.
For example, an RPC request, a HTTP request, a file write, or a
batch job can be traced with a Task.
</p>
<p>
Note we chose to design the API around context.Context so it allows
easier integration with other tracing tools, often designed around
context.Context as well. Log and WithSpan APIs recognize the task
information embedded in the context and record it in the trace as
well. That allows the Go execution tracer to associate and group
the spans and log messages based on the task information.
</p>
<p>
In order to create a Task,
</p>
<pre>ctx, end := trace.NewContext(ctx, "myTask")
defer end()</pre>
<p>
The Go execution tracer measures the time between the task created
and the task ended for the task latency.
</p>
<p>
More discussion history is in <a href="https://golang.org/cl/59572">golang.org/cl/59572</a>.
</p>
</dl><!-- runtime/trace -->
<dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
<dd>
<p><!-- CL 87095 -->
The mutex profile now includes reader/writer contention
for <a href="/pkg/sync/#RWMutex"><code>RWMutex</code></a>.
Writer/writer contention was already included in the mutex
profile.
</p>
</dl><!-- sync -->
<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
<dd>
<p><!-- CL 106275 -->
On Windows, several fields were changed from <code>uintptr</code> to a new
<a href="/pkg/syscall/?GOOS=windows&GOARCH=amd64#Pointer"><code>Pointer</code></a>
type to avoid problems with Go's garbage collector. The same change was made
to the <a href="https://godoc.org/golang.org/x/sys/windows"><code>golang.org/x/sys/windows</code></a>
package. For any code affected, users should first migrate away from the <code>syscall</code>
package to the <code>golang.org/x/sys/windows</code> package, and then change
to using the <code>Pointer</code>, while obeying the
<a href="/pkg/unsafe/#Pointer"><code>unsafe.Pointer</code> conversion rules</a>.
</p>
<p><!-- CL 118658 -->
On Linux, the <code>flags</code> parameter to
<a href="/pkg/syscall/?GOOS=linux&GOARCH=amd64#Fchmodat"><code>Fchmodat</code></a>
is now validated. Linux's <code>fchmodat</code> doesn't support the <code>flags</code> parameter
so we now mimic glibc's behavior and return an error if it's non-zero.
</p>
</dl><!-- syscall -->
<dl id="text/scanner"><dt><a href="/pkg/text/scanner/">text/scanner</a></dt>
<dd>
<p><!-- CL 112037 -->
<code>Scan()</code> now returns a <code>RawString</code> token instead of <code>String</code>
for raw string literals.
</p>
</dl><!-- text/scanner -->
<dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt>
<dd>
<p><!-- CL 84480 -->
Modifying template variables via assignments is now permitted via the <code>=</code> token:
</p>
<pre>
{{"{{"}} $v := "init" {{"}}"}}
{{"{{"}} if true {{"}}"}}
{{"{{"}} $v = "changed" {{"}}"}}
{{"{{"}} end {{"}}"}}
v: {{"{{"}} $v {{"}}"}} {{"{{"}}/* "changed" */{{"}}"}}</pre>
<p>
This required backwards-incompatible changes to the <code>text/template/parse</code>
package, but was deemed acceptable since the package's documentation clearly states
that it isn't intended for general use.
</p>
<p><!-- CL 95215 -->
In previous versions, passing an untyped nil to a template function
would result in an incorrect error stating that the function was missing an argument.
Errors resulting from untyped nil values being passed to template-evaluated functions
are now properly reported.
</p>
</dl><!-- text/template -->
<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
<dd>
<p><!-- CL 98157 -->
Parsing of timezones denoted by sign and offset is now
supported. In previous versions, numeric timezone names
(such as <code>+03</code>) were not considered valid, and only
three-letter abbreviations (such as <code>MST</code>) were accepted
when expecting a timezone name.
</p>
</dl><!-- time -->