blob: d51052b2e5eb0277c2a7046e06f2c6d1e5e506c4 [file] [log] [blame]
Rob Pike09e1da32014-03-26 13:56:16 +11001<!--{
2 "Title": "Go 1.3 Release Notes",
3 "Path": "/doc/go1.3",
4 "Template": true
5}-->
6
7<h2 id="introduction">Introduction to Go 1.3</h2>
8
9<p>
10The latest Go release, version 1.3, arrives six months after 1.2,
11and contains no language changes.
Rob Pikec5f14c52014-04-09 08:19:35 +100012It focuses primarily on implementation work, providing
Rob Pike09e1da32014-03-26 13:56:16 +110013precise garbage collection,
Rob Pikec5f14c52014-04-09 08:19:35 +100014a major refactoring of the compiler tool chain that results in
15faster builds, especially for large projects,
Rob Pike78025fb2014-04-08 14:07:17 +100016significant performance improvements across the board,
Mikio Hara37323fe2014-05-17 06:54:05 +090017and support for DragonFly BSD, Solaris, Plan 9 and Google's Native Client architecture (NaCl).
Rob Pikec5f14c52014-04-09 08:19:35 +100018It also has an important refinement to the memory model regarding synchronization.
Rob Pike09e1da32014-03-26 13:56:16 +110019As always, Go 1.3 keeps the <a href="/doc/go1compat.html">promise
20of compatibility</a>,
21and almost everything
22will continue to compile and run without change when moved to 1.3.
23</p>
24
25<h2 id="os">Changes to the supported operating systems and architectures</h2>
26
Rob Pikec5f14c52014-04-09 08:19:35 +100027<h3 id="win2000">Removal of support for Windows 2000</h3>
Rob Pike09e1da32014-03-26 13:56:16 +110028
29<p>
Rob Pike78025fb2014-04-08 14:07:17 +100030Microsoft stopped supporting Windows 2000 in 2010.
31Since it has <a href="https://codereview.appspot.com/74790043">implementation difficulties</a>
32regarding exception handling (signals in Unix terminology),
33as of Go 1.3 it is not supported by Go either.
Rob Pike09e1da32014-03-26 13:56:16 +110034</p>
35
Mikio Hara37323fe2014-05-17 06:54:05 +090036<h3 id="dragonfly">Support for DragonFly BSD</h3>
37
38<p>
Russ Cox7ef0eb12014-05-20 13:38:45 -040039Go 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.
40It uses DragonFly BSD 3.6 or above.
Mikio Hara37323fe2014-05-17 06:54:05 +090041</p>
Rob Pike09e1da32014-03-26 13:56:16 +110042
Emil Hessman3af8d6f2014-04-16 12:15:39 -070043<h3 id="freebsd">Support for FreeBSD</h3>
Rob Pike59f6c812014-04-16 10:40:41 -070044
45<p>
46It was not announced at the time, but since the release of Go 1.2, support for Go on FreeBSD
47requires FreeBSD 8 or above.
48</p>
49
50<p>
51As of Go 1.3, support for Go on FreeBSD requires that the kernel be compiled with the
52<code>COMPAT_FREEBSD32</code> flag configured.
53</p>
54
Shenghou Ma74dccea2014-04-29 15:54:37 -040055<p>
Russ Cox7ef0eb12014-05-20 13:38:45 -040056In concert with the switch to EABI syscalls for ARM platforms, Go 1.3 will run only on FreeBSD 10.
57The x86 platforms, 386 and amd64, are unaffected.
Shenghou Ma74dccea2014-04-29 15:54:37 -040058</p>
59
Mikio Hara37323fe2014-05-17 06:54:05 +090060<h3 id="nacl">Support for Native Client</h3>
61
62<p>
63Support for the Native Client virtual machine architecture has returned to Go with the 1.3 release.
64It runs on the 32-bit Intel architectures (<code>GOARCH=386</code>) and also on 64-bit Intel, but using
6532-bit pointers (<code>GOARCH=amd64p32</code>).
66There is not yet support for Native Client on ARM.
67Note that this is Native Client (NaCl), not Portable Native Client (PNaCl).
68Details about Native Client are <a href="https://developers.google.com/native-client/dev/">here</a>;
Andrew Gerrand43ad89d2014-07-25 10:28:39 +100069how to set up the Go version is described <a href="//golang.org/wiki/NativeClient">here</a>.
Mikio Hara37323fe2014-05-17 06:54:05 +090070</p>
71
72<h3 id="netbsd">Support for NetBSD</h3>
73
74<p>
75As of Go 1.3, support for Go on NetBSD requires NetBSD 6.0 or above.
76</p>
77
78<h3 id="openbsd">Support for OpenBSD</h3>
79
80<p>
Mikio Hara77dd4112014-05-18 05:57:40 +090081As of Go 1.3, support for Go on OpenBSD requires OpenBSD 5.5 or above.
Mikio Hara37323fe2014-05-17 06:54:05 +090082</p>
83
84<h3 id="plan9">Support for Plan 9</h3>
85
86<p>
Russ Cox7ef0eb12014-05-20 13:38:45 -040087Go 1.3 now includes experimental support for Plan 9 on the <code>386</code> (32-bit x86) architecture.
88It requires the <code>Tsemacquire</code> syscall, which has been in Plan 9 since June, 2012.
Mikio Hara37323fe2014-05-17 06:54:05 +090089</p>
90
91<h3 id="solaris">Support for Solaris</h3>
92
93<p>
Russ Cox7ef0eb12014-05-20 13:38:45 -040094Go 1.3 now includes experimental support for Solaris on the <code>amd64</code> (64-bit x86) architecture.
95It requires illumos, Solaris 11 or above.
Mikio Hara37323fe2014-05-17 06:54:05 +090096</p>
97
Rob Pike09e1da32014-03-26 13:56:16 +110098<h2 id="memory">Changes to the memory model</h2>
99
100<p>
Rob Pikea4380922014-03-27 11:45:51 +1100101The Go 1.3 memory model <a href="https://codereview.appspot.com/75130045">adds a new rule</a>
102concerning sending and receiving on buffered channels,
103to make explicit that a buffered channel can be used as a simple
104semaphore, using a send into the
105channel to acquire and a receive from the channel to release.
106This is not a language change, just a clarification about an expected property of communication.
Rob Pike09e1da32014-03-26 13:56:16 +1100107</p>
108
109<h2 id="impl">Changes to the implementations and tools</h2>
110
111<h3 id="stacks">Stack</h3>
112
113<p>
Rob Pike610f3952014-03-28 12:55:37 +1100114Go 1.3 has changed the implementation of goroutine stacks away from the old,
115"segmented" model to a contiguous model.
116When a goroutine needs more stack
117than is available, its stack is transferred to a larger single block of memory.
118The overhead of this transfer operation amortizes well and eliminates the old "hot spot"
119problem when a calculation repeatedly steps across a segment boundary.
120Details including performance numbers are in this
Andrew Gerrand43ad89d2014-07-25 10:28:39 +1000121<a href="//golang.org/s/contigstacks">design document</a>.
Rob Pike09e1da32014-03-26 13:56:16 +1100122</p>
123
Rob Pike09e1da32014-03-26 13:56:16 +1100124<h3 id="garbage_collector">Changes to the garbage collector</h3>
125
126<p>
Rob Pikeb69238b2014-04-09 12:47:35 +1000127For a while now, the garbage collector has been <em>precise</em> when examining
128values in the heap; the Go 1.3 release adds equivalent precision to values on the stack.
129This means that a non-pointer Go value such as an integer will never be mistaken for a
130pointer and prevent unused memory from being reclaimed.
Rob Pike09e1da32014-03-26 13:56:16 +1100131</p>
132
Russ Cox208a1ea2014-05-15 16:16:26 -0400133<p>
134Starting with Go 1.3, the runtime assumes that values with pointer type
135contain pointers and other values do not.
136This assumption is fundamental to the precise behavior of both stack expansion
137and garbage collection.
138Programs that use <a href="/pkg/unsafe/">package unsafe</a>
Russ Cox8d8dab32014-05-22 11:45:03 -0400139to store integers in pointer-typed values are illegal and will crash if the runtime detects the behavior.
Russ Cox208a1ea2014-05-15 16:16:26 -0400140Programs that use <a href="/pkg/unsafe/">package unsafe</a> to store pointers
Russ Cox8d8dab32014-05-22 11:45:03 -0400141in integer-typed values are also illegal but more difficult to diagnose during execution.
Russ Cox208a1ea2014-05-15 16:16:26 -0400142Because the pointers are hidden from the runtime, a stack expansion or garbage collection
143may reclaim the memory they point at, creating
Andrew Gerrand43ad89d2014-07-25 10:28:39 +1000144<a href="//en.wikipedia.org/wiki/Dangling_pointer">dangling pointers</a>.
Russ Cox208a1ea2014-05-15 16:16:26 -0400145</p>
146
147<p>
Russ Cox8d8dab32014-05-22 11:45:03 -0400148<em>Updating</em>: Code that uses <code>unsafe.Pointer</code> to convert
149an integer-typed value held in memory into a pointer is illegal and must be rewritten.
Russ Cox208a1ea2014-05-15 16:16:26 -0400150Such code can be identified by <code>go vet</code>.
151</p>
152
Russ Coxd1f627f2014-05-16 12:15:21 -0400153<h3 id="map">Map iteration</h3>
154
155<p>
156Iterations over small maps no longer happen in a consistent order.
Andrew Gerrand43ad89d2014-07-25 10:28:39 +1000157Go 1 defines that &ldquo;<a href="//golang.org/ref/spec#For_statements">The iteration order over maps
Russ Coxd1f627f2014-05-16 12:15:21 -0400158is not specified and is not guaranteed to be the same from one iteration to the next.</a>&rdquo;
159To keep code from depending on map iteration order,
160Go 1.0 started each map iteration at a random index in the map.
161A new map implementation introduced in Go 1.1 neglected to randomize
162iteration for maps with eight or fewer entries, although the iteration order
163can still vary from system to system.
164This has allowed people to write Go 1.1 and Go 1.2 programs that
165depend on small map iteration order and therefore only work reliably on certain systems.
166Go 1.3 reintroduces random iteration for small maps in order to flush out these bugs.
167</p>
168
169<p>
170<em>Updating</em>: If code assumes a fixed iteration order for small maps,
171it will break and must be rewritten not to make that assumption.
172Because only small maps are affected, the problem arises most often in tests.
173</p>
174
Rob Pike09e1da32014-03-26 13:56:16 +1100175<h3 id="liblink">The linker</h3>
176
177<p>
Andrew Gerrand43ad89d2014-07-25 10:28:39 +1000178As part of the general <a href="//golang.org/s/go13linker">overhaul</a> to
Rob Pikec5f14c52014-04-09 08:19:35 +1000179the Go linker, the compilers and linkers have been refactored.
180The linker is still a C program, but now the instruction selection phase that
181was part of the linker has been moved to the compiler through the creation of a new
182library called <code>liblink</code>.
183By doing instruction selection only once, when the package is first compiled,
184this can speed up compilation of large projects significantly.
Rob Pike09e1da32014-03-26 13:56:16 +1100185</p>
186
187<p>
Rob Pikec5f14c52014-04-09 08:19:35 +1000188<em>Updating</em>: Although this is a major internal change, it should have no
189effect on programs.
Rob Pike09e1da32014-03-26 13:56:16 +1100190</p>
191
192<h3 id="gccgo">Status of gccgo</h3>
193
194<p>
Rob Pike96775a32014-04-09 09:45:39 +1000195GCC release 4.9 will contain the Go 1.2 (not 1.3) version of gccgo.
196The release schedules for the GCC and Go projects do not coincide,
197which means that 1.3 will be available in the development branch but
198that the next GCC release, 4.10, will likely have the Go 1.4 version of gccgo.
Rob Pike09e1da32014-03-26 13:56:16 +1100199</p>
200
201<h3 id="gocmd">Changes to the go command</h3>
202
203<p>
Rob Pike56294f42014-04-09 15:20:00 +1000204The <a href="/cmd/go/"><code>cmd/go</code></a> command has several new
205features.
206The <a href="/cmd/go/"><code>go run</code></a> and
207<a href="/cmd/go/"><code>go test</code></a> subcommands
208support a new <code>-exec</code> option to specify an alternate
209way to run the resulting binary.
210Its immediate purpose is to support NaCl.
211</p>
212
213<p>
214The test coverage support of the <a href="/cmd/go/"><code>go test</code></a>
215subcommand now automatically sets the coverage mode to <code>-atomic</code>
216when the race detector is enabled, to eliminate false reports about unsafe
217access to coverage counters.
218</p>
219
220<p>
Rob Pike0d612a82014-04-18 11:00:38 -0700221The <a href="/cmd/go/"><code>go test</code></a> subcommand
222now always builds the package, even if it has no test files.
223Previously, it would do nothing if no test files were present.
224</p>
225
226<p>
David Crawshaw2702ad32014-05-06 21:10:36 -0400227The <a href="/cmd/go/"><code>go build</code></a> subcommand
228supports a new <code>-i</code> option to install dependencies
229of the specified target, but not the target itself.
230</p>
231
232<p>
Elias Naur88d07b22014-05-20 01:32:31 -0400233Cross compiling with <a href="/cmd/cgo/"><code>cgo</code></a> enabled
Russ Cox7ef0eb12014-05-20 13:38:45 -0400234is now supported.
235The CC_FOR_TARGET and CXX_FOR_TARGET environment
Elias Naur88d07b22014-05-20 01:32:31 -0400236variables are used when running all.bash to specify the cross compilers
237for C and C++ code, respectively.
238</p>
239
240<p>
Rob Pike56294f42014-04-09 15:20:00 +1000241Finally, the go command now supports packages that import Objective-C
242files (suffixed <code>.m</code>) through cgo.
Rob Pike09e1da32014-03-26 13:56:16 +1100243</p>
244
Russ Cox7ef0eb12014-05-20 13:38:45 -0400245<h3 id="cgo">Changes to cgo</h3>
246
247<p>
248The <a href="/cmd/cgo/"><code>cmd/cgo</code></a> command,
249which processes <code>import "C"</code> declarations in Go packages,
250has corrected a serious bug that may cause some packages to stop compiling.
251Previously, all pointers to incomplete struct types translated to the Go type <code>*[0]byte</code>,
252with the effect that the Go compiler could not diagnose passing one kind of struct pointer
253to a function expecting another.
254Go 1.3 corrects this mistake by translating each different
255incomplete struct to a different named type.
Russ Cox0782ee32014-05-28 14:04:31 -0400256</p>
257
258<p>
259Given the C declaration <code>typedef struct S T</code> for an incomplete <code>struct S</code>,
260some Go code used this bug to refer to the types <code>C.struct_S</code> and <code>C.T</code> interchangeably.
261Cgo now explicitly allows this use, even for completed struct types.
262However, some Go code also used this bug to pass (for example) a <code>*C.FILE</code>
Russ Cox7ef0eb12014-05-20 13:38:45 -0400263from one package to another.
264This is not legal and no longer works: in general Go packages
265should avoid exposing C types and names in their APIs.
266</p>
267
268<p>
269<em>Updating</em>: Code confusing pointers to incomplete types or
270passing them across package boundaries will no longer compile
271and must be rewritten.
272If the conversion is correct and must be preserved,
273use an explicit conversion via <a href="/pkg/unsafe/#Pointer"><code>unsafe.Pointer</code></a>.
274</p>
275
Ian Lance Taylor02cc45a2014-05-12 12:43:51 -0700276<h3 id="swig">SWIG 3.0 required for programs that use SWIG</h3>
277
278<p>
Russ Cox7ef0eb12014-05-20 13:38:45 -0400279For Go programs that use SWIG, SWIG version 3.0 is now required.
280The <a href="/cmd/go"><code>cmd/go</code></a> command will now link the
Ian Lance Taylor02cc45a2014-05-12 12:43:51 -0700281SWIG generated object files directly into the binary, rather than
282building and linking with a shared library.
283</p>
284
Russ Coxe97b3ab2014-04-15 20:46:46 -0400285<h3 id="gc_flag">Command-line flag parsing</h3>
286
287<p>
288In the gc tool chain, the assemblers now use the
289same command-line flag parsing rules as the Go flag package, a departure
Russ Cox7ef0eb12014-05-20 13:38:45 -0400290from the traditional Unix flag parsing.
291This may affect scripts that invoke the tool directly.
Russ Coxe97b3ab2014-04-15 20:46:46 -0400292For example,
293<code>go tool 6a -SDfoo</code> must now be written
294<code>go tool 6a -S -D foo</code>.
295(The same change was made to the compilers and linkers in <a href="/doc/go1.1#gc_flag">Go 1.1</a>.)
296</p>
297
Alan Donovan04766932014-06-12 10:08:54 -0400298<h3 id="godoc">Changes to godoc</h3>
299<p>
300When invoked with the <code>-analysis</code> flag,
Andrew Gerrandeb91b5f2014-12-10 11:01:55 +1100301<a href="//godoc.org/golang.org/x/tools/cmd/godoc">godoc</a>
Alan Donovan04766932014-06-12 10:08:54 -0400302now performs sophisticated <a href="/lib/godoc/analysis/help.html">static
303analysis</a> of the code it indexes.
304The results of analysis are presented in both the source view and the
305package documentation view, and include the call graph of each package
306and the relationships between
307definitions and references,
308types and their methods,
309interfaces and their implementations,
310send and receive operations on channels,
311functions and their callers, and
312call sites and their callees.
313</p>
314
Rob Pike09e1da32014-03-26 13:56:16 +1100315<h3 id="misc">Miscellany</h3>
316
Rob Pikec5f14c52014-04-09 08:19:35 +1000317<p>
318The program <code>misc/benchcmp</code> that compares
319performance across benchmarking runs has been rewritten.
320Once a shell and awk script in the main repository, it is now a Go program in the <code>go.tools</code> repo.
Andrew Gerrandeb91b5f2014-12-10 11:01:55 +1100321Documentation is <a href="//godoc.org/golang.org/x/tools/cmd/benchcmp">here</a>.
Rob Pikec5f14c52014-04-09 08:19:35 +1000322</p>
323
Rob Pike56294f42014-04-09 15:20:00 +1000324<p>
Rob Pikec5f14c52014-04-09 08:19:35 +1000325For the few of us that build Go distributions, the tool <code>misc/dist</code> has been
326moved and renamed; it now lives in <code>misc/makerelease</code>, still in the main repository.
Rob Pike56294f42014-04-09 15:20:00 +1000327</p>
Rob Pike09e1da32014-03-26 13:56:16 +1100328
Rob Pike09e1da32014-03-26 13:56:16 +1100329<h2 id="performance">Performance</h2>
330
331<p>
Rob Pike969dc762014-04-09 07:12:20 +1000332The performance of Go binaries for this release has improved in many cases due to changes
333in the runtime and garbage collection, plus some changes to libraries.
334Significant instances include:
Rob Pike09e1da32014-03-26 13:56:16 +1100335</p>
336
337<ul>
338
339<li>
Rob Pike969dc762014-04-09 07:12:20 +1000340The runtime handles defers more efficiently, reducing the memory footprint by about two kilobytes
341per goroutine that calls defer.
342</li>
343
344<li>
345The garbage collector has been sped up, using a concurrent sweep algorithm,
346better parallelization, and larger pages.
347The cumulative effect can be a 50-70% reduction in collector pause time.
348</li>
349
350<li>
Dmitriy Vyukov2e1ddeb2014-05-07 18:49:13 +0400351The race detector (see <a href="/doc/articles/race_detector.html">this guide</a>)
Rob Pike969dc762014-04-09 07:12:20 +1000352is now about 40% faster.
353</li>
354
355<li>
356The regular expression package <a href="/pkg/regexp/"><code>regexp</code></a>
Rob Pike1d879fe2014-04-11 08:52:16 +1000357is now significantly faster for certain simple expressions due to the implementation of
Russ Cox7ef0eb12014-05-20 13:38:45 -0400358a second, one-pass execution engine.
359The choice of which engine to use is automatic;
Rob Pike969dc762014-04-09 07:12:20 +1000360the details are hidden from the user.
Rob Pike09e1da32014-03-26 13:56:16 +1100361</li>
362
363</ul>
364
Rob Pike969dc762014-04-09 07:12:20 +1000365<p>
366Also, the runtime now includes in stack dumps how long a goroutine has been blocked,
367which can be useful information when debugging deadlocks or performance issues.
368</p>
369
Rob Pike09e1da32014-03-26 13:56:16 +1100370<h2 id="library">Changes to the standard library</h2>
371
Rob Pike09e1da32014-03-26 13:56:16 +1100372<h3 id="new_packages">New packages</h3>
373
374<p>
David du Colombierba593752014-04-18 10:50:06 +0200375A new package <a href="/pkg/debug/plan9obj/"><code>debug/plan9obj</code></a> was added to the standard library.
376It implements access to Plan 9 <a href="http://plan9.bell-labs.com/magic/man2html/6/a.out">a.out</a> object files.
Rob Pike09e1da32014-03-26 13:56:16 +1100377</p>
378
Rob Pike969dc762014-04-09 07:12:20 +1000379<h3 id="major_library_changes">Major changes to the library</h3>
380
381<p>
Rob Pike56294f42014-04-09 15:20:00 +1000382A previous bug in <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a>
Rob Pike1d879fe2014-04-11 08:52:16 +1000383made it possible to skip verification in TLS inadvertently.
Rob Pike56294f42014-04-09 15:20:00 +1000384In Go 1.3, the bug is fixed: one must specify either ServerName or
385InsecureSkipVerify, and if ServerName is specified it is enforced.
386This may break existing code that incorrectly depended on insecure
387behavior.
388</p>
389
390<p>
Rob Pike969dc762014-04-09 07:12:20 +1000391There is an important new type added to the standard library: <a href="/pkg/sync/#Pool"><code>sync.Pool</code></a>.
392It provides an efficient mechanism for implementing certain types of caches whose memory
393can be reclaimed automatically by the system.
394</p>
395
396<p>
Rob Pike56294f42014-04-09 15:20:00 +1000397The <a href="/pkg/testing/"><code>testing</code></a> package's benchmarking helper,
398<a href="/pkg/testing/#B"><code>B</code></a>, now has a
399<a href="/pkg/testing/#B.RunParallel"><code>RunParallel</code></a> method
400to make it easier to run benchmarks that exercise multiple CPUs.
401</p>
402
403<p>
404<em>Updating</em>: The crypto/tls fix may break existing code, but such
405code was erroneous and should be updated.
Rob Pike969dc762014-04-09 07:12:20 +1000406</p>
407
Rob Pike09e1da32014-03-26 13:56:16 +1100408<h3 id="minor_library_changes">Minor changes to the library</h3>
409
410<p>
411The following list summarizes a number of minor changes to the library, mostly additions.
412See the relevant package documentation for more information about each change.
413</p>
414
415<ul>
416
Rob Pikeb6684b32014-04-10 14:17:48 +1000417<li> In the <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package,
418a new <a href="/pkg/crypto/tls/#DialWithDialer"><code>DialWithDialer</code></a>
419function lets one establish a TLS connection using an existing dialer, making it easier
420to control dial options such as timeouts.
421The package also now reports the TLS version used by the connection in the
422<a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a>
423struct.
424</li>
Rob Pike969dc762014-04-09 07:12:20 +1000425
Rob Pikeb6684b32014-04-10 14:17:48 +1000426<li> The <a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>
427function of the <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package
428now supports parsing (and elsewhere, serialization) of PKCS #10 certificate
429signature requests.
430</li>
Rob Pike969dc762014-04-09 07:12:20 +1000431
432<li>
433The formatted print functions of the <code>fmt</code> package now define <code>%F</code>
434as a synonym for <code>%f</code> when printing floating-point values.
435</li>
436
Brad Fitzpatrick4f193cd2014-04-08 19:46:33 -0700437<li>
Russ Coxc038c382014-05-28 15:48:35 -0400438The <a href="/pkg/math/big/"><code>math/big</code></a> package's
439<a href="/pkg/math/big/#Int"><code>Int</code></a> and
440<a href="/pkg/math/big/#Rat"><code>Rat</code></a> types
441now implement
442<a href="/pkg/encoding/#TextMarshaler"><code>encoding.TextMarshaler</code></a> and
443<a href="/pkg/encoding/#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>.
444</li>
445
446<li>
447The complex power function, <a href="/pkg/math/cmplx/#Pow"><code>Pow</code></a>,
448now specifies the behavior when the first argument is zero.
449It was undefined before.
450The details are in the <a href="/pkg/math/cmplx/#Pow">documentation for the function</a>.
451</li>
452
453<li>
Brad Fitzpatrick4f193cd2014-04-08 19:46:33 -0700454The <a href="/pkg/net/http/"><code>net/http</code></a> package now exposes the
Brad Fitzpatrick1e68e6a2014-04-10 15:09:59 -0700455properties of a TLS connection used to make a client request in the new
Brad Fitzpatrick4f193cd2014-04-08 19:46:33 -0700456<a href="/pkg/net/http/#Response"><code>Response.TLS</code></a> field.
457</li>
Rob Pike969dc762014-04-09 07:12:20 +1000458
Brad Fitzpatrick4f193cd2014-04-08 19:46:33 -0700459<li>
460The <a href="/pkg/net/http/"><code>net/http</code></a> package now
461allows setting an optional server error logger
462with <a href="/pkg/net/http/#Server"><code>Server.ErrorLog</code></a>.
463The default is still that all errors go to stderr.
464</li>
Rob Pike969dc762014-04-09 07:12:20 +1000465
Brad Fitzpatrick1e68e6a2014-04-10 15:09:59 -0700466<li>
467The <a href="/pkg/net/http/"><code>net/http</code></a> package now
468supports disabling HTTP keep-alive connections on the server
469with <a href="/pkg/net/http/#Server.SetKeepAlivesEnabled"><code>Server.SetKeepAlivesEnabled</code></a>.
470The default continues to be that the server does keep-alive (reuses
Russ Cox7ef0eb12014-05-20 13:38:45 -0400471connections for multiple requests) by default.
472Only resource-constrained servers or those in the process of graceful
Brad Fitzpatrick1e68e6a2014-04-10 15:09:59 -0700473shutdown will want to disable them.
474</li>
Rob Pike969dc762014-04-09 07:12:20 +1000475
Brad Fitzpatrick1e68e6a2014-04-10 15:09:59 -0700476<li>
477The <a href="/pkg/net/http/"><code>net/http</code></a> package adds an optional
478<a href="/pkg/net/http/#Transport"><code>Transport.TLSHandshakeTimeout</code></a>
479setting to cap the amount of time HTTP client requests will wait for
Russ Cox7ef0eb12014-05-20 13:38:45 -0400480TLS handshakes to complete.
481It's now also set by default
Brad Fitzpatrick1e68e6a2014-04-10 15:09:59 -0700482on <a href="/pkg/net/http#DefaultTransport"><code>DefaultTransport</code></a>.
483</li>
Rob Pike969dc762014-04-09 07:12:20 +1000484
Brad Fitzpatrick1e68e6a2014-04-10 15:09:59 -0700485<li>
486The <a href="/pkg/net/http/"><code>net/http</code></a> package's
487<a href="/pkg/net/http/#DefaultTransport"><code>DefaultTransport</code></a>,
488used by the HTTP client code, now
489enables <a href="http://en.wikipedia.org/wiki/Keepalive#TCP_keepalive">TCP
Russ Cox7ef0eb12014-05-20 13:38:45 -0400490keep-alives</a> by default.
491Other <a href="/pkg/net/http/#Transport"><code>Transport</code></a>
Brad Fitzpatrick1e68e6a2014-04-10 15:09:59 -0700492values with a nil <code>Dial</code> field continue to function the same
493as before: no TCP keep-alives are used.
494</li>
Rob Pike969dc762014-04-09 07:12:20 +1000495
Brad Fitzpatrick1e68e6a2014-04-10 15:09:59 -0700496<li>
497The <a href="/pkg/net/http/"><code>net/http</code></a> package
498now enables <a href="http://en.wikipedia.org/wiki/Keepalive#TCP_keepalive">TCP
499keep-alives</a> for incoming server requests when
500<a href="/pkg/net/http/#ListenAndServe"><code>ListenAndServe</code></a>
501or
502<a href="/pkg/net/http/#ListenAndServeTLS"><code>ListenAndServeTLS</code></a>
Russ Cox7ef0eb12014-05-20 13:38:45 -0400503are used.
504When a server is started otherwise, TCP keep-alives are not enabled.
Brad Fitzpatrick1e68e6a2014-04-10 15:09:59 -0700505</li>
Rob Pike969dc762014-04-09 07:12:20 +1000506
Brad Fitzpatrick1e68e6a2014-04-10 15:09:59 -0700507<li>
508The <a href="/pkg/net/http/"><code>net/http</code></a> package now
509provides an
510optional <a href="/pkg/net/http/#Server"><code>Server.ConnState</code></a>
511callback to hook various phases of a server connection's lifecycle
Russ Cox7ef0eb12014-05-20 13:38:45 -0400512(see <a href="/pkg/net/http/#ConnState"><code>ConnState</code></a>).
513This can be used to implement rate limiting or graceful shutdown.
Brad Fitzpatrick1e68e6a2014-04-10 15:09:59 -0700514</li>
515
516<li>
517The <a href="/pkg/net/http/"><code>net/http</code></a> package's HTTP
518client now has an
519optional <a href="/pkg/net/http/#Client"><code>Client.Timeout</code></a>
520field to specify an end-to-end timeout on requests made using the
521client.
522</li>
Rob Pike969dc762014-04-09 07:12:20 +1000523
Andrew Gerrandaf403c02014-08-07 15:42:06 +1000524<li>
525The <a href="/pkg/net/http/"><code>net/http</code></a> package's
526<a href="/pkg/net/http/#Request.ParseMultipartForm"><code>Request.ParseMultipartForm</code></a>
527method will now return an error if the body's <code>Content-Type</code>
528is not <code>mutipart/form-data</code>.
529Prior to Go 1.3 it would silently fail and return <code>nil</code>.
530Code that relies on the previous behavior should be updated.
531</li>
532
Rob Pikeb6684b32014-04-10 14:17:48 +1000533<li> In the <a href="/pkg/net/"><code>net</code></a> package,
534the <a href="/pkg/net/#Dialer"><code>Dialer</code></a> struct now
535has a <code>KeepAlive</code> option to specify a keep-alive period for the connection.
536</li>
Rob Pike969dc762014-04-09 07:12:20 +1000537
Brad Fitzpatrick071a0f42014-04-14 10:19:10 -0700538<li>
539The <a href="/pkg/net/http/"><code>net/http</code></a> package's
540<a href="/pkg/net/http/#Transport"><code>Transport</code></a>
541now closes <a href="/pkg/net/http/#Request"><code>Request.Body</code></a>
Brad Fitzpatrick632e6412014-04-14 16:28:52 -0700542consistently, even on error.
Brad Fitzpatrick071a0f42014-04-14 10:19:10 -0700543</li>
544
Rob Pike969dc762014-04-09 07:12:20 +1000545<li>
546The <a href="/pkg/os/exec/"><code>os/exec</code></a> package now implements
547what the documentation has always said with regard to relative paths for the binary.
548In particular, it only calls <a href="/pkg/os/exec/#LookPath"><code>LookPath</code></a>
549when the binary's file name contains no path separators.
550</li>
551
552<li>
Keith Randall4b3019b2014-05-23 17:39:58 -0700553The <a href="/pkg/reflect/#Value.SetMapIndex"><code>SetMapIndex</code></a>
554function in the <a href="/pkg/reflect/"><code>reflect</code></a> package
555no longer panics when deleting from a <code>nil</code> map.
556</li>
557
558<li>
Russ Coxade6bc62014-04-16 13:12:18 -0400559If the main goroutine calls
David du Colombierf1876752014-04-20 20:29:17 +0200560<a href="/pkg/runtime/#Goexit"><code>runtime.Goexit</code></a>
Russ Coxade6bc62014-04-16 13:12:18 -0400561and all other goroutines finish execution, the program now always crashes,
562reporting a detected deadlock.
563Earlier versions of Go handled this situation inconsistently: most instances
564were reported as deadlocks, but some trivial cases exited cleanly instead.
565</li>
566
567<li>
Ian Lance Taylor06b67f32014-06-02 11:05:46 -0700568The runtime/debug package now has a new function
569<a href="/pkg/runtime/debug/#WriteHeapDump"><code>debug.WriteHeapDump</code></a>
570that writes out a description of the heap.
571</li>
572
573<li>
Rob Pike969dc762014-04-09 07:12:20 +1000574The <a href="/pkg/strconv/#CanBackquote"><code>CanBackquote</code></a>
575function in the <a href="/pkg/strconv/"><code>strconv</code></a> package
576now considers the <code>DEL</code> character, <code>U+007F</code>, to be
577non-printing.
578</li>
579
Rob Pikee9ad3bf2014-04-12 14:56:17 +1000580<li>
Mikio Hara17043682014-05-16 13:18:14 +0900581The <a href="/pkg/syscall/"><code>syscall</code></a> package now provides
582<a href="/pkg/syscall/#SendmsgN"><code>SendmsgN</code></a>
583as an alternate version of
584<a href="/pkg/syscall/#Sendmsg"><code>Sendmsg</code></a>
585that returns the number of bytes written.
586</li>
587
588<li>
Rob Pikee9ad3bf2014-04-12 14:56:17 +1000589On Windows, the <a href="/pkg/syscall/"><code>syscall</code></a> package now
590supports the cdecl calling convention through the addition of a new function
591<a href="/pkg/syscall/#NewCallbackCDecl"><code>NewCallbackCDecl</code></a>
592alongside the existing function
593<a href="/pkg/syscall/#NewCallback"><code>NewCallback</code></a>.
594</li>
Rob Pike969dc762014-04-09 07:12:20 +1000595
Rob Pike969dc762014-04-09 07:12:20 +1000596<li>
597The <a href="/pkg/testing/"><code>testing</code></a> package now
Rob Pikec5f14c52014-04-09 08:19:35 +1000598diagnoses tests that call <code>panic(nil)</code>, which are almost always erroneous.
Russ Cox21e75b32014-05-09 12:18:50 -0400599Also, tests now write profiles (if invoked with profiling flags) even on failure.
Rob Pike969dc762014-04-09 07:12:20 +1000600</li>
601
602<li>
603The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated
604support throughout the system has been upgraded from
605Unicode 6.2.0 to <a href="http://www.unicode.org/versions/Unicode6.3.0/">Unicode 6.3.0</a>.
606</li>
607
Rob Pike09e1da32014-03-26 13:56:16 +1100608</ul>