github.com/brownsys/tracing-framework-go@v0.0.0-20161210174012-0542a62412fe/go/darwin_amd64/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 As noted above, 557 there are significant performance optimizations throughout the package. 558 Decompression speed is improved by about 10%, 559 while compression speed for <code>DefaultCompression</code> is roughly doubled. 560 </p> 561 562 <p> 563 In addition to those general improvements, 564 the 565 <code>BestSpeed</code> 566 compressor has been replaced entirely and uses an 567 algorithm similar to <a href="https://github.com/google/snappy">Snappy</a>, 568 resulting in about a 2.5X speed increase, 569 although the output can be 5-10% larger than with the previous algorithm. 570 </p> 571 572 <p> 573 There is also a new compression level 574 <code>HuffmanOnly</code> 575 that applies Huffman but not Lempel-Ziv encoding. 576 <a href="https://blog.klauspost.com/constant-time-gzipzip-compression/">Forgoing Lempel-Ziv encoding</a> means that 577 <code>HuffmanOnly</code> runs about 3X faster than the new <code>BestSpeed</code> 578 but at the cost of producing compressed outputs that are 20-40% larger than those 579 generated by the new <code>BestSpeed</code>. 580 </p> 581 582 <p> 583 It is important to note that both 584 <code>BestSpeed</code> and <code>HuffmanOnly</code> produce a compressed output that is 585 <a href="https://tools.ietf.org/html/rfc1951">RFC 1951</a> compliant. 586 In other words, any valid DEFLATE decompressor will continue to be able to decompress these outputs. 587 </p> 588 589 <p> 590 Lastly, there is a minor change to the decompressor's implementation of 591 <a href="/pkg/io/#Reader"><code>io.Reader</code></a>. In previous versions, 592 the decompressor deferred reporting 593 <a href="/pkg/io/#EOF"><code>io.EOF</code></a> until exactly no more bytes could be read. 594 Now, it reports 595 <a href="/pkg/io/#EOF"><code>io.EOF</code></a> more eagerly when reading the last set of bytes. 596 </p> 597 </dd> 598 </dl> 599 600 <dl id="crypto_tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt> 601 602 <dd> 603 <p> 604 The TLS implementation sends the first few data packets on each connection 605 using small record sizes, gradually increasing to the TLS maximum record size. 606 This heuristic reduces the amount of data that must be received before 607 the first packet can be decrypted, improving communication latency over 608 low-bandwidth networks. 609 Setting 610 <a href="/pkg/crypto/tls/#Config"><code>Config</code></a>'s 611 <code>DynamicRecordSizingDisabled</code> field to true 612 forces the behavior of Go 1.6 and earlier, where packets are 613 as large as possible from the start of the connection. 614 </p> 615 616 <p> 617 The TLS client now has optional, limited support for server-initiated renegotiation, 618 enabled by setting the 619 <a href="/pkg/crypto/tls/#Config"><code>Config</code></a>'s 620 <code>Renegotiation</code> field. 621 This is needed for connecting to many Microsoft Azure servers. 622 </p> 623 624 <p> 625 The errors returned by the package now consistently begin with a 626 <code>tls:</code> prefix. 627 In past releases, some errors used a <code>crypto/tls:</code> prefix, 628 some used a <code>tls:</code> prefix, and some had no prefix at all. 629 </p> 630 631 <p> 632 When generating self-signed certificates, the package no longer sets the 633 “Authority Key Identifier” field by default. 634 </p> 635 </dd> 636 </dl> 637 638 <dl id="crypto_x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt> 639 640 <dd> 641 <p> 642 The new function 643 <a href="/pkg/crypto/x509/#SystemCertPool"><code>SystemCertPool</code></a> 644 provides access to the entire system certificate pool if available. 645 There is also a new associated error type 646 <a href="/pkg/crypto/x509/#SystemRootsError"><code>SystemRootsError</code></a>. 647 </p> 648 </dd> 649 </dl> 650 651 <dl id="debug_dwarf"><dt><a href="/pkg/debug/dwarf/">debug/dwarf</a></dt> 652 653 <dd> 654 <p> 655 The 656 <a href="/pkg/debug/dwarf/#Reader"><code>Reader</code></a> type's new 657 <a href="/pkg/debug/dwarf/#Reader.SeekPC"><code>SeekPC</code></a> method and the 658 <a href="/pkg/debug/dwarf/#Data"><code>Data</code></a> type's new 659 <a href="/pkg/debug/dwarf/#Ranges"><code>Ranges</code></a> method 660 help to find the compilation unit to pass to a 661 <a href="/pkg/debug/dwarf/#LineReader"><code>LineReader</code></a> 662 and to identify the specific function for a given program counter. 663 </p> 664 </dd> 665 </dl> 666 667 <dl id="debug_elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt> 668 669 <dd> 670 <p> 671 The new 672 <a href="/pkg/debug/elf/#R_390"><code>R_390</code></a> relocation type 673 and its many predefined constants 674 support the S390 port. 675 </p> 676 </dd> 677 </dl> 678 679 <dl id="encoding_asn1"><dt><a href="/pkg/encoding/asn1/">encoding/asn1</a></dt> 680 681 <dd> 682 <p> 683 The ASN.1 decoder now rejects non-minimal integer encodings. 684 This may cause the package to reject some invalid but formerly accepted ASN.1 data. 685 </p> 686 </dd> 687 </dl> 688 689 <dl id="encoding_json"><dt><a href="/pkg/encoding/json/">encoding/json</a></dt> 690 691 <dd> 692 <p> 693 The 694 <a href="/pkg/encoding/json/#Encoder"><code>Encoder</code></a>'s new 695 <a href="/pkg/encoding/json/#Encoder.SetIndent"><code>SetIndent</code></a> method 696 sets the indentation parameters for JSON encoding, 697 like in the top-level 698 <a href="/pkg/encoding/json/#Indent"><code>Indent</code></a> function. 699 </p> 700 701 <p> 702 The 703 <a href="/pkg/encoding/json/#Encoder"><code>Encoder</code></a>'s new 704 <a href="/pkg/encoding/json/#Encoder.SetEscapeHTML"><code>SetEscapeHTML</code></a> method 705 controls whether the 706 <code>&</code>, <code><</code>, and <code>></code> 707 characters in quoted strings should be escaped as 708 <code>\u0026</code>, <code>\u003c</code>, and <code>\u003e</code>, 709 respectively. 710 As in previous releases, the encoder defaults to applying this escaping, 711 to avoid certain problems that can arise when embedding JSON in HTML. 712 </p> 713 714 <p> 715 In earlier versions of Go, this package only supported encoding and decoding 716 maps using keys with string types. 717 Go 1.7 adds support for maps using keys with integer types: 718 the encoding uses a quoted decimal representation as the JSON key. 719 Go 1.7 also adds support for encoding maps using non-string keys that implement 720 the <code>MarshalText</code> 721 (see 722 <a href="/pkg/encoding/#TextMarshaler"><code>encoding.TextMarshaler</code></a>) 723 method, 724 as well as support for decoding maps using non-string keys that implement 725 the <code>UnmarshalText</code> 726 (see 727 <a href="/pkg/encoding/#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>) 728 method. 729 These methods are ignored for keys with string types in order to preserve 730 the encoding and decoding used in earlier versions of Go. 731 </p> 732 733 <p> 734 When encoding a slice of typed bytes, 735 <a href="/pkg/encoding/json/#Marshal"><code>Marshal</code></a> 736 now generates an array of elements encoded using 737 that byte type's 738 <code>MarshalJSON</code> 739 or 740 <code>MarshalText</code> 741 method if present, 742 only falling back to the default base64-encoded string data if neither method is available. 743 Earlier versions of Go accept both the original base64-encoded string encoding 744 and the array encoding (assuming the byte type also implements 745 <code>UnmarshalJSON</code> 746 or 747 <code>UnmarshalText</code> 748 as appropriate), 749 so this change should be semantically backwards compatible with earlier versions of Go, 750 even though it does change the chosen encoding. 751 </p> 752 </dd> 753 </dl> 754 755 <dl id="go_build"><dt><a href="/pkg/go/build/">go/build</a></dt> 756 757 <dd> 758 <p> 759 To implement the go command's new support for binary-only packages 760 and for Fortran code in cgo-based packages, 761 the 762 <a href="/pkg/go/build/#Package"><code>Package</code></a> type 763 adds new fields <code>BinaryOnly</code>, <code>CgoFFLAGS</code>, and <code>FFiles</code>. 764 </p> 765 </dd> 766 </dl> 767 768 <dl id="go_doc"><dt><a href="/pkg/go/doc/">go/doc</a></dt> 769 770 <dd> 771 <p> 772 To support the corresponding change in <code>go</code> <code>test</code> described above, 773 <a href="/pkg/go/doc/#Example"><code>Example</code></a> struct adds a Unordered field 774 indicating whether the example may generate its output lines in any order. 775 </p> 776 </dd> 777 </dl> 778 779 <dl id="io"><dt><a href="/pkg/io/">io</a></dt> 780 781 <dd> 782 <p> 783 The package adds new constants 784 <code>SeekStart</code>, <code>SeekCurrent</code>, and <code>SeekEnd</code>, 785 for use with 786 <a href="/pkg/io/#Seeker"><code>Seeker</code></a> 787 implementations. 788 These constants are preferred over <code>os.SEEK_SET</code>, <code>os.SEEK_CUR</code>, and <code>os.SEEK_END</code>, 789 but the latter will be preserved for compatibility. 790 </p> 791 </dd> 792 </dl> 793 794 <dl id="math_big"><dt><a href="/pkg/math/big/">math/big</a></dt> 795 796 <dd> 797 <p> 798 The 799 <a href="/pkg/math/big/#Float"><code>Float</code></a> type adds 800 <a href="/pkg/math/big/#Float.GobEncode"><code>GobEncode</code></a> and 801 <a href="/pkg/math/big/#Float.GobDecode"><code>GobDecode</code></a> methods, 802 so that values of type <code>Float</code> can now be encoded and decoded using the 803 <a href="/pkg/encoding/gob/"><code>encoding/gob</code></a> 804 package. 805 </p> 806 </dd> 807 </dl> 808 809 <dl id="math_rand"><dt><a href="/pkg/math/rand/">math/rand</a></dt> 810 811 <dd> 812 <p> 813 The 814 <a href="/pkg/math/rand/#Read"><code>Read</code></a> function and 815 <a href="/pkg/math/rand/#Rand"><code>Rand</code></a>'s 816 <a href="/pkg/math/rand/#Rand.Read"><code>Read</code></a> method 817 now produce a pseudo-random stream of bytes that is consistent and not 818 dependent on the size of the input buffer. 819 </p> 820 821 <p> 822 The documentation clarifies that 823 Rand's <a href="/pkg/math/rand/#Rand.Seed"><code>Seed</code></a> 824 and <a href="/pkg/math/rand/#Rand.Read"><code>Read</code></a> methods 825 are not safe to call concurrently, though the global 826 functions <a href="/pkg/math/rand/#Seed"><code>Seed</code></a> 827 and <a href="/pkg/math/rand/#Read"><code>Read</code></a> are (and have 828 always been) safe. 829 </p> 830 </dd> 831 </dl> 832 833 <dl id="mime_multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt> 834 835 <dd> 836 <p> 837 The 838 <a href="/pkg/mime/multipart/#Writer"><code>Writer</code></a> 839 implementation now emits each multipart section's header sorted by key. 840 Previously, iteration over a map caused the section header to use a 841 non-deterministic order. 842 </p> 843 </dd> 844 </dl> 845 846 <dl id="net"><dt><a href="/pkg/net/">net</a></dt> 847 848 <dd> 849 <p> 850 As part of the introduction of <a href="#context">context</a>, the 851 <a href="/pkg/net/#Dialer"><code>Dialer</code></a> type has a new method 852 <a href="/pkg/net/#Dialer.DialContext"><code>DialContext</code></a>, like 853 <a href="/pkg/net/#Dialer.Dial"><code>Dial</code></a> but adding the 854 <a href="/pkg/context/#Context"><code>context.Context</code></a> 855 for the dial operation. 856 The context is intended to obsolete the <code>Dialer</code>'s 857 <code>Cancel</code> and <code>Deadline</code> fields, 858 but the implementation continues to respect them, 859 for backwards compatibility. 860 </p> 861 862 <p> 863 The 864 <a href="/pkg/net/#IP"><code>IP</code></a> type's 865 <a href="/pkg/net/#IP.String"><code>String</code></a> method has changed its result for invalid <code>IP</code> addresses. 866 In past releases, if an <code>IP</code> byte slice had length other than 0, 4, or 16, <code>String</code> 867 returned <code>"?"</code>. 868 Go 1.7 adds the hexadecimal encoding of the bytes, as in <code>"?12ab"</code>. 869 </p> 870 871 <p> 872 The pure Go <a href="/pkg/net/#hdr-Name_Resolution">name resolution</a> 873 implementation now respects <code>nsswitch.conf</code>'s 874 stated preference for the priority of DNS lookups compared to 875 local file (that is, <code>/etc/hosts</code>) lookups. 876 </p> 877 </dd> 878 </dl> 879 880 <dl id="net_http"><dt><a href="/pkg/net/http/">net/http</a></dt> 881 882 <dd> 883 <p> 884 <a href="/pkg/net/http/#ResponseWriter"><code>ResponseWriter</code></a>'s 885 documentation now makes clear that beginning to write the response 886 may prevent future reads on the request body. 887 For maximal compatibility, implementations are encouraged to 888 read the request body completely before writing any part of the response. 889 </p> 890 891 <p> 892 As part of the introduction of <a href="#context">context</a>, the 893 <a href="/pkg/net/http/#Request"><code>Request</code></a> has a new methods 894 <a href="/pkg/net/http/#Request.Context"><code>Context</code></a>, to retrieve the associated context, and 895 <a href="/pkg/net/http/#Request.WithContext"><code>WithContext</code></a>, to construct a copy of <code>Request</code> 896 with a modified context. 897 </p> 898 899 <p> 900 In the 901 <a href="/pkg/net/http/#Server"><code>Server</code></a> implementation, 902 <a href="/pkg/net/http/#Server.Serve"><code>Serve</code></a> records in the request context 903 both the underlying <code>*Server</code> using the key <code>ServerContextKey</code> 904 and the local address on which the request was received (a 905 <a href="/pkg/net/#Addr"><code>Addr</code></a>) using the key <code>LocalAddrContextKey</code>. 906 For example, the address on which a request received is 907 <code>req.Context().Value(http.LocalAddrContextKey).(net.Addr)</code>. 908 </p> 909 910 <p> 911 The server's <a href="/pkg/net/http/#Server.Serve"><code>Serve</code></a> method 912 now only enables HTTP/2 support if the <code>Server.TLSConfig</code> field is <code>nil</code> 913 or includes <code>"h2"</code> in its <code>TLSConfig.NextProtos</code>. 914 </p> 915 916 <p> 917 The server implementation now 918 pads response codes less than 100 to three digits 919 as required by the protocol, 920 so that <code>w.WriteHeader(5)</code> uses the HTTP response 921 status <code>005</code>, not just <code>5</code>. 922 </p> 923 924 <p> 925 The server implementation now correctly sends only one "Transfer-Encoding" header when "chunked" 926 is set explicitly, following <a href="https://tools.ietf.org/html/rfc7230#section-3.3.1">RFC 7230</a>. 927 </p> 928 929 <p> 930 The server implementation is now stricter about rejecting requests with invalid HTTP versions. 931 Invalid requests claiming to be HTTP/0.x are now rejected (HTTP/0.9 was never fully supported), 932 and plaintext HTTP/2 requests other than the "PRI * HTTP/2.0" upgrade request are now rejected as well. 933 The server continues to handle encrypted HTTP/2 requests. 934 </p> 935 936 <p> 937 In the server, a 200 status code is sent back by the timeout handler on an empty 938 response body, instead of sending back 0 as the status code. 939 </p> 940 941 <p> 942 In the client, the 943 <a href="/pkg/net/http/#Transport"><code>Transport</code></a> implementation passes the request context 944 to any dial operation connecting to the remote server. 945 If a custom dialer is needed, the new <code>Transport</code> field 946 <code>DialContext</code> is preferred over the existing <code>Dial</code> field, 947 to allow the transport to supply a context. 948 </p> 949 950 <p> 951 The 952 <a href="/pkg/net/http/#Transport"><code>Transport</code></a> also adds fields 953 <code>IdleConnTimeout</code>, 954 <code>MaxIdleConns</code>, 955 and 956 <code>MaxResponseHeaderBytes</code> 957 to help control client resources consumed 958 by idle or chatty servers. 959 </p> 960 961 <p> 962 A 963 <a href="/pkg/net/http/#Client"><code>Client</code></a>'s configured <code>CheckRedirect</code> function can now 964 return <code>ErrUseLastResponse</code> to indicate that the 965 most recent redirect response should be returned as the 966 result of the HTTP request. 967 That response is now available to the <code>CheckRedirect</code> function 968 as <code>req.Response</code>. 969 </p> 970 971 <p> 972 Since Go 1, the default behavior of the HTTP client is 973 to request server-side compression 974 using the <code>Accept-Encoding</code> request header 975 and then to decompress the response body transparently, 976 and this behavior is adjustable using the 977 <a href="/pkg/net/http/#Transport"><code>Transport</code></a>'s <code>DisableCompression</code> field. 978 In Go 1.7, to aid the implementation of HTTP proxies, the 979 <a href="/pkg/net/http/#Response"><code>Response</code></a>'s new 980 <code>Uncompressed</code> field reports whether 981 this transparent decompression took place. 982 </p> 983 984 <p> 985 <a href="/pkg/net/http/#DetectContentType"><code>DetectContentType</code></a> 986 adds support for a few new audio and video content types. 987 </p> 988 </dd> 989 </dl> 990 991 <dl id="net_http_cgi"><dt><a href="/pkg/net/http/cgi/">net/http/cgi</a></dt> 992 993 <dd> 994 <p> 995 The 996 <a href="/pkg/net/http/cgi/#Handler"><code>Handler</code></a> 997 adds a new field 998 <code>Stderr</code> 999 that allows redirection of the child process's 1000 standard error away from the host process's 1001 standard error. 1002 </p> 1003 </dd> 1004 </dl> 1005 1006 <dl id="net_http_httptest"><dt><a href="/pkg/net/http/httptest/">net/http/httptest</a></dt> 1007 1008 <dd> 1009 <p> 1010 The new function 1011 <a href="/pkg/net/http/httptest/#NewRequest"><code>NewRequest</code></a> 1012 prepares a new 1013 <a href="/pkg/net/http/#Request"><code>http.Request</code></a> 1014 suitable for passing to an 1015 <a href="/pkg/net/http/#Handler"><code>http.Handler</code></a> during a test. 1016 </p> 1017 1018 <p> 1019 The 1020 <a href="/pkg/net/http/httptest/#ResponseRecorder"><code>ResponseRecorder</code></a>'s new 1021 <a href="/pkg/net/http/httptest/#ResponseRecorder.Result"><code>Result</code></a> method 1022 returns the recorded 1023 <a href="/pkg/net/http/#Response"><code>http.Response</code></a>. 1024 Tests that need to check the response's headers or trailers 1025 should call <code>Result</code> and inspect the response fields 1026 instead of accessing 1027 <code>ResponseRecorder</code>'s <code>HeaderMap</code> directly. 1028 </p> 1029 </dd> 1030 </dl> 1031 1032 <dl id="net_http_httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt> 1033 1034 <dd> 1035 <p> 1036 The 1037 <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a> implementation now responds with “502 Bad Gateway” 1038 when it cannot reach a back end; in earlier releases it responded with “500 Internal Server Error.” 1039 </p> 1040 1041 <p> 1042 Both 1043 <a href="/pkg/net/http/httputil/#ClientConn"><code>ClientConn</code></a> and 1044 <a href="/pkg/net/http/httputil/#ServerConn"><code>ServerConn</code></a> have been documented as deprecated. 1045 They are low-level, old, and unused by Go's current HTTP stack 1046 and will no longer be updated. 1047 Programs should use 1048 <a href="/pkg/net/http/#Client"><code>http.Client</code></a>, 1049 <a href="/pkg/net/http/#Transport"><code>http.Transport</code></a>, 1050 and 1051 <a href="/pkg/net/http/#Server"><code>http.Server</code></a> 1052 instead. 1053 </p> 1054 </dd> 1055 </dl> 1056 1057 <dl id="net_http_pprof"><dt><a href="/pkg/net/http/pprof/">net/http/pprof</a></dt> 1058 1059 <dd> 1060 <p> 1061 The runtime trace HTTP handler, installed to handle the path <code>/debug/pprof/trace</code>, 1062 now accepts a fractional number in its <code>seconds</code> query parameter, 1063 allowing collection of traces for intervals smaller than one second. 1064 This is especially useful on busy servers. 1065 </p> 1066 </dd> 1067 </dl> 1068 1069 <dl><dt><a href="/pkg/net/mail/">net/mail</a></dt> 1070 1071 <dd> 1072 <p> 1073 The address parser now allows unescaped UTF-8 text in addresses 1074 following <a href="https://tools.ietf.org/html/rfc6532">RFC 6532</a>, 1075 but it does not apply any normalization to the result. 1076 For compatibility with older mail parsers, 1077 the address encoder, namely 1078 <a href="/pkg/net/mail/#Address"><code>Address</code></a>'s 1079 <a href="/pkg/net/mail/#Address.String"><code>String</code></a> method, 1080 continues to escape all UTF-8 text following <a href="https://tools.ietf.org/html/rfc5322">RFC 5322</a>. 1081 </p> 1082 1083 <p> 1084 The <a href="/pkg/net/mail/#ParseAddress"><code>ParseAddress</code></a> 1085 function and 1086 the <a href="/pkg/net/mail/#AddressParser.Parse"><code>AddressParser.Parse</code></a> 1087 method are stricter. 1088 They used to ignore any characters following an e-mail address, but 1089 will now return an error for anything other than whitespace. 1090 </p> 1091 </dd> 1092 </dl> 1093 1094 <dl id="net_url"><dt><a href="/pkg/net/url/">net/url</a></dt> 1095 1096 <dd> 1097 <p> 1098 The 1099 <a href="/pkg/net/url/#URL"><code>URL</code></a>'s 1100 new <code>ForceQuery</code> field 1101 records whether the URL must have a query string, 1102 in order to distinguish URLs without query strings (like <code>/search</code>) 1103 from URLs with empty query strings (like <code>/search?</code>). 1104 </p> 1105 </dd> 1106 </dl> 1107 1108 <dl id="os"><dt><a href="/pkg/os/">os</a></dt> 1109 1110 <dd> 1111 <p> 1112 <a href="/pkg/os/#IsExist"><code>IsExist</code></a> now returns true for <code>syscall.ENOTEMPTY</code>, 1113 on systems where that error exists. 1114 </p> 1115 1116 <p> 1117 On Windows, 1118 <a href="/pkg/os/#Remove"><code>Remove</code></a> now removes read-only files when possible, 1119 making the implementation behave as on 1120 non-Windows systems. 1121 </p> 1122 </dd> 1123 </dl> 1124 1125 <dl id="os_exec"><dt><a href="/pkg/os/exec/">os/exec</a></dt> 1126 1127 <dd> 1128 <p> 1129 As part of the introduction of <a href="#context">context</a>, 1130 the new constructor 1131 <a href="/pkg/os/exec/#CommandContext"><code>CommandContext</code></a> 1132 is like 1133 <a href="/pkg/os/exec/#Command"><code>Command</code></a> but includes a context that can be used to cancel the command execution. 1134 </p> 1135 </dd> 1136 </dl> 1137 1138 <dl id="os_user"><dt><a href="/pkg/os/user/">os/user</a></dt> 1139 1140 <dd> 1141 <p> 1142 The 1143 <a href="/pkg/os/user/#Current"><code>Current</code></a> 1144 function is now implemented even when cgo is not available. 1145 </p> 1146 1147 <p> 1148 The new 1149 <a href="/pkg/os/user/#Group"><code>Group</code></a> type, 1150 along with the lookup functions 1151 <a href="/pkg/os/user/#LookupGroup"><code>LookupGroup</code></a> and 1152 <a href="/pkg/os/user/#LookupGroupId"><code>LookupGroupId</code></a> 1153 and the new field <code>GroupIds</code> in the <code>User</code> struct, 1154 provides access to system-specific user group information. 1155 </p> 1156 </dd> 1157 </dl> 1158 1159 <dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt> 1160 1161 <dd> 1162 <p> 1163 Although 1164 <a href="/pkg/reflect/#Value"><code>Value</code></a>'s 1165 <a href="/pkg/reflect/#Value.Field"><code>Field</code></a> method has always been documented to panic 1166 if the given field number <code>i</code> is out of range, it has instead 1167 silently returned a zero 1168 <a href="/pkg/reflect/#Value"><code>Value</code></a>. 1169 Go 1.7 changes the method to behave as documented. 1170 </p> 1171 1172 <p> 1173 The new 1174 <a href="/pkg/reflect/#StructOf"><code>StructOf</code></a> 1175 function constructs a struct type at run time. 1176 It completes the set of type constructors, joining 1177 <a href="/pkg/reflect/#ArrayOf"><code>ArrayOf</code></a>, 1178 <a href="/pkg/reflect/#ChanOf"><code>ChanOf</code></a>, 1179 <a href="/pkg/reflect/#FuncOf"><code>FuncOf</code></a>, 1180 <a href="/pkg/reflect/#MapOf"><code>MapOf</code></a>, 1181 <a href="/pkg/reflect/#PtrTo"><code>PtrTo</code></a>, 1182 and 1183 <a href="/pkg/reflect/#SliceOf"><code>SliceOf</code></a>. 1184 </p> 1185 1186 <p> 1187 <a href="/pkg/reflect/#StructTag"><code>StructTag</code></a>'s 1188 new method 1189 <a href="/pkg/reflect/#StructTag.Lookup"><code>Lookup</code></a> 1190 is like 1191 <a href="/pkg/reflect/#StructTag.Get"><code>Get</code></a> 1192 but distinguishes the tag not containing the given key 1193 from the tag associating an empty string with the given key. 1194 </p> 1195 1196 <p> 1197 The 1198 <a href="/pkg/reflect/#Type.Method"><code>Method</code></a> and 1199 <a href="/pkg/reflect/#Type.NumMethod"><code>NumMethod</code></a> 1200 methods of 1201 <a href="/pkg/reflect/#Type"><code>Type</code></a> and 1202 <a href="/pkg/reflect/#Value"><code>Value</code></a> 1203 no longer return or count unexported methods. 1204 </p> 1205 </dd> 1206 </dl> 1207 1208 <dl id="strings"><dt><a href="/pkg/strings/">strings</a></dt> 1209 1210 <dd> 1211 <p> 1212 In previous releases of Go, if 1213 <a href="/pkg/strings/#Reader"><code>Reader</code></a>'s 1214 <a href="/pkg/strings/#Reader.Read"><code>Read</code></a> method 1215 were asked for zero bytes with no data remaining, it would 1216 return a count of 0 and no error. 1217 Now it returns a count of 0 and the error 1218 <a href="/pkg/io/#EOF"><code>io.EOF</code></a>. 1219 </p> 1220 1221 <p> 1222 The 1223 <a href="/pkg/strings/#Reader"><code>Reader</code></a> type has a new method 1224 <a href="/pkg/strings/#Reader.Reset"><code>Reset</code></a> to allow reuse of a <code>Reader</code>. 1225 </p> 1226 </dd> 1227 </dl> 1228 1229 <dl id="time"><dt><a href="/pkg/time/">time</a></dt> 1230 1231 <dd> 1232 <p> 1233 <a href="/pkg/time/#Duration"><code>Duration</code></a>'s 1234 time.Duration.String method now reports the zero duration as <code>"0s"</code>, not <code>"0"</code>. 1235 <a href="/pkg/time/#ParseDuration"><code>ParseDuration</code></a> continues to accept both forms. 1236 </p> 1237 1238 <p> 1239 The method call <code>time.Local.String()</code> now returns <code>"Local"</code> on all systems; 1240 in earlier releases, it returned an empty string on Windows. 1241 </p> 1242 1243 <p> 1244 The time zone database in 1245 <code>$GOROOT/lib/time</code> has been updated 1246 to IANA release 2016d. 1247 This fallback database is only used when the system time zone database 1248 cannot be found, for example on Windows. 1249 The Windows time zone abbreviation list has also been updated. 1250 </p> 1251 </dd> 1252 </dl> 1253 1254 <dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt> 1255 1256 <dd> 1257 <p> 1258 On Linux, the 1259 <a href="/pkg/syscall/#SysProcAttr"><code>SysProcAttr</code></a> struct 1260 (as used in 1261 <a href="/pkg/os/exec/#Cmd"><code>os/exec.Cmd</code></a>'s <code>SysProcAttr</code> field) 1262 has a new <code>Unshareflags</code> field. 1263 If the field is nonzero, the child process created by 1264 <a href="/pkg/syscall/#ForkExec"><code>ForkExec</code></a> 1265 (as used in <code>exec.Cmd</code>'s <code>Run</code> method) 1266 will call the 1267 <a href="http://man7.org/linux/man-pages/man2/unshare.2.html"><i>unshare</i>(2)</a> 1268 system call before executing the new program. 1269 </p> 1270 </dd> 1271 </dl> 1272 1273 1274 <dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt> 1275 1276 <dd> 1277 <p> 1278 The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated 1279 support throughout the system has been upgraded from version 8.0 to 1280 <a href="http://www.unicode.org/versions/Unicode9.0.0/">Unicode 9.0</a>. 1281 </p> 1282 </dd> 1283 </dl>