"Fossies" - the Fresh Open Source Software Archive

Member "go/doc/go1.7.html" (9 Sep 2020, 43709 Bytes) of package /windows/misc/go1.14.9.windows-386.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) HTML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

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