github.com/euank/go@v0.0.0-20160829210321-495514729181/doc/go1.7.html (about) 1 <!--{ 2 "Title": "Go 1.7 Release Notes", 3 "Path": "/doc/go1.7", 4 "Template": true 5 }--> 6 7 <!-- 8 for acme: 9 Edit .,s;^PKG:([a-z][A-Za-z0-9_/]+);<a href="/pkg/\1/"><code>\1</code></a>;g 10 Edit .,s;^([a-z][A-Za-z0-9_/]+)\.([A-Z][A-Za-z0-9_]+\.)?([A-Z][A-Za-z0-9_]+)([ .',)]|$);<a href="/pkg/\1/#\2\3"><code>\3</code></a>\4;g 11 Edit .,s;^FULL:([a-z][A-Za-z0-9_/]+)\.([A-Z][A-Za-z0-9_]+\.)?([A-Z][A-Za-z0-9_]+)([ .',)]|$);<a href="/pkg/\1/#\2\3"><code>\1.\2\3</code></a>\4;g 12 Edit .,s;^DPKG:([a-z][A-Za-z0-9_/]+);<dl id="\1"><a href="/pkg/\1/">\1</a></dl>;g 13 14 rsc last updated through 6729576 15 --> 16 17 <!-- 18 NOTE: In this document and others in this directory, the convention is to 19 set fixed-width phrases with non-fixed-width spaces, as in 20 <code>hello</code> <code>world</code>. 21 Do not send CLs removing the interior tags from such phrases. 22 --> 23 24 <style> 25 ul li { margin: 0.5em 0; } 26 </style> 27 28 <h2 id="introduction">Introduction to Go 1.7</h2> 29 30 <p> 31 The latest Go release, version 1.7, arrives six months after 1.6. 32 Most of its changes are in the implementation of the toolchain, runtime, and libraries. 33 There is one minor change to the language specification. 34 As always, the release maintains the Go 1 <a href="/doc/go1compat.html">promise of compatibility</a>. 35 We expect almost all Go programs to continue to compile and run as before. 36 </p> 37 38 <p> 39 The release <a href="#ports">adds a port to IBM LinuxOne</a>; 40 <a href="#compiler">updates the x86-64 compiler back end</a> to generate more efficient code; 41 includes the <a href="#context">context package</a>, promoted from the 42 <a href="https://golang.org/x/net/context">x/net subrepository</a> 43 and now used in the standard library; 44 and <a href="#testing">adds support in the testing package</a> for 45 creating hierarchies of tests and benchmarks. 46 The release also <a href="#cmd/go">finalizes the vendoring support</a> 47 started in Go 1.5, making it a standard feature. 48 </p> 49 50 <h2 id="language">Changes to the language</h2> 51 52 <p> 53 There is one tiny language change in this release. 54 The section on <a href="/ref/spec#Terminating_statements">terminating statements</a> 55 clarifies that to determine whether a statement list ends in a terminating statement, 56 the “final non-empty statement” is considered the end, 57 matching the existing behavior of the gc and gccgo compiler toolchains. 58 In earlier releases the definition referred only to the “final statement,” 59 leaving the effect of trailing empty statements at the least unclear. 60 The <a href="/pkg/go/types/"><code>go/types</code></a> 61 package has been updated to match the gc and gccgo compiler toolchains 62 in this respect. 63 This change has no effect on the correctness of existing programs. 64 </p> 65 66 <h2 id="ports">Ports</h2> 67 68 <p> 69 Go 1.7 adds support for macOS 10.12 Sierra. 70 This support was backported to Go 1.6.3. 71 Binaries built with versions of Go before 1.6.3 will not work 72 correctly on Sierra. 73 </p> 74 75 <p> 76 Go 1.7 adds an experimental port to <a href="https://en.wikipedia.org/wiki/Linux_on_z_Systems">Linux on z Systems</a> (<code>linux/s390x</code>) 77 and the beginning of a port to Plan 9 on ARM (<code>plan9/arm</code>). 78 </p> 79 80 <p> 81 The experimental ports to Linux on 64-bit MIPS (<code>linux/mips64</code> and <code>linux/mips64le</code>) 82 added in Go 1.6 now have full support for cgo and external linking. 83 </p> 84 85 <p> 86 The experimental port to Linux on little-endian 64-bit PowerPC (<code>linux/ppc64le</code>) 87 now requires the POWER8 architecture or later. 88 Big-endian 64-bit PowerPC (<code>linux/ppc64</code>) only requires the 89 POWER5 architecture. 90 </p> 91 92 <p> 93 The OpenBSD port now requires OpenBSD 5.6 or later, for access to the <a href="http://man.openbsd.org/getentropy.2"><i>getentropy</i>(2)</a> system call. 94 </p> 95 96 <h3 id="known_issues">Known Issues</h3> 97 98 <p> 99 There are some instabilities on FreeBSD that are known but not understood. 100 These can lead to program crashes in rare cases. 101 See <a href="https://golang.org/issue/16136">issue 16136</a>, 102 <a href="https://golang.org/issue/15658">issue 15658</a>, 103 and <a href="https://golang.org/issue/16396">issue 16396</a>. 104 Any help in solving these FreeBSD-specific issues would be appreciated. 105 </p> 106 107 <h2 id="tools">Tools</h2> 108 109 <h3 id="cmd_asm">Assembler</h3> 110 111 <p> 112 For 64-bit ARM systems, the vector register names have been 113 corrected to <code>V0</code> through <code>V31</code>; 114 previous releases incorrectly referred to them as <code>V32</code> through <code>V63</code>. 115 </p> 116 117 <p> 118 For 64-bit x86 systems, the following instructions have been added: 119 <code>PCMPESTRI</code>, 120 <code>RORXL</code>, 121 <code>RORXQ</code>, 122 <code>VINSERTI128</code>, 123 <code>VPADDD</code>, 124 <code>VPADDQ</code>, 125 <code>VPALIGNR</code>, 126 <code>VPBLENDD</code>, 127 <code>VPERM2F128</code>, 128 <code>VPERM2I128</code>, 129 <code>VPOR</code>, 130 <code>VPSHUFB</code>, 131 <code>VPSHUFD</code>, 132 <code>VPSLLD</code>, 133 <code>VPSLLDQ</code>, 134 <code>VPSLLQ</code>, 135 <code>VPSRLD</code>, 136 <code>VPSRLDQ</code>, 137 and 138 <code>VPSRLQ</code>. 139 </p> 140 141 <h3 id="compiler">Compiler Toolchain</h3> 142 143 <p> 144 This release includes a new code generation back end for 64-bit x86 systems, 145 following a <a href="https://golang.org/s/go17ssa">proposal from 2015</a> 146 that has been under development since then. 147 The new back end, based on 148 <a href="https://en.wikipedia.org/wiki/Static_single_assignment_form">SSA</a>, 149 generates more compact, more efficient code 150 and provides a better platform for optimizations 151 such as bounds check elimination. 152 The new back end reduces the CPU time required by 153 <a href="https://golang.org/test/bench/go1/">our benchmark programs</a> by 5-35%. 154 </p> 155 156 <p> 157 For this release, the new back end can be disabled by passing 158 <code>-ssa=0</code> to the compiler. 159 If you find that your program compiles or runs successfully 160 only with the new back end disabled, please 161 <a href="https://golang.org/issue/new">file a bug report</a>. 162 </p> 163 164 <p> 165 The format of exported metadata written by the compiler in package archives has changed: 166 the old textual format has been replaced by a more compact binary format. 167 This results in somewhat smaller package archives and fixes a few 168 long-standing corner case bugs. 169 </p> 170 171 <p> 172 For this release, the new export format can be disabled by passing 173 <code>-newexport=0</code> to the compiler. 174 If you find that your program compiles or runs successfully 175 only with the new export format disabled, please 176 <a href="https://golang.org/issue/new">file a bug report</a>. 177 </p> 178 179 <p> 180 The linker's <code>-X</code> option no longer supports the unusual two-argument form 181 <code>-X</code> <code>name</code> <code>value</code>, 182 as <a href="/doc/go1.6#compiler">announced</a> in the Go 1.6 release 183 and in warnings printed by the linker. 184 Use <code>-X</code> <code>name=value</code> instead. 185 </p> 186 187 <p> 188 The compiler and linker have been optimized and run significantly faster in this release than in Go 1.6, 189 although they are still slower than we would like and will continue to be optimized in future releases. 190 </p> 191 192 <p> 193 Due to changes across the compiler toolchain and standard library, 194 binaries built with this release should typically be smaller than binaries 195 built with Go 1.6, 196 sometimes by as much as 20-30%. 197 </p> 198 199 <p> 200 On x86-64 systems, Go programs now maintain stack frame pointers 201 as expected by profiling tools like Linux's perf and Intel's VTune, 202 making it easier to analyze and optimize Go programs using these tools. 203 The frame pointer maintenance has a small run-time overhead that varies 204 but averages around 2%. We hope to reduce this cost in future releases. 205 To build a toolchain that does not use frame pointers, set 206 <code>GOEXPERIMENT=noframepointer</code> when running 207 <code>make.bash</code>, <code>make.bat</code>, or <code>make.rc</code>. 208 </p> 209 210 <h3 id="cmd_cgo">Cgo</h3> 211 212 <p> 213 Packages using <a href="/cmd/cgo/">cgo</a> may now include 214 Fortran source files (in addition to C, C++, Objective C, and SWIG), 215 although the Go bindings must still use C language APIs. 216 </p> 217 218 <p> 219 Go bindings may now use a new helper function <code>C.CBytes</code>. 220 In contrast to <code>C.CString</code>, which takes a Go <code>string</code> 221 and returns a <code>*C.byte</code> (a C <code>char*</code>), 222 <code>C.CBytes</code> takes a Go <code>[]byte</code> 223 and returns an <code>unsafe.Pointer</code> (a C <code>void*</code>). 224 </p> 225 226 <p> 227 Packages and binaries built using <code>cgo</code> have in past releases 228 produced different output on each build, 229 due to the embedding of temporary directory names. 230 When using this release with 231 new enough versions of GCC or Clang 232 (those that support the <code>-fdebug-prefix-map</code> option), 233 those builds should finally be deterministic. 234 </p> 235 236 <h3 id="gccgo">Gccgo</h3> 237 238 <p> 239 Due to the alignment of Go's semiannual release schedule with GCC's annual release schedule, 240 GCC release 6 contains the Go 1.6.1 version of gccgo. 241 The next release, GCC 7, will likely have the Go 1.8 version of gccgo. 242 </p> 243 244 <h3 id="cmd_go">Go command</h3> 245 246 <p> 247 The <a href="/cmd/go/"><code>go</code></a> command's basic operation 248 is unchanged, but there are a number of changes worth noting. 249 </p> 250 251 <p> 252 This release removes support for the <code>GO15VENDOREXPERIMENT</code> environment variable, 253 as <a href="/doc/go1.6#go_command">announced</a> in the Go 1.6 release. 254 <a href="https://golang.org/s/go15vendor">Vendoring support</a> 255 is now a standard feature of the <code>go</code> command and toolchain. 256 </p> 257 258 <p> 259 The <code>Package</code> data structure made available to 260 “<code>go</code> <code>list</code>” now includes a 261 <code>StaleReason</code> field explaining why a particular package 262 is or is not considered stale (in need of rebuilding). 263 This field is available to the <code>-f</code> or <code>-json</code> 264 options and is useful for understanding why a target is being rebuilt. 265 </p> 266 267 <p> 268 The “<code>go</code> <code>get</code>” command now supports 269 import paths referring to <code>git.openstack.org</code>. 270 </p> 271 272 <p> 273 This release adds experimental, minimal support for building programs using 274 <a href="/pkg/go/build#hdr-Binary_Only_Packages">binary-only packages</a>, 275 packages distributed in binary form 276 without the corresponding source code. 277 This feature is needed in some commercial settings 278 but is not intended to be fully integrated into the rest of the toolchain. 279 For example, tools that assume access to complete source code 280 will not work with such packages, and there are no plans to support 281 such packages in the “<code>go</code> <code>get</code>” command. 282 </p> 283 284 <h3 id="cmd_doc">Go doc</h3> 285 286 <p> 287 The “<code>go</code> <code>doc</code>” command 288 now groups constructors with the type they construct, 289 following <a href="/cmd/godoc/"><code>godoc</code></a>. 290 </p> 291 292 <h3 id="cmd_vet">Go vet</h3> 293 294 <p> 295 The “<code>go</code> <code>vet</code>” command 296 has more accurate analysis in its <code>-copylock</code> and <code>-printf</code> checks, 297 and a new <code>-tests</code> check that checks the name and signature of likely test functions. 298 To avoid confusion with the new <code>-tests</code> check, the old, unadvertised 299 <code>-test</code> option has been removed; it was equivalent to <code>-all</code> <code>-shadow</code>. 300 </p> 301 302 <p id="vet_lostcancel"> 303 The <code>vet</code> command also has a new check, 304 <code>-lostcancel</code>, which detects failure to call the 305 cancelation function returned by the <code>WithCancel</code>, 306 <code>WithTimeout</code>, and <code>WithDeadline</code> functions in 307 Go 1.7's new <code>context</code> package (see <a 308 href='#context'>below</a>). 309 Failure to call the function prevents the new <code>Context</code> 310 from being reclaimed until its parent is cancelled. 311 (The background context is never cancelled.) 312 </p> 313 314 <h3 id="cmd_dist">Go tool dist</h3> 315 316 <p> 317 The new subcommand “<code>go</code> <code>tool</code> <code>dist</code> <code>list</code>” 318 prints all supported operating system/architecture pairs. 319 </p> 320 321 <h3 id="cmd_trace">Go tool trace</h3> 322 323 <p> 324 The “<code>go</code> <code>tool</code> <code>trace</code>” command, 325 <a href="/doc/go1.5#trace_command">introduced in Go 1.5</a>, 326 has been refined in various ways. 327 </p> 328 329 <p> 330 First, collecting traces is significantly more efficient than in past releases. 331 In this release, the typical execution-time overhead of collecting a trace is about 25%; 332 in past releases it was at least 400%. 333 Second, trace files now include file and line number information, 334 making them more self-contained and making the 335 original executable optional when running the trace tool. 336 Third, the trace tool now breaks up large traces to avoid limits 337 in the browser-based viewer. 338 </p> 339 340 <p> 341 Although the trace file format has changed in this release, 342 the Go 1.7 tools can still read traces from earlier releases. 343 </p> 344 345 <h2 id="performance">Performance</h2> 346 347 <p> 348 As always, the changes are so general and varied that precise statements 349 about performance are difficult to make. 350 Most programs should run a bit faster, 351 due to speedups in the garbage collector and 352 optimizations in the core library. 353 On x86-64 systems, many programs will run significantly faster, 354 due to improvements in generated code brought by the 355 new compiler back end. 356 As noted above, in our own benchmarks, 357 the code generation changes alone typically reduce program CPU time by 5-35%. 358 </p> 359 360 <p> 361 <!-- git log -''-grep '-[0-9][0-9]\.[0-9][0-9]%' go1.6.. --> 362 There have been significant optimizations bringing more than 10% improvements 363 to implementations in the 364 <a href="/pkg/crypto/sha1/"><code>crypto/sha1</code></a>, 365 <a href="/pkg/crypto/sha256/"><code>crypto/sha256</code></a>, 366 <a href="/pkg/encoding/binary/"><code>encoding/binary</code></a>, 367 <a href="/pkg/fmt/"><code>fmt</code></a>, 368 <a href="/pkg/hash/adler32/"><code>hash/adler32</code></a>, 369 <a href="/pkg/hash/crc32/"><code>hash/crc32</code></a>, 370 <a href="/pkg/hash/crc64/"><code>hash/crc64</code></a>, 371 <a href="/pkg/image/color/"><code>image/color</code></a>, 372 <a href="/pkg/math/big/"><code>math/big</code></a>, 373 <a href="/pkg/strconv/"><code>strconv</code></a>, 374 <a href="/pkg/strings/"><code>strings</code></a>, 375 <a href="/pkg/unicode/"><code>unicode</code></a>, 376 and 377 <a href="/pkg/unicode/utf16/"><code>unicode/utf16</code></a> 378 packages. 379 </p> 380 381 <p> 382 Garbage collection pauses should be significantly shorter than they 383 were in Go 1.6 for programs with large numbers of idle goroutines, 384 substantial stack size fluctuation, or large package-level variables. 385 </p> 386 387 <h2 id="library">Core library</h2> 388 389 <h3 id="context">Context</h3> 390 391 <p> 392 Go 1.7 moves the <code>golang.org/x/net/context</code> package 393 into the standard library as <a href="/pkg/context/"><code>context</code></a>. 394 This allows the use of contexts for cancelation, timeouts, and passing 395 request-scoped data in other standard library packages, 396 including 397 <a href="#net">net</a>, 398 <a href="#net/http">net/http</a>, 399 and 400 <a href="#os/exec">os/exec</a>, 401 as noted below. 402 </p> 403 404 <p> 405 For more information about contexts, see the 406 <a href="/pkg/context/">package documentation</a> 407 and the Go blog post 408 “<a href="https://blog.golang.org/context">Go Concurrent Patterns: Context</a>.” 409 </p> 410 411 <h3 id="httptrace">HTTP Tracing</h3> 412 413 <p> 414 Go 1.7 introduces <a href="/pkg/net/http/httptrace/"><code>net/http/httptrace</code></a>, 415 a package that provides mechanisms for tracing events within HTTP requests. 416 </p> 417 418 <h3 id="testing">Testing</h3> 419 420 <p> 421 The <code>testing</code> package now supports the definition 422 of tests with subtests and benchmarks with sub-benchmarks. 423 This support makes it easy to write table-driven benchmarks 424 and to create hierarchical tests. 425 It also provides a way to share common setup and tear-down code. 426 See the <a href="/pkg/testing/#hdr-Subtests_and_Sub_benchmarks">package documentation</a> for details. 427 </p> 428 429 <h3 id="runtime">Runtime</h3> 430 431 <p> 432 All panics started by the runtime now use panic values 433 that implement both the 434 builtin <a href="/ref/spec#Errors"><code>error</code></a>, 435 and 436 <a href="/pkg/runtime/#Error"><code>runtime.Error</code></a>, 437 as 438 <a href="/ref/spec#Run_time_panics">required by the language specification</a>. 439 </p> 440 441 <p> 442 During panics, if a signal's name is known, it will be printed in the stack trace. 443 Otherwise, the signal's number will be used, as it was before Go1.7. 444 </p> 445 446 <p> 447 The new function 448 <a href="/pkg/runtime/#KeepAlive"><code>KeepAlive</code></a> 449 provides an explicit mechanism for declaring 450 that an allocated object must be considered reachable 451 at a particular point in a program, 452 typically to delay the execution of an associated finalizer. 453 </p> 454 455 <p> 456 The new function 457 <a href="/pkg/runtime/#CallersFrames"><code>CallersFrames</code></a> 458 translates a PC slice obtained from 459 <a href="/pkg/runtime/#Callers"><code>Callers</code></a> 460 into a sequence of frames corresponding to the call stack. 461 This new API should be preferred instead of direct use of 462 <a href="/pkg/runtime/#FuncForPC"><code>FuncForPC</code></a>, 463 because the frame sequence can more accurately describe 464 call stacks with inlined function calls. 465 </p> 466 467 <p> 468 The new function 469 <a href="/pkg/runtime/#SetCgoTraceback"><code>SetCgoTraceback</code></a> 470 facilitates tighter integration between Go and C code executing 471 in the same process called using cgo. 472 </p> 473 474 <p> 475 On 32-bit systems, the runtime can now use memory allocated 476 by the operating system anywhere in the address space, 477 eliminating the 478 “memory allocated by OS not in usable range” failure 479 common in some environments. 480 </p> 481 482 <p> 483 The runtime can now return unused memory to the operating system on 484 all architectures. 485 In Go 1.6 and earlier, the runtime could not 486 release memory on ARM64, 64-bit PowerPC, or MIPS. 487 </p> 488 489 <p> 490 On Windows, Go programs in Go 1.5 and earlier forced 491 the global Windows timer resolution to 1ms at startup 492 by calling <code>timeBeginPeriod(1)</code>. 493 Changing the global timer resolution caused problems on some systems, 494 and testing suggested that the call was not needed for good scheduler performance, 495 so Go 1.6 removed the call. 496 Go 1.7 brings the call back: under some workloads the call 497 is still needed for good scheduler performance. 498 </p> 499 500 501 <h3 id="minor_library_changes">Minor changes to the library</h3> 502 503 <p> 504 As always, there are various minor changes and updates to the library, 505 made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a> 506 in mind. 507 </p> 508 509 <dl id="bufio"><dt><a href="/pkg/bufio/">bufio</a></dt> 510 511 <dd> 512 <p> 513 In previous releases of Go, if 514 <a href="/pkg/bufio/#Reader"><code>Reader</code></a>'s 515 <a href="/pkg/bufio/#Reader.Peek"><code>Peek</code></a> method 516 were asked for more bytes than fit in the underlying buffer, 517 it would return an empty slice and the error <code>ErrBufferFull</code>. 518 Now it returns the entire underlying buffer, still accompanied by the error <code>ErrBufferFull</code>. 519 </p> 520 </dd> 521 </dl> 522 523 <dl id="bytes"><dt><a href="/pkg/bytes/">bytes</a></dt> 524 525 <dd> 526 <p> 527 The new functions 528 <a href="/pkg/bytes/#ContainsAny"><code>ContainsAny</code></a> and 529 <a href="/pkg/bytes/#ContainsRune"><code>ContainsRune</code></a> 530 have been added for symmetry with 531 the <a href="/pkg/strings/"><code>strings</code></a> package. 532 </p> 533 534 <p> 535 In previous releases of Go, if 536 <a href="/pkg/bytes/#Reader"><code>Reader</code></a>'s 537 <a href="/pkg/bytes/#Reader.Read"><code>Read</code></a> method 538 were asked for zero bytes with no data remaining, it would 539 return a count of 0 and no error. 540 Now it returns a count of 0 and the error 541 <a href="/pkg/io/#EOF"><code>io.EOF</code></a>. 542 </p> 543 544 <p> 545 The 546 <a href="/pkg/bytes/#Reader"><code>Reader</code></a> type has a new method 547 <a href="/pkg/bytes/#Reader.Reset"><code>Reset</code></a> to allow reuse of a <code>Reader</code>. 548 </p> 549 </dd> 550 </dl> 551 552 <dl id="compress_flate"><dt><a href="/pkg/compress/flate/">compress/flate</a></dt> 553 554 <dd> 555 <p> 556 There are many performance optimizations throughout the package. 557 Decompression speed is improved by about 10%, 558 while compression for <code>DefaultCompression</code> is twice as fast. 559 </p> 560 561 <p> 562 In addition to those general improvements, 563 the 564 <code>BestSpeed</code> 565 compressor has been replaced entirely and uses an 566 algorithm similar to <a href="https://github.com/google/snappy">Snappy</a>, 567 resulting in about a 2.5X speed increase, 568 although the output can be 5-10% larger than with the previous algorithm. 569 </p> 570 571 <p> 572 There is also a new compression level 573 <code>HuffmanOnly</code> 574 that applies Huffman but not Lempel-Ziv encoding. 575 <a href="https://blog.klauspost.com/constant-time-gzipzip-compression/">Forgoing Lempel-Ziv encoding</a> means that 576 <code>HuffmanOnly</code> runs about 3X faster than the new <code>BestSpeed</code> 577 but at the cost of producing compressed outputs that are 20-40% larger than those 578 generated by the new <code>BestSpeed</code>. 579 </p> 580 581 <p> 582 It is important to note that both 583 <code>BestSpeed</code> and <code>HuffmanOnly</code> produce a compressed output that is 584 <a href="https://tools.ietf.org/html/rfc1951">RFC 1951</a> compliant. 585 In other words, any valid DEFLATE decompressor will continue to be able to decompress these outputs. 586 </p> 587 588 <p> 589 Lastly, there is a minor change to the decompressor's implementation of 590 <a href="/pkg/io/#Reader"><code>io.Reader</code></a>. In previous versions, 591 the decompressor deferred reporting 592 <a href="/pkg/io/#EOF"><code>io.EOF</code></a> until exactly no more bytes could be read. 593 Now, it reports 594 <a href="/pkg/io/#EOF"><code>io.EOF</code></a> more eagerly when reading the last set of bytes. 595 </p> 596 </dd> 597 </dl> 598 599 <dl id="crypto_tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt> 600 601 <dd> 602 <p> 603 The TLS implementation sends the first few data packets on each connection 604 using small record sizes, gradually increasing to the TLS maximum record size. 605 This heuristic reduces the amount of data that must be received before 606 the first packet can be decrypted, improving communication latency over 607 low-bandwidth networks. 608 Setting 609 <a href="/pkg/crypto/tls/#Config"><code>Config</code></a>'s 610 <code>DynamicRecordSizingDisabled</code> field to true 611 forces the behavior of Go 1.6 and earlier, where packets are 612 as large as possible from the start of the connection. 613 </p> 614 615 <p> 616 The TLS client now has optional, limited support for server-initiated renegotiation, 617 enabled by setting the 618 <a href="/pkg/crypto/tls/#Config"><code>Config</code></a>'s 619 <code>Renegotiation</code> field. 620 This is needed for connecting to many Microsoft Azure servers. 621 </p> 622 623 <p> 624 The errors returned by the package now consistently begin with a 625 <code>tls:</code> prefix. 626 In past releases, some errors used a <code>crypto/tls:</code> prefix, 627 some used a <code>tls:</code> prefix, and some had no prefix at all. 628 </p> 629 630 <p> 631 When generating self-signed certificates, the package no longer sets the 632 “Authority Key Identifier” field by default. 633 </p> 634 </dd> 635 </dl> 636 637 <dl id="crypto_x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt> 638 639 <dd> 640 <p> 641 The new function 642 <a href="/pkg/crypto/x509/#SystemCertPool"><code>SystemCertPool</code></a> 643 provides access to the entire system certificate pool if available. 644 There is also a new associated error type 645 <a href="/pkg/crypto/x509/#SystemRootsError"><code>SystemRootsError</code></a>. 646 </p> 647 </dd> 648 </dl> 649 650 <dl id="debug_dwarf"><dt><a href="/pkg/debug/dwarf/">debug/dwarf</a></dt> 651 652 <dd> 653 <p> 654 The 655 <a href="/pkg/debug/dwarf/#Reader"><code>Reader</code></a> type's new 656 <a href="/pkg/debug/dwarf/#Reader.SeekPC"><code>SeekPC</code></a> method and the 657 <a href="/pkg/debug/dwarf/#Data"><code>Data</code></a> type's new 658 <a href="/pkg/debug/dwarf/#Ranges"><code>Ranges</code></a> method 659 help to find the compilation unit to pass to a 660 <a href="/pkg/debug/dwarf/#LineReader"><code>LineReader</code></a> 661 and to identify the specific function for a given program counter. 662 </p> 663 </dd> 664 </dl> 665 666 <dl id="debug_elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt> 667 668 <dd> 669 <p> 670 The new 671 <a href="/pkg/debug/elf/#R_390"><code>R_390</code></a> relocation type 672 and its many predefined constants 673 support the S390 port. 674 </p> 675 </dd> 676 </dl> 677 678 <dl id="encoding_asn1"><dt><a href="/pkg/encoding/asn1/">encoding/asn1</a></dt> 679 680 <dd> 681 <p> 682 The ASN.1 decoder now rejects non-minimal integer encodings. 683 This may cause the package to reject some invalid but formerly accepted ASN.1 data. 684 </p> 685 </dd> 686 </dl> 687 688 <dl id="encoding_json"><dt><a href="/pkg/encoding/json/">encoding/json</a></dt> 689 690 <dd> 691 <p> 692 The 693 <a href="/pkg/encoding/json/#Encoder"><code>Encoder</code></a>'s new 694 <a href="/pkg/encoding/json/#Encoder.SetIndent"><code>SetIndent</code></a> method 695 sets the indentation parameters for JSON encoding, 696 like in the top-level 697 <a href="/pkg/encoding/json/#Indent"><code>Indent</code></a> function. 698 </p> 699 700 <p> 701 The 702 <a href="/pkg/encoding/json/#Encoder"><code>Encoder</code></a>'s new 703 <a href="/pkg/encoding/json/#Encoder.SetEscapeHTML"><code>SetEscapeHTML</code></a> method 704 controls whether the 705 <code>&</code>, <code><</code>, and <code>></code> 706 characters in quoted strings should be escaped as 707 <code>\u0026</code>, <code>\u003c</code>, and <code>\u003e</code>, 708 respectively. 709 As in previous releases, the encoder defaults to applying this escaping, 710 to avoid certain problems that can arise when embedding JSON in HTML. 711 </p> 712 713 <p> 714 In earlier versions of Go, this package only supported encoding and decoding 715 maps using keys with string types. 716 Go 1.7 adds support for maps using keys with integer types: 717 the encoding uses a quoted decimal representation as the JSON key. 718 Go 1.7 also adds support for encoding maps using non-string keys that implement 719 the <code>MarshalText</code> 720 (see 721 <a href="/pkg/encoding/#TextMarshaler"><code>encoding.TextMarshaler</code></a>) 722 method, 723 as well as support for decoding maps using non-string keys that implement 724 the <code>UnmarshalText</code> 725 (see 726 <a href="/pkg/encoding/#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>) 727 method. 728 These methods are ignored for keys with string types in order to preserve 729 the encoding and decoding used in earlier versions of Go. 730 </p> 731 732 <p> 733 When encoding a slice of typed bytes, 734 <a href="/pkg/encoding/json/#Marshal"><code>Marshal</code></a> 735 now generates an array of elements encoded using 736 that byte type's 737 <code>MarshalJSON</code> 738 or 739 <code>MarshalText</code> 740 method if present, 741 only falling back to the default base64-encoded string data if neither method is available. 742 Earlier versions of Go accept both the original base64-encoded string encoding 743 and the array encoding (assuming the byte type also implements 744 <code>UnmarshalJSON</code> 745 or 746 <code>UnmarshalText</code> 747 as appropriate), 748 so this change should be semantically backwards compatible with earlier versions of Go, 749 even though it does change the chosen encoding. 750 </p> 751 </dd> 752 </dl> 753 754 <dl id="go_build"><dt><a href="/pkg/go/build/">go/build</a></dt> 755 756 <dd> 757 <p> 758 To implement the go command's new support for binary-only packages 759 and for Fortran code in cgo-based packages, 760 the 761 <a href="/pkg/go/build/#Package"><code>Package</code></a> type 762 adds new fields <code>BinaryOnly</code>, <code>CgoFFLAGS</code>, and <code>FFiles</code>. 763 </p> 764 </dd> 765 </dl> 766 767 <dl id="go_doc"><dt><a href="/pkg/go/doc/">go/doc</a></dt> 768 769 <dd> 770 <p> 771 To support the corresponding change in <code>go</code> <code>test</code> described above, 772 <a href="/pkg/go/doc/#Example"><code>Example</code></a> struct adds a Unordered field 773 indicating whether the example may generate its output lines in any order. 774 </p> 775 </dd> 776 </dl> 777 778 <dl id="io"><dt><a href="/pkg/io/">io</a></dt> 779 780 <dd> 781 <p> 782 The package adds new constants 783 <code>SeekStart</code>, <code>SeekCurrent</code>, and <code>SeekEnd</code>, 784 for use with 785 <a href="/pkg/io/#Seeker"><code>Seeker</code></a> 786 implementations. 787 These constants are preferred over <code>os.SEEK_SET</code>, <code>os.SEEK_CUR</code>, and <code>os.SEEK_END</code>, 788 but the latter will be preserved for compatibility. 789 </p> 790 </dd> 791 </dl> 792 793 <dl id="math_big"><dt><a href="/pkg/math/big/">math/big</a></dt> 794 795 <dd> 796 <p> 797 The 798 <a href="/pkg/math/big/#Float"><code>Float</code></a> type adds 799 <a href="/pkg/math/big/#Float.GobEncode"><code>GobEncode</code></a> and 800 <a href="/pkg/math/big/#Float.GobDecode"><code>GobDecode</code></a> methods, 801 so that values of type <code>Float</code> can now be encoded and decoded using the 802 <a href="/pkg/encoding/gob/"><code>encoding/gob</code></a> 803 package. 804 </p> 805 </dd> 806 </dl> 807 808 <dl id="math_rand"><dt><a href="/pkg/math/rand/">math/rand</a></dt> 809 810 <dd> 811 <p> 812 The 813 <a href="/pkg/math/rand/#Read"><code>Read</code></a> function and 814 <a href="/pkg/math/rand/#Rand"><code>Rand</code></a>'s 815 <a href="/pkg/math/rand/#Rand.Read"><code>Read</code></a> method 816 now produce a pseudo-random stream of bytes that is consistent and not 817 dependent on the size of the input buffer. 818 </p> 819 820 <p> 821 The documentation clarifies that 822 Rand's <a href="/pkg/math/rand/#Rand.Seed"><code>Seed</code></a> 823 and <a href="/pkg/math/rand/#Rand.Read"><code>Read</code></a> methods 824 are not safe to call concurrently, though the global 825 functions <a href="/pkg/math/rand/#Seed"><code>Seed</code></a> 826 and <a href="/pkg/math/rand/#Read"><code>Read</code></a> are (and have 827 always been) safe. 828 </p> 829 </dd> 830 </dl> 831 832 <dl id="mime_multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt> 833 834 <dd> 835 <p> 836 The 837 <a href="/pkg/mime/multipart/#Writer"><code>Writer</code></a> 838 implementation now emits each multipart section's header sorted by key. 839 Previously, iteration over a map caused the section header to use a 840 non-deterministic order. 841 </p> 842 </dd> 843 </dl> 844 845 <dl id="net"><dt><a href="/pkg/net/">net</a></dt> 846 847 <dd> 848 <p> 849 As part of the introduction of <a href="#context">context</a>, the 850 <a href="/pkg/net/#Dialer"><code>Dialer</code></a> type has a new method 851 <a href="/pkg/net/#Dialer.DialContext"><code>DialContext</code></a>, like 852 <a href="/pkg/net/#Dialer.Dial"><code>Dial</code></a> but adding the 853 <a href="/pkg/context/#Context"><code>context.Context</code></a> 854 for the dial operation. 855 The context is intended to obsolete the <code>Dialer</code>'s 856 <code>Cancel</code> and <code>Deadline</code> fields, 857 but the implementation continues to respect them, 858 for backwards compatibility. 859 </p> 860 861 <p> 862 The 863 <a href="/pkg/net/#IP"><code>IP</code></a> type's 864 <a href="/pkg/net/#IP.String"><code>String</code></a> method has changed its result for invalid <code>IP</code> addresses. 865 In past releases, if an <code>IP</code> byte slice had length other than 0, 4, or 16, <code>String</code> 866 returned <code>"?"</code>. 867 Go 1.7 adds the hexadecimal encoding of the bytes, as in <code>"?12ab"</code>. 868 </p> 869 870 <p> 871 The pure Go <a href="/pkg/net/#hdr-Name_Resolution">name resolution</a> 872 implementation now respects <code>nsswitch.conf</code>'s 873 stated preference for the priority of DNS lookups compared to 874 local file (that is, <code>/etc/hosts</code>) lookups. 875 </p> 876 </dd> 877 </dl> 878 879 <dl id="net_http"><dt><a href="/pkg/net/http/">net/http</a></dt> 880 881 <dd> 882 <p> 883 <a href="/pkg/net/http/#ResponseWriter"><code>ResponseWriter</code></a>'s 884 documentation now makes clear that beginning to write the response 885 may prevent future reads on the request body. 886 For maximal compatibility, implementations are encouraged to 887 read the request body completely before writing any part of the response. 888 </p> 889 890 <p> 891 As part of the introduction of <a href="#context">context</a>, the 892 <a href="/pkg/net/http/#Request"><code>Request</code></a> has a new methods 893 <a href="/pkg/net/http/#Request.Context"><code>Context</code></a>, to retrieve the associated context, and 894 <a href="/pkg/net/http/#Request.WithContext"><code>WithContext</code></a>, to construct a copy of <code>Request</code> 895 with a modified context. 896 </p> 897 898 <p> 899 In the 900 <a href="/pkg/net/http/#Server"><code>Server</code></a> implementation, 901 <a href="/pkg/net/http/#Server.Serve"><code>Serve</code></a> records in the request context 902 both the underlying <code>*Server</code> using the key <code>ServerContextKey</code> 903 and the local address on which the request was received (a 904 <a href="/pkg/net/#Addr"><code>Addr</code></a>) using the key <code>LocalAddrContextKey</code>. 905 For example, the address on which a request received is 906 <code>req.Context().Value(http.LocalAddrContextKey).(net.Addr)</code>. 907 </p> 908 909 <p> 910 The server's <a href="/pkg/net/http/#Server.Serve"><code>Serve</code></a> method 911 now only enables HTTP/2 support if the <code>Server.TLSConfig</code> field is <code>nil</code> 912 or includes <code>"h2"</code> in its <code>TLSConfig.NextProtos</code>. 913 </p> 914 915 <p> 916 The server implementation now 917 pads response codes less than 100 to three digits 918 as required by the protocol, 919 so that <code>w.WriteHeader(5)</code> uses the HTTP response 920 status <code>005</code>, not just <code>5</code>. 921 </p> 922 923 <p> 924 The server implementation now correctly sends only one "Transfer-Encoding" header when "chunked" 925 is set explicitly, following <a href="https://tools.ietf.org/html/rfc7230#section-3.3.1">RFC 7230</a>. 926 </p> 927 928 <p> 929 The server implementation is now stricter about rejecting requests with invalid HTTP versions. 930 Invalid requests claiming to be HTTP/0.x are now rejected (HTTP/0.9 was never fully supported), 931 and plaintext HTTP/2 requests other than the "PRI * HTTP/2.0" upgrade request are now rejected as well. 932 The server continues to handle encrypted HTTP/2 requests. 933 </p> 934 935 <p> 936 In the server, a 200 status code is sent back by the timeout handler on an empty 937 response body, instead of sending back 0 as the status code. 938 </p> 939 940 <p> 941 In the client, the 942 <a href="/pkg/net/http/#Transport"><code>Transport</code></a> implementation passes the request context 943 to any dial operation connecting to the remote server. 944 If a custom dialer is needed, the new <code>Transport</code> field 945 <code>DialContext</code> is preferred over the existing <code>Dial</code> field, 946 to allow the transport to supply a context. 947 </p> 948 949 <p> 950 The 951 <a href="/pkg/net/http/#Transport"><code>Transport</code></a> also adds fields 952 <code>IdleConnTimeout</code>, 953 <code>MaxIdleConns</code>, 954 and 955 <code>MaxResponseHeaderBytes</code> 956 to help control client resources consumed 957 by idle or chatty servers. 958 </p> 959 960 <p> 961 A 962 <a href="/pkg/net/http/#Client"><code>Client</code></a>'s configured <code>CheckRedirect</code> function can now 963 return <code>ErrUseLastResponse</code> to indicate that the 964 most recent redirect response should be returned as the 965 result of the HTTP request. 966 That response is now available to the <code>CheckRedirect</code> function 967 as <code>req.Response</code>. 968 </p> 969 970 <p> 971 Since Go 1, the default behavior of the HTTP client is 972 to request server-side compression 973 using the <code>Accept-Encoding</code> request header 974 and then to decompress the response body transparently, 975 and this behavior is adjustable using the 976 <a href="/pkg/net/http/#Transport"><code>Transport</code></a>'s <code>DisableCompression</code> field. 977 In Go 1.7, to aid the implementation of HTTP proxies, the 978 <a href="/pkg/net/http/#Response"><code>Response</code></a>'s new 979 <code>Uncompressed</code> field reports whether 980 this transparent decompression took place. 981 </p> 982 983 <p> 984 <a href="/pkg/net/http/#DetectContentType"><code>DetectContentType</code></a> 985 adds support for a few new audio and video content types. 986 </p> 987 </dd> 988 </dl> 989 990 <dl id="net_http_cgi"><dt><a href="/pkg/net/http/cgi/">net/http/cgi</a></dt> 991 992 <dd> 993 <p> 994 The 995 <a href="/pkg/net/http/cgi/#Handler"><code>Handler</code></a> 996 adds a new field 997 <code>Stderr</code> 998 that allows redirection of the child process's 999 standard error away from the host process's 1000 standard error. 1001 </p> 1002 </dd> 1003 </dl> 1004 1005 <dl id="net_http_httptest"><dt><a href="/pkg/net/http/httptest/">net/http/httptest</a></dt> 1006 1007 <dd> 1008 <p> 1009 The new function 1010 <a href="/pkg/net/http/httptest/#NewRequest"><code>NewRequest</code></a> 1011 prepares a new 1012 <a href="/pkg/net/http/#Request"><code>http.Request</code></a> 1013 suitable for passing to an 1014 <a href="/pkg/net/http/#Handler"><code>http.Handler</code></a> during a test. 1015 </p> 1016 1017 <p> 1018 The 1019 <a href="/pkg/net/http/httptest/#ResponseRecorder"><code>ResponseRecorder</code></a>'s new 1020 <a href="/pkg/net/http/httptest/#ResponseRecorder.Result"><code>Result</code></a> method 1021 returns the recorded 1022 <a href="/pkg/net/http/#Response"><code>http.Response</code></a>. 1023 Tests that need to check the response's headers or trailers 1024 should call <code>Result</code> and inspect the response fields 1025 instead of accessing 1026 <code>ResponseRecorder</code>'s <code>HeaderMap</code> directly. 1027 </p> 1028 </dd> 1029 </dl> 1030 1031 <dl id="net_http_httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt> 1032 1033 <dd> 1034 <p> 1035 The 1036 <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a> implementation now responds with “502 Bad Gateway” 1037 when it cannot reach a back end; in earlier releases it responded with “500 Internal Server Error.” 1038 </p> 1039 1040 <p> 1041 Both 1042 <a href="/pkg/net/http/httputil/#ClientConn"><code>ClientConn</code></a> and 1043 <a href="/pkg/net/http/httputil/#ServerConn"><code>ServerConn</code></a> have been documented as deprecated. 1044 They are low-level, old, and unused by Go's current HTTP stack 1045 and will no longer be updated. 1046 Programs should use 1047 <a href="/pkg/net/http/#Client"><code>http.Client</code></a>, 1048 <a href="/pkg/net/http/#Transport"><code>http.Transport</code></a>, 1049 and 1050 <a href="/pkg/net/http/#Server"><code>http.Server</code></a> 1051 instead. 1052 </p> 1053 </dd> 1054 </dl> 1055 1056 <dl id="net_http_pprof"><dt><a href="/pkg/net/http/pprof/">net/http/pprof</a></dt> 1057 1058 <dd> 1059 <p> 1060 The runtime trace HTTP handler, installed to handle the path <code>/debug/pprof/trace</code>, 1061 now accepts a fractional number in its <code>seconds</code> query parameter, 1062 allowing collection of traces for intervals smaller than one second. 1063 This is especially useful on busy servers. 1064 </p> 1065 </dd> 1066 </dl> 1067 1068 <dl><dt><a href="/pkg/net/mail/">net/mail</a></dt> 1069 1070 <dd> 1071 <p> 1072 The address parser now allows unescaped UTF-8 text in addresses 1073 following <a href="https://tools.ietf.org/html/rfc6532">RFC 6532</a>, 1074 but it does not apply any normalization to the result. 1075 For compatibility with older mail parsers, 1076 the address encoder, namely 1077 <a href="/pkg/net/mail/#Address"><code>Address</code></a>'s 1078 <a href="/pkg/net/mail/#Address.String"><code>String</code></a> method, 1079 continues to escape all UTF-8 text following <a href="https://tools.ietf.org/html/rfc5322">RFC 5322</a>. 1080 </p> 1081 1082 <p> 1083 The <a href="/pkg/net/mail/#ParseAddress"><code>ParseAddress</code></a> 1084 function and 1085 the <a href="/pkg/net/mail/#AddressParser.Parse"><code>AddressParser.Parse</code></a> 1086 method are stricter. 1087 They used to ignore any characters following an e-mail address, but 1088 will now return an error for anything other than whitespace. 1089 </p> 1090 </dd> 1091 </dl> 1092 1093 <dl id="net_url"><dt><a href="/pkg/net/url/">net/url</a></dt> 1094 1095 <dd> 1096 <p> 1097 The 1098 <a href="/pkg/net/url/#URL"><code>URL</code></a>'s 1099 new <code>ForceQuery</code> field 1100 records whether the URL must have a query string, 1101 in order to distinguish URLs without query strings (like <code>/search</code>) 1102 from URLs with empty query strings (like <code>/search?</code>). 1103 </p> 1104 </dd> 1105 </dl> 1106 1107 <dl id="os"><dt><a href="/pkg/os/">os</a></dt> 1108 1109 <dd> 1110 <p> 1111 <a href="/pkg/os/#IsExist"><code>IsExist</code></a> now returns true for <code>syscall.ENOTEMPTY</code>, 1112 on systems where that error exists. 1113 </p> 1114 1115 <p> 1116 On Windows, 1117 <a href="/pkg/os/#Remove"><code>Remove</code></a> now removes read-only files when possible, 1118 making the implementation behave as on 1119 non-Windows systems. 1120 </p> 1121 </dd> 1122 </dl> 1123 1124 <dl id="os_exec"><dt><a href="/pkg/os/exec/">os/exec</a></dt> 1125 1126 <dd> 1127 <p> 1128 As part of the introduction of <a href="#context">context</a>, 1129 the new constructor 1130 <a href="/pkg/os/exec/#CommandContext"><code>CommandContext</code></a> 1131 is like 1132 <a href="/pkg/os/exec/#Command"><code>Command</code></a> but includes a context that can be used to cancel the command execution. 1133 </p> 1134 </dd> 1135 </dl> 1136 1137 <dl id="os_user"><dt><a href="/pkg/os/user/">os/user</a></dt> 1138 1139 <dd> 1140 <p> 1141 The 1142 <a href="/pkg/os/user/#Current"><code>Current</code></a> 1143 function is now implemented even when cgo is not available. 1144 </p> 1145 1146 <p> 1147 The new 1148 <a href="/pkg/os/user/#Group"><code>Group</code></a> type, 1149 along with the lookup functions 1150 <a href="/pkg/os/user/#LookupGroup"><code>LookupGroup</code></a> and 1151 <a href="/pkg/os/user/#LookupGroupId"><code>LookupGroupId</code></a> 1152 and the new field <code>GroupIds</code> in the <code>User</code> struct, 1153 provides access to system-specific user group information. 1154 </p> 1155 </dd> 1156 </dl> 1157 1158 <dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt> 1159 1160 <dd> 1161 <p> 1162 Although 1163 <a href="/pkg/reflect/#Value"><code>Value</code></a>'s 1164 <a href="/pkg/reflect/#Value.Field"><code>Field</code></a> method has always been documented to panic 1165 if the given field number <code>i</code> is out of range, it has instead 1166 silently returned a zero 1167 <a href="/pkg/reflect/#Value"><code>Value</code></a>. 1168 Go 1.7 changes the method to behave as documented. 1169 </p> 1170 1171 <p> 1172 The new 1173 <a href="/pkg/reflect/#StructOf"><code>StructOf</code></a> 1174 function constructs a struct type at run time. 1175 It completes the set of type constructors, joining 1176 <a href="/pkg/reflect/#ArrayOf"><code>ArrayOf</code></a>, 1177 <a href="/pkg/reflect/#ChanOf"><code>ChanOf</code></a>, 1178 <a href="/pkg/reflect/#FuncOf"><code>FuncOf</code></a>, 1179 <a href="/pkg/reflect/#MapOf"><code>MapOf</code></a>, 1180 <a href="/pkg/reflect/#PtrTo"><code>PtrTo</code></a>, 1181 and 1182 <a href="/pkg/reflect/#SliceOf"><code>SliceOf</code></a>. 1183 </p> 1184 1185 <p> 1186 <a href="/pkg/reflect/#StructTag"><code>StructTag</code></a>'s 1187 new method 1188 <a href="/pkg/reflect/#StructTag.Lookup"><code>Lookup</code></a> 1189 is like 1190 <a href="/pkg/reflect/#StructTag.Get"><code>Get</code></a> 1191 but distinguishes the tag not containing the given key 1192 from the tag associating an empty string with the given key. 1193 </p> 1194 1195 <p> 1196 The 1197 <a href="/pkg/reflect/#Type.Method"><code>Method</code></a> and 1198 <a href="/pkg/reflect/#Type.NumMethod"><code>NumMethod</code></a> 1199 methods of 1200 <a href="/pkg/reflect/#Type"><code>Type</code></a> and 1201 <a href="/pkg/reflect/#Value"><code>Value</code></a> 1202 no longer return or count unexported methods. 1203 </p> 1204 </dd> 1205 </dl> 1206 1207 <dl id="strings"><dt><a href="/pkg/strings/">strings</a></dt> 1208 1209 <dd> 1210 <p> 1211 In previous releases of Go, if 1212 <a href="/pkg/strings/#Reader"><code>Reader</code></a>'s 1213 <a href="/pkg/strings/#Reader.Read"><code>Read</code></a> method 1214 were asked for zero bytes with no data remaining, it would 1215 return a count of 0 and no error. 1216 Now it returns a count of 0 and the error 1217 <a href="/pkg/io/#EOF"><code>io.EOF</code></a>. 1218 </p> 1219 1220 <p> 1221 The 1222 <a href="/pkg/strings/#Reader"><code>Reader</code></a> type has a new method 1223 <a href="/pkg/strings/#Reader.Reset"><code>Reset</code></a> to allow reuse of a <code>Reader</code>. 1224 </p> 1225 </dd> 1226 </dl> 1227 1228 <dl id="time"><dt><a href="/pkg/time/">time</a></dt> 1229 1230 <dd> 1231 <p> 1232 <a href="/pkg/time/#Duration"><code>Duration</code></a>'s 1233 time.Duration.String method now reports the zero duration as <code>"0s"</code>, not <code>"0"</code>. 1234 <a href="/pkg/time/#ParseDuration"><code>ParseDuration</code></a> continues to accept both forms. 1235 </p> 1236 1237 <p> 1238 The method call <code>time.Local.String()</code> now returns <code>"Local"</code> on all systems; 1239 in earlier releases, it returned an empty string on Windows. 1240 </p> 1241 1242 <p> 1243 The time zone database in 1244 <code>$GOROOT/lib/time</code> has been updated 1245 to IANA release 2016d. 1246 This fallback database is only used when the system time zone database 1247 cannot be found, for example on Windows. 1248 The Windows time zone abbreviation list has also been updated. 1249 </p> 1250 </dd> 1251 </dl> 1252 1253 <dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt> 1254 1255 <dd> 1256 <p> 1257 On Linux, the 1258 <a href="/pkg/syscall/#SysProcAttr"><code>SysProcAttr</code></a> struct 1259 (as used in 1260 <a href="/pkg/os/exec/#Cmd"><code>os/exec.Cmd</code></a>'s <code>SysProcAttr</code> field) 1261 has a new <code>Unshareflags</code> field. 1262 If the field is nonzero, the child process created by 1263 <a href="/pkg/syscall/#ForkExec"><code>ForkExec</code></a> 1264 (as used in <code>exec.Cmd</code>'s <code>Run</code> method) 1265 will call the 1266 <a href="http://man7.org/linux/man-pages/man2/unshare.2.html"><i>unshare</i>(2)</a> 1267 system call before executing the new program. 1268 </p> 1269 </dd> 1270 </dl> 1271 1272 1273 <dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt> 1274 1275 <dd> 1276 <p> 1277 The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated 1278 support throughout the system has been upgraded from version 8.0 to 1279 <a href="http://www.unicode.org/versions/Unicode9.0.0/">Unicode 9.0</a>. 1280 </p> 1281 </dd> 1282 </dl>