mirror of
https://github.com/golang/go
synced 2024-11-13 17:00:22 -07:00
1d879fe774
Keep those builders busy. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/85710046
387 lines
14 KiB
HTML
387 lines
14 KiB
HTML
<!--{
|
|
"Title": "Go 1.3 Release Notes",
|
|
"Path": "/doc/go1.3",
|
|
"Template": true
|
|
}-->
|
|
|
|
<h2 id="introduction">Introduction to Go 1.3</h2>
|
|
|
|
<p>
|
|
The latest Go release, version 1.3, arrives six months after 1.2,
|
|
and contains no language changes.
|
|
It focuses primarily on implementation work, providing
|
|
precise garbage collection,
|
|
a major refactoring of the compiler tool chain that results in
|
|
faster builds, especially for large projects,
|
|
significant performance improvements across the board,
|
|
and support for Solaris and Google's Native Client architecture (NaCl).
|
|
It also has an important refinement to the memory model regarding synchronization.
|
|
As always, Go 1.3 keeps the <a href="/doc/go1compat.html">promise
|
|
of compatibility</a>,
|
|
and almost everything
|
|
will continue to compile and run without change when moved to 1.3.
|
|
</p>
|
|
|
|
<h2 id="os">Changes to the supported operating systems and architectures</h2>
|
|
|
|
<h3 id="nacl">Support for Native Client</h3>
|
|
|
|
<p>
|
|
Support for the Native Client virtual machine architecture has returned to Go with the 1.3 release.
|
|
It runs on the 32-bit Intel architectures (<code>GOARCH=386</code>) and also on 64-bit Intel, but using
|
|
32-bit pointers (<code>GOARCH=amd64p32</code>).
|
|
There is not yet support for Native Client on ARM.
|
|
Note that this is Native Client (NaCl), not Portable Native Client (PNaCl).
|
|
Details about Native Client are <a href="https://developers.google.com/native-client/dev/">here</a>;
|
|
how to set up the Go version is described <a href="http://golang.org/wiki/NativeClient">here</a>.
|
|
</p>
|
|
|
|
<h3 id="solaris">Support for Solaris</h3>
|
|
|
|
<p>
|
|
Go 1.3 now includes experimental support for Solaris on the <code>amd64</code> (64-bit x86) architecture.
|
|
</p>
|
|
|
|
|
|
<h3 id="win2000">Removal of support for Windows 2000</h3>
|
|
|
|
<p>
|
|
Microsoft stopped supporting Windows 2000 in 2010.
|
|
Since it has <a href="https://codereview.appspot.com/74790043">implementation difficulties</a>
|
|
regarding exception handling (signals in Unix terminology),
|
|
as of Go 1.3 it is not supported by Go either.
|
|
</p>
|
|
|
|
|
|
<h2 id="memory">Changes to the memory model</h2>
|
|
|
|
<p>
|
|
The Go 1.3 memory model <a href="https://codereview.appspot.com/75130045">adds a new rule</a>
|
|
concerning sending and receiving on buffered channels,
|
|
to make explicit that a buffered channel can be used as a simple
|
|
semaphore, using a send into the
|
|
channel to acquire and a receive from the channel to release.
|
|
This is not a language change, just a clarification about an expected property of communication.
|
|
</p>
|
|
|
|
<h2 id="impl">Changes to the implementations and tools</h2>
|
|
|
|
<h3 id="stacks">Stack</h3>
|
|
|
|
<p>
|
|
Go 1.3 has changed the implementation of goroutine stacks away from the old,
|
|
"segmented" model to a contiguous model.
|
|
When a goroutine needs more stack
|
|
than is available, its stack is transferred to a larger single block of memory.
|
|
The overhead of this transfer operation amortizes well and eliminates the old "hot spot"
|
|
problem when a calculation repeatedly steps across a segment boundary.
|
|
Details including performance numbers are in this
|
|
<a href="http://golang.org/s/contigstacks">design document</a>.
|
|
</p>
|
|
|
|
<h3 id="stack_size">Stack size</h3>
|
|
|
|
<p>
|
|
Go 1.2 increased the minimum stack size to 8 kilobytes; with the new stack model, it has been
|
|
put back to 4 kilobytes.
|
|
</p>
|
|
|
|
<h3 id="garbage_collector">Changes to the garbage collector</h3>
|
|
|
|
<p>
|
|
For a while now, the garbage collector has been <em>precise</em> when examining
|
|
values in the heap; the Go 1.3 release adds equivalent precision to values on the stack.
|
|
This means that a non-pointer Go value such as an integer will never be mistaken for a
|
|
pointer and prevent unused memory from being reclaimed.
|
|
</p>
|
|
|
|
<h3 id="liblink">The linker</h3>
|
|
|
|
<p>
|
|
As part of the general <a href="http://golang.org/s/go13linker">overhaul</a> to
|
|
the Go linker, the compilers and linkers have been refactored.
|
|
The linker is still a C program, but now the instruction selection phase that
|
|
was part of the linker has been moved to the compiler through the creation of a new
|
|
library called <code>liblink</code>.
|
|
By doing instruction selection only once, when the package is first compiled,
|
|
this can speed up compilation of large projects significantly.
|
|
</p>
|
|
|
|
<p>
|
|
<em>Updating</em>: Although this is a major internal change, it should have no
|
|
effect on programs.
|
|
</p>
|
|
|
|
<h3 id="gccgo">Status of gccgo</h3>
|
|
|
|
<p>
|
|
GCC release 4.9 will contain the Go 1.2 (not 1.3) version of gccgo.
|
|
The release schedules for the GCC and Go projects do not coincide,
|
|
which means that 1.3 will be available in the development branch but
|
|
that the next GCC release, 4.10, will likely have the Go 1.4 version of gccgo.
|
|
</p>
|
|
|
|
<h3 id="gocmd">Changes to the go command</h3>
|
|
|
|
<p>
|
|
The <a href="/cmd/go/"><code>cmd/go</code></a> command has several new
|
|
features.
|
|
The <a href="/cmd/go/"><code>go run</code></a> and
|
|
<a href="/cmd/go/"><code>go test</code></a> subcommands
|
|
support a new <code>-exec</code> option to specify an alternate
|
|
way to run the resulting binary.
|
|
Its immediate purpose is to support NaCl.
|
|
</p>
|
|
|
|
<p>
|
|
The test coverage support of the <a href="/cmd/go/"><code>go test</code></a>
|
|
subcommand now automatically sets the coverage mode to <code>-atomic</code>
|
|
when the race detector is enabled, to eliminate false reports about unsafe
|
|
access to coverage counters.
|
|
</p>
|
|
|
|
<p>
|
|
Finally, the go command now supports packages that import Objective-C
|
|
files (suffixed <code>.m</code>) through cgo.
|
|
</p>
|
|
|
|
<h3 id="misc">Miscellany</h3>
|
|
|
|
<p>
|
|
The program <code>misc/benchcmp</code> that compares
|
|
performance across benchmarking runs has been rewritten.
|
|
Once a shell and awk script in the main repository, it is now a Go program in the <code>go.tools</code> repo.
|
|
Documentation is <a href="http://godoc.org/code.google.com/p/go.tools/cmd/benchcmp">here</a>.
|
|
</p>
|
|
|
|
<p>
|
|
For the few of us that build Go distributions, the tool <code>misc/dist</code> has been
|
|
moved and renamed; it now lives in <code>misc/makerelease</code>, still in the main repository.
|
|
</p>
|
|
|
|
|
|
<h2 id="performance">Performance</h2>
|
|
|
|
<p>
|
|
The performance of Go binaries for this release has improved in many cases due to changes
|
|
in the runtime and garbage collection, plus some changes to libraries.
|
|
Significant instances include:
|
|
</p>
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
As mentioned above, the default stack size has been reduced from 8 kilobytes to 4 kilobytes.
|
|
</li>
|
|
|
|
<li>
|
|
The runtime handles defers more efficiently, reducing the memory footprint by about two kilobytes
|
|
per goroutine that calls defer.
|
|
</li>
|
|
|
|
<li>
|
|
The garbage collector has been sped up, using a concurrent sweep algorithm,
|
|
better parallelization, and larger pages.
|
|
The cumulative effect can be a 50-70% reduction in collector pause time.
|
|
</li>
|
|
|
|
<li>
|
|
The race detector (see <a href="http://golang.org/doc/articles/race_detector.html">this guide</a>)
|
|
is now about 40% faster.
|
|
</li>
|
|
|
|
<li>
|
|
The regular expression package <a href="/pkg/regexp/"><code>regexp</code></a>
|
|
is now significantly faster for certain simple expressions due to the implementation of
|
|
a second, one-pass execution engine. The choice of which engine to use is automatic;
|
|
the details are hidden from the user.
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p>
|
|
Also, the runtime now includes in stack dumps how long a goroutine has been blocked,
|
|
which can be useful information when debugging deadlocks or performance issues.
|
|
</p>
|
|
|
|
<h2 id="library">Changes to the standard library</h2>
|
|
|
|
<h3 id="new_packages">New packages</h3>
|
|
|
|
<p>
|
|
No new packages appear in the core libraries in Go 1.3.
|
|
</p>
|
|
|
|
<h3 id="major_library_changes">Major changes to the library</h3>
|
|
|
|
<p>
|
|
A previous bug in <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a>
|
|
made it possible to skip verification in TLS inadvertently.
|
|
In Go 1.3, the bug is fixed: one must specify either ServerName or
|
|
InsecureSkipVerify, and if ServerName is specified it is enforced.
|
|
This may break existing code that incorrectly depended on insecure
|
|
behavior.
|
|
</p>
|
|
|
|
<p>
|
|
There is an important new type added to the standard library: <a href="/pkg/sync/#Pool"><code>sync.Pool</code></a>.
|
|
It provides an efficient mechanism for implementing certain types of caches whose memory
|
|
can be reclaimed automatically by the system.
|
|
</p>
|
|
|
|
<p>
|
|
The <a href="/pkg/testing/"><code>testing</code></a> package's benchmarking helper,
|
|
<a href="/pkg/testing/#B"><code>B</code></a>, now has a
|
|
<a href="/pkg/testing/#B.RunParallel"><code>RunParallel</code></a> method
|
|
to make it easier to run benchmarks that exercise multiple CPUs.
|
|
</p>
|
|
|
|
<p>
|
|
<em>Updating</em>: The crypto/tls fix may break existing code, but such
|
|
code was erroneous and should be updated.
|
|
</p>
|
|
|
|
<h3 id="minor_library_changes">Minor changes to the library</h3>
|
|
|
|
<p>
|
|
The following list summarizes a number of minor changes to the library, mostly additions.
|
|
See the relevant package documentation for more information about each change.
|
|
</p>
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
The complex power function, <a href="/pkg/math/cmplx/#Pow"><code>Pow</code></a>,
|
|
now specifies the behavior when the first argument is zero. It was undefined before.
|
|
The details are in the <a href="/pkg/math/cmplx/#Pow">documentation for the function</a>.
|
|
</li>
|
|
|
|
<li> In the <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package,
|
|
a new <a href="/pkg/crypto/tls/#DialWithDialer"><code>DialWithDialer</code></a>
|
|
function lets one establish a TLS connection using an existing dialer, making it easier
|
|
to control dial options such as timeouts.
|
|
The package also now reports the TLS version used by the connection in the
|
|
<a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a>
|
|
struct.
|
|
</li>
|
|
|
|
<li> The <a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>
|
|
function of the <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package
|
|
now supports parsing (and elsewhere, serialization) of PKCS #10 certificate
|
|
signature requests.
|
|
</li>
|
|
|
|
<li>
|
|
The formatted print functions of the <code>fmt</code> package now define <code>%F</code>
|
|
as a synonym for <code>%f</code> when printing floating-point values.
|
|
</li>
|
|
|
|
<li>
|
|
The <a href="/pkg/net/http/"><code>net/http</code></a> package now exposes the
|
|
properties of a TLS connection used to make a client request in the new
|
|
<a href="/pkg/net/http/#Response"><code>Response.TLS</code></a> field.
|
|
</li>
|
|
|
|
<li>
|
|
The <a href="/pkg/net/http/"><code>net/http</code></a> package now
|
|
allows setting an optional server error logger
|
|
with <a href="/pkg/net/http/#Server"><code>Server.ErrorLog</code></a>.
|
|
The default is still that all errors go to stderr.
|
|
</li>
|
|
|
|
<li>
|
|
The <a href="/pkg/net/http/"><code>net/http</code></a> package now
|
|
supports disabling HTTP keep-alive connections on the server
|
|
with <a href="/pkg/net/http/#Server.SetKeepAlivesEnabled"><code>Server.SetKeepAlivesEnabled</code></a>.
|
|
The default continues to be that the server does keep-alive (reuses
|
|
connections for multiple requests) by default. Only
|
|
resource-constrained servers or those in the process of graceful
|
|
shutdown will want to disable them.
|
|
</li>
|
|
|
|
<li>
|
|
The <a href="/pkg/net/http/"><code>net/http</code></a> package adds an optional
|
|
<a href="/pkg/net/http/#Transport"><code>Transport.TLSHandshakeTimeout</code></a>
|
|
setting to cap the amount of time HTTP client requests will wait for
|
|
TLS handshakes to complete. It's now also set by default
|
|
on <a href="/pkg/net/http#DefaultTransport"><code>DefaultTransport</code></a>.
|
|
</li>
|
|
|
|
<li>
|
|
The <a href="/pkg/net/http/"><code>net/http</code></a> package's
|
|
<a href="/pkg/net/http/#DefaultTransport"><code>DefaultTransport</code></a>,
|
|
used by the HTTP client code, now
|
|
enables <a href="http://en.wikipedia.org/wiki/Keepalive#TCP_keepalive">TCP
|
|
keep-alives</a> by
|
|
default. Other <a href="/pkg/net/http/#Transport"><code>Transport</code></a>
|
|
values with a nil <code>Dial</code> field continue to function the same
|
|
as before: no TCP keep-alives are used.
|
|
</li>
|
|
|
|
<li>
|
|
The <a href="/pkg/net/http/"><code>net/http</code></a> package
|
|
now enables <a href="http://en.wikipedia.org/wiki/Keepalive#TCP_keepalive">TCP
|
|
keep-alives</a> for incoming server requests when
|
|
<a href="/pkg/net/http/#ListenAndServe"><code>ListenAndServe</code></a>
|
|
or
|
|
<a href="/pkg/net/http/#ListenAndServeTLS"><code>ListenAndServeTLS</code></a>
|
|
are used. When a server is started otherwise, TCP keep-alives are not enabled.
|
|
</li>
|
|
|
|
<li>
|
|
The <a href="/pkg/net/http/"><code>net/http</code></a> package now
|
|
provides an
|
|
optional <a href="/pkg/net/http/#Server"><code>Server.ConnState</code></a>
|
|
callback to hook various phases of a server connection's lifecycle
|
|
(see <a href="/pkg/net/http/#ConnState"><code>ConnState</code></a>). This
|
|
can be used to implement rate limiting or graceful shutdown.
|
|
</li>
|
|
|
|
<li>
|
|
The <a href="/pkg/net/http/"><code>net/http</code></a> package's HTTP
|
|
client now has an
|
|
optional <a href="/pkg/net/http/#Client"><code>Client.Timeout</code></a>
|
|
field to specify an end-to-end timeout on requests made using the
|
|
client.
|
|
</li>
|
|
|
|
<li> In the <a href="/pkg/net/"><code>net</code></a> package,
|
|
the <a href="/pkg/net/#Dialer"><code>Dialer</code></a> struct now
|
|
has a <code>KeepAlive</code> option to specify a keep-alive period for the connection.
|
|
</li>
|
|
|
|
<li> TODO: net: enable fast socket creation using SOCK_CLOEXEC and Accept4 on FreeBSD 10 (69100043)</li>
|
|
|
|
<li>
|
|
The <a href="/pkg/os/exec/"><code>os/exec</code></a> package now implements
|
|
what the documentation has always said with regard to relative paths for the binary.
|
|
In particular, it only calls <a href="/pkg/os/exec/#LookPath"><code>LookPath</code></a>
|
|
when the binary's file name contains no path separators.
|
|
</li>
|
|
|
|
<li>
|
|
The <a href="/pkg/strconv/#CanBackquote"><code>CanBackquote</code></a>
|
|
function in the <a href="/pkg/strconv/"><code>strconv</code></a> package
|
|
now considers the <code>DEL</code> character, <code>U+007F</code>, to be
|
|
non-printing.
|
|
</li>
|
|
|
|
<li> TODO: syscall: add Accept4 for freebsd (CL 68880043)</li>
|
|
|
|
<li> TODO: syscall: add NewCallbackCDecl to use for windows callbacks (CL 36180044)</li>
|
|
|
|
<li> TODO: syscall: add support for FreeBSD 10 (CL 56770044, 56980043)</li>
|
|
|
|
<li>
|
|
The <a href="/pkg/testing/"><code>testing</code></a> package now
|
|
diagnoses tests that call <code>panic(nil)</code>, which are almost always erroneous.
|
|
</li>
|
|
|
|
<li>
|
|
The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated
|
|
support throughout the system has been upgraded from
|
|
Unicode 6.2.0 to <a href="http://www.unicode.org/versions/Unicode6.3.0/">Unicode 6.3.0</a>.
|
|
</li>
|
|
|
|
</ul>
|