2014-03-25 20:56:16 -06:00
|
|
|
<!--{
|
|
|
|
"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.
|
2014-04-08 16:19:35 -06:00
|
|
|
It focuses primarily on implementation work, providing
|
2014-03-25 20:56:16 -06:00
|
|
|
precise garbage collection,
|
2014-04-08 16:19:35 -06:00
|
|
|
a major refactoring of the compiler tool chain that results in
|
|
|
|
faster builds, especially for large projects,
|
2014-04-07 22:07:17 -06:00
|
|
|
significant performance improvements across the board,
|
2014-05-16 15:54:05 -06:00
|
|
|
and support for DragonFly BSD, Solaris, Plan 9 and Google's Native Client architecture (NaCl).
|
2014-04-08 16:19:35 -06:00
|
|
|
It also has an important refinement to the memory model regarding synchronization.
|
2014-03-25 20:56:16 -06:00
|
|
|
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>
|
|
|
|
|
2014-05-16 15:54:05 -06:00
|
|
|
<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>
|
|
|
|
|
|
|
|
<h3 id="dragonfly">Support for DragonFly BSD</h3>
|
|
|
|
|
|
|
|
<p>
|
2014-05-20 11:38:45 -06:00
|
|
|
Go 1.3 now includes experimental support for DragonFly BSD on the <code>amd64</code> (64-bit x86) and <code>386</code> (32-bit x86) architectures.
|
|
|
|
It uses DragonFly BSD 3.6 or above.
|
2014-05-16 15:54:05 -06:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<h3 id="freebsd">Support for FreeBSD</h3>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
It was not announced at the time, but since the release of Go 1.2, support for Go on FreeBSD
|
|
|
|
requires FreeBSD 8 or above.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
As of Go 1.3, support for Go on FreeBSD requires that the kernel be compiled with the
|
|
|
|
<code>COMPAT_FREEBSD32</code> flag configured.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
2014-05-20 11:38:45 -06:00
|
|
|
In concert with the switch to EABI syscalls for ARM platforms, Go 1.3 will run only on FreeBSD 10.
|
|
|
|
The x86 platforms, 386 and amd64, are unaffected.
|
2014-05-16 15:54:05 -06:00
|
|
|
</p>
|
|
|
|
|
2014-03-25 20:56:16 -06:00
|
|
|
<h3 id="nacl">Support for Native Client</h3>
|
2014-04-08 20:47:35 -06:00
|
|
|
|
2014-03-25 20:56:16 -06:00
|
|
|
<p>
|
2014-04-08 20:47:35 -06:00
|
|
|
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>;
|
2014-07-24 18:28:39 -06:00
|
|
|
how to set up the Go version is described <a href="//golang.org/wiki/NativeClient">here</a>.
|
2014-03-25 20:56:16 -06:00
|
|
|
</p>
|
|
|
|
|
2014-05-16 15:54:05 -06:00
|
|
|
<h3 id="netbsd">Support for NetBSD</h3>
|
2014-03-25 20:56:16 -06:00
|
|
|
|
|
|
|
<p>
|
2014-05-16 15:54:05 -06:00
|
|
|
As of Go 1.3, support for Go on NetBSD requires NetBSD 6.0 or above.
|
2014-03-25 20:56:16 -06:00
|
|
|
</p>
|
|
|
|
|
2014-05-16 15:54:05 -06:00
|
|
|
<h3 id="openbsd">Support for OpenBSD</h3>
|
2014-04-18 13:40:55 -06:00
|
|
|
|
|
|
|
<p>
|
2014-05-17 14:57:40 -06:00
|
|
|
As of Go 1.3, support for Go on OpenBSD requires OpenBSD 5.5 or above.
|
2014-03-25 20:56:16 -06:00
|
|
|
</p>
|
|
|
|
|
2014-05-16 15:54:05 -06:00
|
|
|
<h3 id="plan9">Support for Plan 9</h3>
|
2014-04-16 11:40:41 -06:00
|
|
|
|
|
|
|
<p>
|
2014-05-20 11:38:45 -06:00
|
|
|
Go 1.3 now includes experimental support for Plan 9 on the <code>386</code> (32-bit x86) architecture.
|
|
|
|
It requires the <code>Tsemacquire</code> syscall, which has been in Plan 9 since June, 2012.
|
2014-04-16 11:40:41 -06:00
|
|
|
</p>
|
|
|
|
|
2014-05-16 15:54:05 -06:00
|
|
|
<h3 id="solaris">Support for Solaris</h3>
|
2014-04-16 11:40:41 -06:00
|
|
|
|
2014-04-29 13:54:37 -06:00
|
|
|
<p>
|
2014-05-20 11:38:45 -06:00
|
|
|
Go 1.3 now includes experimental support for Solaris on the <code>amd64</code> (64-bit x86) architecture.
|
|
|
|
It requires illumos, Solaris 11 or above.
|
2014-04-29 13:54:37 -06:00
|
|
|
</p>
|
|
|
|
|
2014-03-25 20:56:16 -06:00
|
|
|
<h2 id="memory">Changes to the memory model</h2>
|
|
|
|
|
|
|
|
<p>
|
2014-03-26 18:45:51 -06:00
|
|
|
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.
|
2014-03-25 20:56:16 -06:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<h2 id="impl">Changes to the implementations and tools</h2>
|
|
|
|
|
|
|
|
<h3 id="stacks">Stack</h3>
|
|
|
|
|
|
|
|
<p>
|
2014-03-27 19:55:37 -06:00
|
|
|
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
|
2014-07-24 18:28:39 -06:00
|
|
|
<a href="//golang.org/s/contigstacks">design document</a>.
|
2014-03-25 20:56:16 -06:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<h3 id="garbage_collector">Changes to the garbage collector</h3>
|
|
|
|
|
|
|
|
<p>
|
2014-04-08 20:47:35 -06:00
|
|
|
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.
|
2014-03-25 20:56:16 -06:00
|
|
|
</p>
|
|
|
|
|
2014-05-15 14:16:26 -06:00
|
|
|
<p>
|
|
|
|
Starting with Go 1.3, the runtime assumes that values with pointer type
|
|
|
|
contain pointers and other values do not.
|
|
|
|
This assumption is fundamental to the precise behavior of both stack expansion
|
|
|
|
and garbage collection.
|
|
|
|
Programs that use <a href="/pkg/unsafe/">package unsafe</a>
|
2014-05-22 09:45:03 -06:00
|
|
|
to store integers in pointer-typed values are illegal and will crash if the runtime detects the behavior.
|
2014-05-15 14:16:26 -06:00
|
|
|
Programs that use <a href="/pkg/unsafe/">package unsafe</a> to store pointers
|
2014-05-22 09:45:03 -06:00
|
|
|
in integer-typed values are also illegal but more difficult to diagnose during execution.
|
2014-05-15 14:16:26 -06:00
|
|
|
Because the pointers are hidden from the runtime, a stack expansion or garbage collection
|
|
|
|
may reclaim the memory they point at, creating
|
2014-07-24 18:28:39 -06:00
|
|
|
<a href="//en.wikipedia.org/wiki/Dangling_pointer">dangling pointers</a>.
|
2014-05-15 14:16:26 -06:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
2014-05-22 09:45:03 -06:00
|
|
|
<em>Updating</em>: Code that uses <code>unsafe.Pointer</code> to convert
|
|
|
|
an integer-typed value held in memory into a pointer is illegal and must be rewritten.
|
2014-05-15 14:16:26 -06:00
|
|
|
Such code can be identified by <code>go vet</code>.
|
|
|
|
</p>
|
|
|
|
|
2014-05-16 10:15:21 -06:00
|
|
|
<h3 id="map">Map iteration</h3>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Iterations over small maps no longer happen in a consistent order.
|
2014-07-24 18:28:39 -06:00
|
|
|
Go 1 defines that “<a href="//golang.org/ref/spec#For_statements">The iteration order over maps
|
2014-05-16 10:15:21 -06:00
|
|
|
is not specified and is not guaranteed to be the same from one iteration to the next.</a>”
|
|
|
|
To keep code from depending on map iteration order,
|
|
|
|
Go 1.0 started each map iteration at a random index in the map.
|
|
|
|
A new map implementation introduced in Go 1.1 neglected to randomize
|
|
|
|
iteration for maps with eight or fewer entries, although the iteration order
|
|
|
|
can still vary from system to system.
|
|
|
|
This has allowed people to write Go 1.1 and Go 1.2 programs that
|
|
|
|
depend on small map iteration order and therefore only work reliably on certain systems.
|
|
|
|
Go 1.3 reintroduces random iteration for small maps in order to flush out these bugs.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<em>Updating</em>: If code assumes a fixed iteration order for small maps,
|
|
|
|
it will break and must be rewritten not to make that assumption.
|
|
|
|
Because only small maps are affected, the problem arises most often in tests.
|
|
|
|
</p>
|
|
|
|
|
2014-03-25 20:56:16 -06:00
|
|
|
<h3 id="liblink">The linker</h3>
|
|
|
|
|
|
|
|
<p>
|
2014-07-24 18:28:39 -06:00
|
|
|
As part of the general <a href="//golang.org/s/go13linker">overhaul</a> to
|
2014-04-08 16:19:35 -06:00
|
|
|
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.
|
2014-03-25 20:56:16 -06:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
2014-04-08 16:19:35 -06:00
|
|
|
<em>Updating</em>: Although this is a major internal change, it should have no
|
|
|
|
effect on programs.
|
2014-03-25 20:56:16 -06:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<h3 id="gccgo">Status of gccgo</h3>
|
|
|
|
|
|
|
|
<p>
|
2014-04-08 17:45:39 -06:00
|
|
|
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.
|
2014-03-25 20:56:16 -06:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<h3 id="gocmd">Changes to the go command</h3>
|
|
|
|
|
|
|
|
<p>
|
2014-04-08 23:20:00 -06:00
|
|
|
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>
|
|
|
|
|
2014-04-18 12:00:38 -06:00
|
|
|
<p>
|
|
|
|
The <a href="/cmd/go/"><code>go test</code></a> subcommand
|
|
|
|
now always builds the package, even if it has no test files.
|
|
|
|
Previously, it would do nothing if no test files were present.
|
|
|
|
</p>
|
|
|
|
|
2014-05-06 19:10:36 -06:00
|
|
|
<p>
|
|
|
|
The <a href="/cmd/go/"><code>go build</code></a> subcommand
|
|
|
|
supports a new <code>-i</code> option to install dependencies
|
|
|
|
of the specified target, but not the target itself.
|
|
|
|
</p>
|
|
|
|
|
2014-05-19 23:32:31 -06:00
|
|
|
<p>
|
|
|
|
Cross compiling with <a href="/cmd/cgo/"><code>cgo</code></a> enabled
|
2014-05-20 11:38:45 -06:00
|
|
|
is now supported.
|
|
|
|
The CC_FOR_TARGET and CXX_FOR_TARGET environment
|
2014-05-19 23:32:31 -06:00
|
|
|
variables are used when running all.bash to specify the cross compilers
|
|
|
|
for C and C++ code, respectively.
|
|
|
|
</p>
|
|
|
|
|
2014-04-08 23:20:00 -06:00
|
|
|
<p>
|
|
|
|
Finally, the go command now supports packages that import Objective-C
|
|
|
|
files (suffixed <code>.m</code>) through cgo.
|
2014-03-25 20:56:16 -06:00
|
|
|
</p>
|
|
|
|
|
2014-05-20 11:38:45 -06:00
|
|
|
<h3 id="cgo">Changes to cgo</h3>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
The <a href="/cmd/cgo/"><code>cmd/cgo</code></a> command,
|
|
|
|
which processes <code>import "C"</code> declarations in Go packages,
|
|
|
|
has corrected a serious bug that may cause some packages to stop compiling.
|
|
|
|
Previously, all pointers to incomplete struct types translated to the Go type <code>*[0]byte</code>,
|
|
|
|
with the effect that the Go compiler could not diagnose passing one kind of struct pointer
|
|
|
|
to a function expecting another.
|
|
|
|
Go 1.3 corrects this mistake by translating each different
|
|
|
|
incomplete struct to a different named type.
|
cmd/cgo: given typedef struct S T, make C.T and C.struct_S interchangeable
For incomplete struct S, C.T and C.struct_S were interchangeable in Go 1.2
and earlier, because all incomplete types were interchangeable
(even C.struct_S1 and C.struct_S2).
CL 76450043, which fixed issue 7409, made different incomplete types
different from Go's point of view, so that they were no longer completely
interchangeable.
However, imprecision about C.T and C.struct_S - really the same
underlying C type - is the one behavior enabled by the bug that
is most likely to be depended on by existing cgo code.
Explicitly allow it, to keep that code working.
Fixes #7786.
LGTM=iant, r
R=golang-codereviews, iant, r
CC=golang-codereviews
https://golang.org/cl/98580046
2014-05-28 12:04:31 -06:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Given the C declaration <code>typedef struct S T</code> for an incomplete <code>struct S</code>,
|
|
|
|
some Go code used this bug to refer to the types <code>C.struct_S</code> and <code>C.T</code> interchangeably.
|
|
|
|
Cgo now explicitly allows this use, even for completed struct types.
|
|
|
|
However, some Go code also used this bug to pass (for example) a <code>*C.FILE</code>
|
2014-05-20 11:38:45 -06:00
|
|
|
from one package to another.
|
|
|
|
This is not legal and no longer works: in general Go packages
|
|
|
|
should avoid exposing C types and names in their APIs.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<em>Updating</em>: Code confusing pointers to incomplete types or
|
|
|
|
passing them across package boundaries will no longer compile
|
|
|
|
and must be rewritten.
|
|
|
|
If the conversion is correct and must be preserved,
|
|
|
|
use an explicit conversion via <a href="/pkg/unsafe/#Pointer"><code>unsafe.Pointer</code></a>.
|
|
|
|
</p>
|
|
|
|
|
2014-05-12 13:43:51 -06:00
|
|
|
<h3 id="swig">SWIG 3.0 required for programs that use SWIG</h3>
|
|
|
|
|
|
|
|
<p>
|
2014-05-20 11:38:45 -06:00
|
|
|
For Go programs that use SWIG, SWIG version 3.0 is now required.
|
|
|
|
The <a href="/cmd/go"><code>cmd/go</code></a> command will now link the
|
2014-05-12 13:43:51 -06:00
|
|
|
SWIG generated object files directly into the binary, rather than
|
|
|
|
building and linking with a shared library.
|
|
|
|
</p>
|
|
|
|
|
build: remove tmp dir names from objects, support GOROOT_FINAL again
If we compile a generated file stored in a temporary
directory - let's say /tmp/12345/work/x.c - then by default
6c stores the full path and then the pcln table in the
final binary includes the full path. This makes repeated builds
(using different temporary directories) produce different
binaries, even if the inputs are the same.
In the old 'go tool pack', the P flag specified a prefix to remove
from all stored paths (if present), and cmd/go invoked
'go tool pack grcP $WORK' to remove references to the
temporary work directory.
We've changed the build to avoid pack as much as possible,
under the theory that instead of making pack convert from
.6 to .a, the tools should just write the .a directly and save a
round of I/O.
Instead of going back to invoking pack always, define a common
flag -trimpath in the assemblers, C compilers, and Go compilers,
implemented in liblink, and arrange for cmd/go to use the flag.
Then the object files being written out have the shortened paths
from the start.
While we are here, reimplement pcln support for GOROOT_FINAL.
A build in /tmp/go uses GOROOT=/tmp/go, but if GOROOT_FINAL=/usr/local/go
is set, then a source file named /tmp/go/x.go is recorded instead as
/usr/local/go/x.go. We use this so that we can prepare distributions
to be installed in /usr/local/go without actually working in that
directory. The conversion to liblink deleted all the old file name
handling code, including the GOROOT_FINAL translation.
Bring the GOROOT_FINAL translation back.
Before this CL, using GOROOT_FINAL=/goroot make.bash:
g% strings $(which go) | grep -c $TMPDIR
6
g% strings $(which go) | grep -c $GOROOT
793
g%
After this CL:
g% strings $(which go) | grep -c $TMPDIR
0
g% strings $(which go) | grep -c $GOROOT
0
g%
(The references to $TMPDIR tend to be cgo-generated source files.)
Adding the -trimpath flag to the assemblers required converting
them to the new Go-semantics flag parser. The text in go1.3.html
is copied and adjusted from go1.1.html, which is when we applied
that conversion to the compilers and linkers.
Fixes #6989.
LGTM=iant
R=r, iant
CC=golang-codereviews
https://golang.org/cl/88300045
2014-04-15 18:46:46 -06:00
|
|
|
<h3 id="gc_flag">Command-line flag parsing</h3>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
In the gc tool chain, the assemblers now use the
|
|
|
|
same command-line flag parsing rules as the Go flag package, a departure
|
2014-05-20 11:38:45 -06:00
|
|
|
from the traditional Unix flag parsing.
|
|
|
|
This may affect scripts that invoke the tool directly.
|
build: remove tmp dir names from objects, support GOROOT_FINAL again
If we compile a generated file stored in a temporary
directory - let's say /tmp/12345/work/x.c - then by default
6c stores the full path and then the pcln table in the
final binary includes the full path. This makes repeated builds
(using different temporary directories) produce different
binaries, even if the inputs are the same.
In the old 'go tool pack', the P flag specified a prefix to remove
from all stored paths (if present), and cmd/go invoked
'go tool pack grcP $WORK' to remove references to the
temporary work directory.
We've changed the build to avoid pack as much as possible,
under the theory that instead of making pack convert from
.6 to .a, the tools should just write the .a directly and save a
round of I/O.
Instead of going back to invoking pack always, define a common
flag -trimpath in the assemblers, C compilers, and Go compilers,
implemented in liblink, and arrange for cmd/go to use the flag.
Then the object files being written out have the shortened paths
from the start.
While we are here, reimplement pcln support for GOROOT_FINAL.
A build in /tmp/go uses GOROOT=/tmp/go, but if GOROOT_FINAL=/usr/local/go
is set, then a source file named /tmp/go/x.go is recorded instead as
/usr/local/go/x.go. We use this so that we can prepare distributions
to be installed in /usr/local/go without actually working in that
directory. The conversion to liblink deleted all the old file name
handling code, including the GOROOT_FINAL translation.
Bring the GOROOT_FINAL translation back.
Before this CL, using GOROOT_FINAL=/goroot make.bash:
g% strings $(which go) | grep -c $TMPDIR
6
g% strings $(which go) | grep -c $GOROOT
793
g%
After this CL:
g% strings $(which go) | grep -c $TMPDIR
0
g% strings $(which go) | grep -c $GOROOT
0
g%
(The references to $TMPDIR tend to be cgo-generated source files.)
Adding the -trimpath flag to the assemblers required converting
them to the new Go-semantics flag parser. The text in go1.3.html
is copied and adjusted from go1.1.html, which is when we applied
that conversion to the compilers and linkers.
Fixes #6989.
LGTM=iant
R=r, iant
CC=golang-codereviews
https://golang.org/cl/88300045
2014-04-15 18:46:46 -06:00
|
|
|
For example,
|
|
|
|
<code>go tool 6a -SDfoo</code> must now be written
|
|
|
|
<code>go tool 6a -S -D foo</code>.
|
|
|
|
(The same change was made to the compilers and linkers in <a href="/doc/go1.1#gc_flag">Go 1.1</a>.)
|
|
|
|
</p>
|
|
|
|
|
2014-06-12 08:08:54 -06:00
|
|
|
<h3 id="godoc">Changes to godoc</h3>
|
|
|
|
<p>
|
|
|
|
When invoked with the <code>-analysis</code> flag,
|
2014-07-24 18:28:39 -06:00
|
|
|
<a href="//godoc.org/code.google.com/p/go.tools/cmd/godoc">godoc</a>
|
2014-06-12 08:08:54 -06:00
|
|
|
now performs sophisticated <a href="/lib/godoc/analysis/help.html">static
|
|
|
|
analysis</a> of the code it indexes.
|
|
|
|
The results of analysis are presented in both the source view and the
|
|
|
|
package documentation view, and include the call graph of each package
|
|
|
|
and the relationships between
|
|
|
|
definitions and references,
|
|
|
|
types and their methods,
|
|
|
|
interfaces and their implementations,
|
|
|
|
send and receive operations on channels,
|
|
|
|
functions and their callers, and
|
|
|
|
call sites and their callees.
|
|
|
|
</p>
|
|
|
|
|
2014-03-25 20:56:16 -06:00
|
|
|
<h3 id="misc">Miscellany</h3>
|
|
|
|
|
2014-04-08 16:19:35 -06:00
|
|
|
<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.
|
2014-07-24 18:28:39 -06:00
|
|
|
Documentation is <a href="//godoc.org/code.google.com/p/go.tools/cmd/benchcmp">here</a>.
|
2014-04-08 16:19:35 -06:00
|
|
|
</p>
|
|
|
|
|
2014-04-08 23:20:00 -06:00
|
|
|
<p>
|
2014-04-08 16:19:35 -06:00
|
|
|
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.
|
2014-04-08 23:20:00 -06:00
|
|
|
</p>
|
2014-03-25 20:56:16 -06:00
|
|
|
|
|
|
|
<h2 id="performance">Performance</h2>
|
|
|
|
|
|
|
|
<p>
|
2014-04-08 15:12:20 -06:00
|
|
|
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:
|
2014-03-25 20:56:16 -06:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
|
2014-04-08 15:12:20 -06:00
|
|
|
<li>
|
|
|
|
The runtime handles defers more efficiently, reducing the memory footprint by about two kilobytes
|
|
|
|
per goroutine that calls defer.
|
|
|
|
</li>
|
2014-03-25 20:56:16 -06:00
|
|
|
|
2014-04-08 15:12:20 -06:00
|
|
|
<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>
|
2014-03-25 20:56:16 -06:00
|
|
|
|
2014-04-08 15:12:20 -06:00
|
|
|
<li>
|
2014-05-07 08:49:13 -06:00
|
|
|
The race detector (see <a href="/doc/articles/race_detector.html">this guide</a>)
|
2014-04-08 15:12:20 -06:00
|
|
|
is now about 40% faster.
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li>
|
|
|
|
The regular expression package <a href="/pkg/regexp/"><code>regexp</code></a>
|
2014-04-10 16:52:16 -06:00
|
|
|
is now significantly faster for certain simple expressions due to the implementation of
|
2014-05-20 11:38:45 -06:00
|
|
|
a second, one-pass execution engine.
|
|
|
|
The choice of which engine to use is automatic;
|
2014-04-08 15:12:20 -06:00
|
|
|
the details are hidden from the user.
|
|
|
|
</li>
|
|
|
|
|
|
|
|
</ul>
|
2014-03-25 20:56:16 -06:00
|
|
|
|
2014-04-07 22:07:17 -06:00
|
|
|
<p>
|
2014-04-08 15:12:20 -06:00
|
|
|
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.
|
2014-04-07 22:07:17 -06:00
|
|
|
</p>
|
|
|
|
|
2014-04-08 15:12:20 -06:00
|
|
|
<h2 id="library">Changes to the standard library</h2>
|
2014-03-25 20:56:16 -06:00
|
|
|
|
|
|
|
<h3 id="new_packages">New packages</h3>
|
|
|
|
|
|
|
|
<p>
|
2014-04-18 02:50:06 -06:00
|
|
|
A new package <a href="/pkg/debug/plan9obj/"><code>debug/plan9obj</code></a> was added to the standard library.
|
|
|
|
It implements access to Plan 9 <a href="http://plan9.bell-labs.com/magic/man2html/6/a.out">a.out</a> object files.
|
2014-03-25 20:56:16 -06:00
|
|
|
</p>
|
|
|
|
|
2014-04-08 15:12:20 -06:00
|
|
|
<h3 id="major_library_changes">Major changes to the library</h3>
|
|
|
|
|
2014-04-08 23:20:00 -06:00
|
|
|
<p>
|
|
|
|
A previous bug in <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a>
|
2014-04-10 16:52:16 -06:00
|
|
|
made it possible to skip verification in TLS inadvertently.
|
2014-04-08 23:20:00 -06:00
|
|
|
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>
|
|
|
|
|
2014-04-08 15:12:20 -06:00
|
|
|
<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>
|
2014-04-08 23:20:00 -06:00
|
|
|
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.
|
2014-04-08 15:12:20 -06:00
|
|
|
</p>
|
|
|
|
|
2014-03-25 20:56:16 -06:00
|
|
|
<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>
|
|
|
|
|
2014-04-09 22:17:48 -06:00
|
|
|
<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>
|
2014-04-08 15:12:20 -06:00
|
|
|
|
2014-04-09 22:17:48 -06:00
|
|
|
<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>
|
2014-04-08 15:12:20 -06:00
|
|
|
|
|
|
|
<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>
|
|
|
|
|
2014-05-28 13:48:35 -06:00
|
|
|
<li>
|
|
|
|
The <a href="/pkg/math/big/"><code>math/big</code></a> package's
|
|
|
|
<a href="/pkg/math/big/#Int"><code>Int</code></a> and
|
|
|
|
<a href="/pkg/math/big/#Rat"><code>Rat</code></a> types
|
|
|
|
now implement
|
|
|
|
<a href="/pkg/encoding/#TextMarshaler"><code>encoding.TextMarshaler</code></a> and
|
|
|
|
<a href="/pkg/encoding/#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>.
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<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>
|
|
|
|
|
2014-04-08 20:46:33 -06:00
|
|
|
<li>
|
|
|
|
The <a href="/pkg/net/http/"><code>net/http</code></a> package now exposes the
|
2014-04-10 16:09:59 -06:00
|
|
|
properties of a TLS connection used to make a client request in the new
|
2014-04-08 20:46:33 -06:00
|
|
|
<a href="/pkg/net/http/#Response"><code>Response.TLS</code></a> field.
|
|
|
|
</li>
|
2014-04-08 15:12:20 -06:00
|
|
|
|
2014-04-08 20:46:33 -06:00
|
|
|
<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>
|
2014-04-08 15:12:20 -06:00
|
|
|
|
2014-04-10 16:09:59 -06:00
|
|
|
<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
|
2014-05-20 11:38:45 -06:00
|
|
|
connections for multiple requests) by default.
|
|
|
|
Only resource-constrained servers or those in the process of graceful
|
2014-04-10 16:09:59 -06:00
|
|
|
shutdown will want to disable them.
|
|
|
|
</li>
|
2014-04-08 15:12:20 -06:00
|
|
|
|
2014-04-10 16:09:59 -06:00
|
|
|
<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
|
2014-05-20 11:38:45 -06:00
|
|
|
TLS handshakes to complete.
|
|
|
|
It's now also set by default
|
2014-04-10 16:09:59 -06:00
|
|
|
on <a href="/pkg/net/http#DefaultTransport"><code>DefaultTransport</code></a>.
|
|
|
|
</li>
|
2014-04-08 15:12:20 -06:00
|
|
|
|
2014-04-10 16:09:59 -06:00
|
|
|
<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
|
2014-05-20 11:38:45 -06:00
|
|
|
keep-alives</a> by default.
|
|
|
|
Other <a href="/pkg/net/http/#Transport"><code>Transport</code></a>
|
2014-04-10 16:09:59 -06:00
|
|
|
values with a nil <code>Dial</code> field continue to function the same
|
|
|
|
as before: no TCP keep-alives are used.
|
|
|
|
</li>
|
2014-04-08 15:12:20 -06:00
|
|
|
|
2014-04-10 16:09:59 -06:00
|
|
|
<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>
|
2014-05-20 11:38:45 -06:00
|
|
|
are used.
|
|
|
|
When a server is started otherwise, TCP keep-alives are not enabled.
|
2014-04-10 16:09:59 -06:00
|
|
|
</li>
|
2014-04-08 15:12:20 -06:00
|
|
|
|
2014-04-10 16:09:59 -06:00
|
|
|
<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
|
2014-05-20 11:38:45 -06:00
|
|
|
(see <a href="/pkg/net/http/#ConnState"><code>ConnState</code></a>).
|
|
|
|
This can be used to implement rate limiting or graceful shutdown.
|
2014-04-10 16:09:59 -06:00
|
|
|
</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>
|
2014-04-08 15:12:20 -06:00
|
|
|
|
2014-04-09 22:17:48 -06:00
|
|
|
<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>
|
2014-04-08 15:12:20 -06:00
|
|
|
|
2014-04-14 11:19:10 -06:00
|
|
|
<li>
|
|
|
|
The <a href="/pkg/net/http/"><code>net/http</code></a> package's
|
|
|
|
<a href="/pkg/net/http/#Transport"><code>Transport</code></a>
|
|
|
|
now closes <a href="/pkg/net/http/#Request"><code>Request.Body</code></a>
|
2014-04-14 17:28:52 -06:00
|
|
|
consistently, even on error.
|
2014-04-14 11:19:10 -06:00
|
|
|
</li>
|
|
|
|
|
2014-04-08 15:12:20 -06:00
|
|
|
<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>
|
|
|
|
|
2014-05-23 18:39:58 -06:00
|
|
|
<li>
|
|
|
|
The <a href="/pkg/reflect/#Value.SetMapIndex"><code>SetMapIndex</code></a>
|
|
|
|
function in the <a href="/pkg/reflect/"><code>reflect</code></a> package
|
|
|
|
no longer panics when deleting from a <code>nil</code> map.
|
|
|
|
</li>
|
|
|
|
|
runtime: crash when func main calls Goexit and all other goroutines exit
This has typically crashed in the past, although usually with
an 'all goroutines are asleep - deadlock!' message that shows
no goroutines (because there aren't any).
Previous discussion at:
https://groups.google.com/d/msg/golang-nuts/uCT_7WxxopQ/BoSBlLFzUTkJ
https://groups.google.com/d/msg/golang-dev/KUojayEr20I/u4fp_Ej5PdUJ
http://golang.org/issue/7711
There is general agreement that runtime.Goexit terminates the
main goroutine, so that main cannot return, so the program does
not exit.
The interpretation that all other goroutines exiting causes an
exit(0) is relatively new and was not part of those discussions.
That is what this CL changes.
Thankfully, even though the exit(0) has been there for a while,
some other accounting bugs made it very difficult to trigger,
so it is reasonable to replace. In particular, see golang.org/issue/7711#c10
for an examination of the behavior across past releases.
Fixes #7711.
LGTM=iant, r
R=golang-codereviews, iant, dvyukov, r
CC=golang-codereviews
https://golang.org/cl/88210044
2014-04-16 11:12:18 -06:00
|
|
|
<li>
|
|
|
|
If the main goroutine calls
|
2014-04-20 12:29:17 -06:00
|
|
|
<a href="/pkg/runtime/#Goexit"><code>runtime.Goexit</code></a>
|
runtime: crash when func main calls Goexit and all other goroutines exit
This has typically crashed in the past, although usually with
an 'all goroutines are asleep - deadlock!' message that shows
no goroutines (because there aren't any).
Previous discussion at:
https://groups.google.com/d/msg/golang-nuts/uCT_7WxxopQ/BoSBlLFzUTkJ
https://groups.google.com/d/msg/golang-dev/KUojayEr20I/u4fp_Ej5PdUJ
http://golang.org/issue/7711
There is general agreement that runtime.Goexit terminates the
main goroutine, so that main cannot return, so the program does
not exit.
The interpretation that all other goroutines exiting causes an
exit(0) is relatively new and was not part of those discussions.
That is what this CL changes.
Thankfully, even though the exit(0) has been there for a while,
some other accounting bugs made it very difficult to trigger,
so it is reasonable to replace. In particular, see golang.org/issue/7711#c10
for an examination of the behavior across past releases.
Fixes #7711.
LGTM=iant, r
R=golang-codereviews, iant, dvyukov, r
CC=golang-codereviews
https://golang.org/cl/88210044
2014-04-16 11:12:18 -06:00
|
|
|
and all other goroutines finish execution, the program now always crashes,
|
|
|
|
reporting a detected deadlock.
|
|
|
|
Earlier versions of Go handled this situation inconsistently: most instances
|
|
|
|
were reported as deadlocks, but some trivial cases exited cleanly instead.
|
|
|
|
</li>
|
|
|
|
|
2014-06-02 12:05:46 -06:00
|
|
|
<li>
|
|
|
|
The runtime/debug package now has a new function
|
|
|
|
<a href="/pkg/runtime/debug/#WriteHeapDump"><code>debug.WriteHeapDump</code></a>
|
|
|
|
that writes out a description of the heap.
|
|
|
|
</li>
|
|
|
|
|
2014-04-08 15:12:20 -06:00
|
|
|
<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>
|
|
|
|
|
2014-05-15 22:18:14 -06:00
|
|
|
<li>
|
|
|
|
The <a href="/pkg/syscall/"><code>syscall</code></a> package now provides
|
|
|
|
<a href="/pkg/syscall/#SendmsgN"><code>SendmsgN</code></a>
|
|
|
|
as an alternate version of
|
|
|
|
<a href="/pkg/syscall/#Sendmsg"><code>Sendmsg</code></a>
|
|
|
|
that returns the number of bytes written.
|
|
|
|
</li>
|
|
|
|
|
2014-04-11 22:56:17 -06:00
|
|
|
<li>
|
|
|
|
On Windows, the <a href="/pkg/syscall/"><code>syscall</code></a> package now
|
|
|
|
supports the cdecl calling convention through the addition of a new function
|
|
|
|
<a href="/pkg/syscall/#NewCallbackCDecl"><code>NewCallbackCDecl</code></a>
|
|
|
|
alongside the existing function
|
|
|
|
<a href="/pkg/syscall/#NewCallback"><code>NewCallback</code></a>.
|
|
|
|
</li>
|
2014-04-08 15:12:20 -06:00
|
|
|
|
|
|
|
<li>
|
|
|
|
The <a href="/pkg/testing/"><code>testing</code></a> package now
|
2014-04-08 16:19:35 -06:00
|
|
|
diagnoses tests that call <code>panic(nil)</code>, which are almost always erroneous.
|
2014-05-09 10:18:50 -06:00
|
|
|
Also, tests now write profiles (if invoked with profiling flags) even on failure.
|
2014-04-08 15:12:20 -06:00
|
|
|
</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>
|
|
|
|
|
2014-03-25 20:56:16 -06:00
|
|
|
</ul>
|