"Fossies" - the Fresh Open Source Software Archive

Member "go/doc/go1.9.html" (9 Sep 2020, 37549 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.9 Release Notes",
    3     "Path":  "/doc/go1.9",
    4     "Template": true
    5 }-->
    6 
    7 <!--
    8 NOTE: In this document and others in this directory, the convention is to
    9 set fixed-width phrases with non-fixed-width spaces, as in
   10 <code>hello</code> <code>world</code>.
   11 Do not send CLs removing the interior tags from such phrases.
   12 -->
   13 
   14 <style>
   15   main ul li { margin: 0.5em 0; }
   16 </style>
   17 
   18 <h2 id="introduction">Introduction to Go 1.9</h2>
   19 
   20 <p>
   21   The latest Go release, version 1.9, arrives six months
   22   after <a href="go1.8">Go 1.8</a> and is the tenth release in
   23   the <a href="https://golang.org/doc/devel/release.html">Go 1.x
   24   series</a>.
   25   There are two <a href="#language">changes to the language</a>:
   26   adding support for type aliases and defining when implementations
   27   may fuse floating point operations.
   28   Most of the changes are in the implementation of the toolchain,
   29   runtime, and libraries.
   30   As always, the release maintains the Go 1
   31   <a href="/doc/go1compat.html">promise of compatibility</a>.
   32   We expect almost all Go programs to continue to compile and run as
   33   before.
   34 </p>
   35 
   36 <p>
   37   The release
   38   adds <a href="#monotonic-time">transparent monotonic time support</a>,
   39   <a href="#parallel-compile">parallelizes compilation of functions</a> within a package,
   40   better supports <a href="#test-helper">test helper functions</a>,
   41   includes a new <a href="#math-bits">bit manipulation package</a>,
   42   and has a new <a href="#sync-map">concurrent map type</a>.
   43 </p>
   44 
   45 <h2 id="language">Changes to the language</h2>
   46 
   47 <p>
   48   There are two changes to the language.
   49 </p>
   50 <p>
   51   Go now supports type aliases to support gradual code repair while
   52   moving a type between packages.
   53   The <a href="https://golang.org/design/18130-type-alias">type alias
   54   design document</a>
   55   and <a href="https://talks.golang.org/2016/refactor.article">an
   56   article on refactoring</a> cover the problem in detail.
   57   In short, a type alias declaration has the form:
   58 </p>
   59 
   60 <pre>
   61 type T1 = T2
   62 </pre>
   63 
   64 <p>
   65   This declaration introduces an alias name <code>T1</code>—an
   66   alternate spelling—for the type denoted by <code>T2</code>; that is,
   67   both <code>T1</code> and <code>T2</code> denote the same type.
   68 </p>
   69 
   70 <p> <!-- CL 40391 -->
   71   A smaller language change is that the
   72   <a href="/ref/spec#Floating_point_operators">language specification
   73   now states</a> when implementations are allowed to fuse floating
   74   point operations together, such as by using an architecture's "fused
   75   multiply and add" (FMA) instruction to compute <code>x*y</code>&nbsp;<code>+</code>&nbsp;<code>z</code>
   76   without rounding the intermediate result <code>x*y</code>.
   77   To force the intermediate rounding, write <code>float64(x*y)</code>&nbsp;<code>+</code>&nbsp;<code>z</code>.
   78 </p>
   79 
   80 <h2 id="ports">Ports</h2>
   81 
   82 <p>
   83   There are no new supported operating systems or processor
   84   architectures in this release.
   85 </p>
   86 
   87 <h3 id="power8">ppc64x requires POWER8</h3>
   88 
   89 <p> <!-- CL 36725, CL 36832 -->
   90   Both <code>GOARCH=ppc64</code> and <code>GOARCH=ppc64le</code> now
   91   require at least POWER8 support. In previous releases,
   92   only <code>GOARCH=ppc64le</code> required POWER8 and the big
   93   endian <code>ppc64</code> architecture supported older
   94   hardware.
   95 <p>
   96 
   97 <h3 id="freebsd">FreeBSD</h3>
   98 
   99 <p>
  100   Go 1.9 is the last release that will run on FreeBSD 9.3,
  101   which is already
  102   <a href="https://www.freebsd.org/security/unsupported.html">unsupported by FreeBSD</a>.
  103   Go 1.10 will require FreeBSD 10.3+.
  104 </p>
  105 
  106 <h3 id="openbsd">OpenBSD 6.0</h3>
  107 
  108 <p> <!-- CL 40331 -->
  109   Go 1.9 now enables PT_TLS generation for cgo binaries and thus
  110   requires OpenBSD 6.0 or newer. Go 1.9 no longer supports
  111   OpenBSD 5.9.
  112 <p>
  113 
  114 <h3 id="known_issues">Known Issues</h3>
  115 
  116 <p>
  117   There are some instabilities on FreeBSD that are known but not understood.
  118   These can lead to program crashes in rare cases.
  119   See <a href="https://golang.org/issue/15658">issue 15658</a>.
  120   Any help in solving this FreeBSD-specific issue would be appreciated.
  121 </p>
  122 
  123 <p>
  124   Go stopped running NetBSD builders during the Go 1.9 development
  125   cycle due to NetBSD kernel crashes, up to and including NetBSD 7.1.
  126   As Go 1.9 is being released, NetBSD 7.1.1 is being released with a fix.
  127   However, at this time we have no NetBSD builders passing our test suite.
  128   Any help investigating the
  129   <a href="https://github.com/golang/go/labels/OS-NetBSD">various NetBSD issues</a>
  130   would be appreciated.
  131 </p>
  132 
  133 <h2 id="tools">Tools</h2>
  134 
  135 <h3 id="parallel-compile">Parallel Compilation</h3>
  136 
  137 <p>
  138   The Go compiler now supports compiling a package's functions in parallel, taking
  139   advantage of multiple cores. This is in addition to the <code>go</code> command's
  140   existing support for parallel compilation of separate packages.
  141   Parallel compilation is on by default, but it can be disabled by setting the
  142   environment variable <code>GO19CONCURRENTCOMPILATION</code> to <code>0</code>.
  143 </p>
  144 
  145 <h3 id="vendor-dotdotdot">Vendor matching with ./...</h3>
  146 
  147 <p><!-- CL 38745 -->
  148   By popular request, <code>./...</code> no longer matches packages
  149   in <code>vendor</code> directories in tools accepting package names,
  150   such as <code>go</code> <code>test</code>. To match vendor
  151   directories, write <code>./vendor/...</code>.
  152 </p>
  153 
  154 <h3 id="goroot">Moved GOROOT</h3>
  155 
  156 <p><!-- CL 42533 -->
  157   The <a href="/cmd/go/">go tool</a> will now use the path from which it
  158   was invoked to attempt to locate the root of the Go install tree.
  159   This means that if the entire Go installation is moved to a new
  160   location, the go tool should continue to work as usual.
  161   This may be overridden by setting <code>GOROOT</code> in the environment,
  162   which should only be done in unusual circumstances.
  163   Note that this does not affect the result of
  164   the <a href="/pkg/runtime/#GOROOT">runtime.GOROOT</a> function, which
  165   will continue to report the original installation location;
  166   this may be fixed in later releases.
  167 </p>
  168 
  169 <h3 id="compiler">Compiler Toolchain</h3>
  170 
  171 <p><!-- CL 37441 -->
  172   Complex division is now C99-compatible. This has always been the
  173   case in gccgo and is now fixed in the gc toolchain.
  174 </p>
  175 
  176 <p> <!-- CL 36983 -->
  177   The linker will now generate DWARF information for cgo executables on Windows.
  178 </p>
  179 
  180 <p> <!-- CL 44210, CL 40095 -->
  181   The compiler now includes lexical scopes in the generated DWARF if the
  182   <code>-N -l</code> flags are provided, allowing
  183   debuggers to hide variables that are not in scope. The <code>.debug_info</code>
  184   section is now DWARF version 4.
  185 </p>
  186 
  187 <p> <!-- CL 43855 -->
  188   The values of <code>GOARM</code> and <code>GO386</code> now affect a
  189   compiled package's build ID, as used by the <code>go</code> tool's
  190   dependency caching.
  191 </p>
  192 
  193 <h3 id="asm">Assembler</h3>
  194 
  195 <p> <!-- CL 42028 -->
  196   The four-operand ARM <code>MULA</code> instruction is now assembled correctly,
  197   with the addend register as the third argument and the result
  198   register as the fourth and final argument.
  199   In previous releases, the two meanings were reversed.
  200   The three-operand form, in which the fourth argument is implicitly
  201   the same as the third, is unaffected.
  202   Code using four-operand <code>MULA</code> instructions
  203   will need to be updated, but we believe this form is very rarely used.
  204   <code>MULAWT</code> and <code>MULAWB</code> were already
  205   using the correct order in all forms and are unchanged.
  206 </p>
  207 
  208 <p> <!-- CL 42990 -->
  209   The assembler now supports <code>ADDSUBPS/PD</code>, completing the
  210   two missing x86 SSE3 instructions.
  211 </p>
  212 
  213 <h3 id="go-doc">Doc</h3>
  214 
  215 <p><!-- CL 36031 -->
  216   Long lists of arguments are now truncated. This improves the readability
  217   of <code>go</code> <code>doc</code> on some generated code.
  218 </p>
  219 
  220 <p><!-- CL 38438 -->
  221   Viewing documentation on struct fields is now supported.
  222   For example, <code>go</code> <code>doc</code> <code>http.Client.Jar</code>.
  223 </p>
  224 
  225 <h3 id="go-env-json">Env</h3>
  226 
  227 <p> <!-- CL 38757 -->
  228   The new <code>go</code> <code>env</code> <code>-json</code> flag
  229   enables JSON output, instead of the default OS-specific output
  230   format.
  231 </p>
  232 
  233 <h3 id="go-test-list">Test</h3>
  234 
  235 <p> <!-- CL 41195 -->
  236   The <a href="/cmd/go/#hdr-Description_of_testing_flags"><code>go</code> <code>test</code></a>
  237   command accepts a new <code>-list</code> flag, which takes a regular
  238   expression as an argument and prints to stdout the name of any
  239   tests, benchmarks, or examples that match it, without running them.
  240 </p>
  241 
  242 
  243 <h3 id="go-tool-pprof">Pprof</h3>
  244 
  245 <p> <!-- CL 34192 -->
  246   Profiles produced by the <code>runtime/pprof</code> package now
  247   include symbol information, so they can be viewed
  248   in <code>go</code> <code>tool</code> <code>pprof</code>
  249   without the binary that produced the profile.
  250 </p>
  251 
  252 <p> <!-- CL 38343 -->
  253   The <code>go</code> <code>tool</code> <code>pprof</code> command now
  254   uses the HTTP proxy information defined in the environment, using
  255   <a href="/pkg/net/http/#ProxyFromEnvironment"><code>http.ProxyFromEnvironment</code></a>.
  256 </p>
  257 
  258 <h3 id="vet">Vet</h3>
  259 
  260 <!-- CL 40112 -->
  261 <p>
  262   The <a href="/cmd/vet/"><code>vet</code> command</a>
  263   has been better integrated into the
  264   <a href="/cmd/go/"><code>go</code> tool</a>,
  265   so <code>go</code> <code>vet</code> now supports all standard build
  266   flags while <code>vet</code>'s own flags are now available
  267   from <code>go</code> <code>vet</code> as well as
  268   from <code>go</code> <code>tool</code> <code>vet</code>.
  269 </p>
  270 
  271 <h3 id="gccgo">Gccgo</h3>
  272 
  273 <p>
  274 Due to the alignment of Go's semiannual release schedule with GCC's
  275 annual release schedule,
  276 GCC release 7 contains the Go 1.8.3 version of gccgo.
  277 We expect that the next release, GCC 8, will contain the Go 1.10
  278 version of gccgo.
  279 </p>
  280 
  281 <h2 id="runtime">Runtime</h2>
  282 
  283 <h3 id="callersframes">Call stacks with inlined frames</h3>
  284 
  285 <p>
  286   Users of
  287   <a href="/pkg/runtime#Callers"><code>runtime.Callers</code></a>
  288   should avoid directly inspecting the resulting PC slice and instead use
  289   <a href="/pkg/runtime#CallersFrames"><code>runtime.CallersFrames</code></a>
  290   to get a complete view of the call stack, or
  291   <a href="/pkg/runtime#Caller"><code>runtime.Caller</code></a>
  292   to get information about a single caller.
  293   This is because an individual element of the PC slice cannot account
  294   for inlined frames or other nuances of the call stack.
  295 </p>
  296 
  297 <p>
  298   Specifically, code that directly iterates over the PC slice and uses
  299   functions such as
  300   <a href="/pkg/runtime#FuncForPC"><code>runtime.FuncForPC</code></a>
  301   to resolve each PC individually will miss inlined frames.
  302   To get a complete view of the stack, such code should instead use
  303   <code>CallersFrames</code>.
  304   Likewise, code should not assume that the length returned by
  305   <code>Callers</code> is any indication of the call depth.
  306   It should instead count the number of frames returned by
  307   <code>CallersFrames</code>.
  308 </p>
  309 
  310 <p>
  311   Code that queries a single caller at a specific depth should use
  312   <code>Caller</code> rather than passing a slice of length 1 to
  313   <code>Callers</code>.
  314 </p>
  315 
  316 <p>
  317   <a href="/pkg/runtime#CallersFrames"><code>runtime.CallersFrames</code></a>
  318   has been available since Go 1.7, so code can be updated prior to
  319   upgrading to Go 1.9.
  320 </p>
  321 
  322 <h2 id="performance">Performance</h2>
  323 
  324 <p>
  325   As always, the changes are so general and varied that precise
  326   statements about performance are difficult to make.  Most programs
  327   should run a bit faster, due to speedups in the garbage collector,
  328   better generated code, and optimizations in the core library.
  329 </p>
  330 
  331 <h3 id="gc">Garbage Collector</h3>
  332 
  333 <p> <!-- CL 37520 -->
  334   Library functions that used to trigger stop-the-world garbage
  335   collection now trigger concurrent garbage collection.
  336 
  337   Specifically, <a href="/pkg/runtime/#GC"><code>runtime.GC</code></a>,
  338   <a href="/pkg/runtime/debug/#SetGCPercent"><code>debug.SetGCPercent</code></a>,
  339   and
  340   <a href="/pkg/runtime/debug/#FreeOSMemory"><code>debug.FreeOSMemory</code></a>,
  341   now trigger concurrent garbage collection, blocking only the calling
  342   goroutine until the garbage collection is done.
  343 </p>
  344 
  345 <p> <!-- CL 34103, CL 39835 -->
  346   The
  347   <a href="/pkg/runtime/debug/#SetGCPercent"><code>debug.SetGCPercent</code></a>
  348   function only triggers a garbage collection if one is immediately
  349   necessary because of the new GOGC value.
  350   This makes it possible to adjust GOGC on-the-fly.
  351 </p>
  352 
  353 <p> <!-- CL 38732 -->
  354   Large object allocation performance is significantly improved in
  355   applications using large (&gt;50GB) heaps containing many large
  356   objects.
  357 </p>
  358 
  359 <p> <!-- CL 34937 -->
  360   The <a href="/pkg/runtime/#ReadMemStats"><code>runtime.ReadMemStats</code></a>
  361   function now takes less than 100µs even for very large heaps.
  362 </p>
  363 
  364 <h2 id="library">Core library</h2>
  365 
  366 <h3 id="monotonic-time">Transparent Monotonic Time support</h3>
  367 
  368 <p> <!-- CL 36255 -->
  369   The <a href="/pkg/time/"><code>time</code></a> package now transparently
  370   tracks monotonic time in each <a href="/pkg/time/#Time"><code>Time</code></a>
  371   value, making computing durations between two <code>Time</code> values
  372   a safe operation in the presence of wall clock adjustments.
  373   See the <a href="/pkg/time/#hdr-Monotonic_Clocks">package docs</a> and
  374   <a href="https://golang.org/design/12914-monotonic">design document</a>
  375   for details.
  376 </p>
  377 
  378 <h3 id="math-bits">New bit manipulation package</h3>
  379 
  380 <p> <!-- CL 36315 -->
  381   Go 1.9 includes a new package,
  382   <a href="/pkg/math/bits/"><code>math/bits</code></a>, with optimized
  383   implementations for manipulating bits. On most architectures,
  384   functions in this package are additionally recognized by the
  385   compiler and treated as intrinsics for additional performance.
  386 </p>
  387 
  388 <h3 id="test-helper">Test Helper Functions</h3>
  389 
  390 <p> <!-- CL 38796 -->
  391   The
  392   new <a href="/pkg/testing/#T.Helper"><code>(*T).Helper</code></a>
  393   and <a href="/pkg/testing/#B.Helper"><code>(*B).Helper</code></a>
  394   methods mark the calling function as a test helper function.  When
  395   printing file and line information, that function will be skipped.
  396   This permits writing test helper functions while still having useful
  397   line numbers for users.
  398 </p>
  399 
  400 <h3 id="sync-map">Concurrent Map</h3>
  401 
  402 <p> <!-- CL 36617 -->
  403   The new <a href="/pkg/sync/#Map"><code>Map</code></a> type
  404   in the <a href="/pkg/sync/"><code>sync</code></a> package
  405   is a concurrent map with amortized-constant-time loads, stores, and
  406   deletes. It is safe for multiple goroutines to call a <code>Map</code>'s methods
  407   concurrently.
  408 </p>
  409 
  410 <h3 id="pprof-labels">Profiler Labels</h3>
  411 
  412 <p><!-- CL 34198 -->
  413   The <a href="/pkg/runtime/pprof"><code>runtime/pprof</code> package</a>
  414   now supports adding labels to <code>pprof</code> profiler records.
  415   Labels form a key-value map that is used to distinguish calls of the
  416   same function in different contexts when looking at profiles
  417   with the <a href="/cmd/pprof/"><code>pprof</code> command</a>.
  418   The <code>pprof</code> package's
  419   new <a href="/pkg/runtime/pprof/#Do"><code>Do</code> function</a>
  420   runs code associated with some provided labels. Other new functions
  421   in the package help work with labels.
  422 </p>
  423 
  424 </dl><!-- runtime/pprof -->
  425 
  426 
  427 <h3 id="minor_library_changes">Minor changes to the library</h3>
  428 
  429 <p>
  430   As always, there are various minor changes and updates to the library,
  431   made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
  432   in mind.
  433 </p>
  434 
  435 <dl id="archive/zip"><dt><a href="/pkg/archive/zip/">archive/zip</a></dt>
  436   <dd>
  437     <p><!-- CL 39570 -->
  438       The
  439       ZIP <a href="/pkg/archive/zip/#Writer"><code>Writer</code></a>
  440       now sets the UTF-8 bit in
  441       the <a href="/pkg/archive/zip/#FileHeader.Flags"><code>FileHeader.Flags</code></a>
  442       when appropriate.
  443     </p>
  444 
  445 </dl><!-- archive/zip -->
  446 
  447 <dl id="crypto/rand"><dt><a href="/pkg/crypto/rand/">crypto/rand</a></dt>
  448   <dd>
  449     <p><!-- CL 43852 -->
  450       On Linux, Go now calls the <code>getrandom</code> system call
  451       without the <code>GRND_NONBLOCK</code> flag; it will now block
  452       until the kernel has sufficient randomness. On kernels predating
  453       the <code>getrandom</code> system call, Go continues to read
  454       from <code>/dev/urandom</code>.
  455     </p>
  456 
  457 </dl><!-- crypto/rand -->
  458 
  459 <dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
  460   <dd>
  461     <p><!-- CL 36093 -->
  462 
  463       On Unix systems the environment
  464       variables <code>SSL_CERT_FILE</code>
  465       and <code>SSL_CERT_DIR</code> can now be used to override the
  466       system default locations for the SSL certificate file and SSL
  467       certificate files directory, respectively.
  468     </p>
  469 
  470     <p>The FreeBSD file <code>/usr/local/etc/ssl/cert.pem</code> is
  471       now included in the certificate search path.
  472     </p>
  473 
  474     <p><!-- CL 36900 -->
  475 
  476       The package now supports excluded domains in name constraints.
  477       In addition to enforcing such constraints,
  478       <a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>
  479       will create certificates with excluded name constraints
  480       if the provided template certificate has the new
  481       field
  482       <a href="/pkg/crypto/x509/#Certificate.ExcludedDNSDomains"><code>ExcludedDNSDomains</code></a>
  483       populated.
  484     </p>
  485 
  486     <p><!-- CL 36696 -->
  487 
  488     If any SAN extension, including with no DNS names, is present
  489     in the certificate, then the Common Name from
  490     <a href="/pkg/crypto/x509/#Certificate.Subject"><code>Subject</code></a> is ignored.
  491     In previous releases, the code tested only whether DNS-name SANs were
  492     present in a certificate.
  493     </p>
  494 
  495 </dl><!-- crypto/x509 -->
  496 
  497 <dl id="database/sql"><dt><a href="/pkg/database/sql/">database/sql</a></dt>
  498   <dd>
  499     <p><!-- CL 35476 -->
  500       The package will now use a cached <a href="/pkg/database/sql/#Stmt"><code>Stmt</code></a> if
  501       available in <a href="/pkg/database/sql/#Tx.Stmt"><code>Tx.Stmt</code></a>.
  502       This prevents statements from being re-prepared each time
  503       <a href="/pkg/database/sql/#Tx.Stmt"><code>Tx.Stmt</code></a> is called.
  504     </p>
  505 
  506     <p><!-- CL 38533 -->
  507       The package now allows drivers to implement their own argument checkers by implementing
  508       <a href="/pkg/database/sql/driver/#NamedValueChecker"><code>driver.NamedValueChecker</code></a>.
  509       This also allows drivers to support <code>OUTPUT</code> and <code>INOUT</code> parameter types.
  510       <a href="/pkg/database/sql/#Out"><code>Out</code></a> should be used to return output parameters
  511       when supported by the driver.
  512     </p>
  513 
  514     <p><!-- CL 39031 -->
  515       <a href="/pkg/database/sql/#Rows.Scan"><code>Rows.Scan</code></a> can now scan user-defined string types.
  516       Previously the package supported scanning into numeric types like <code>type</code> <code>Int</code> <code>int64</code>. It now also supports
  517       scanning into string types like <code>type</code> <code>String</code> <code>string</code>.
  518     </p>
  519 
  520     <p><!-- CL 40694 -->
  521       The new <a href="/pkg/database/sql/#DB.Conn"><code>DB.Conn</code></a> method returns the new
  522       <a href="/pkg/database/sql/#Conn"><code>Conn</code></a> type representing an
  523       exclusive connection to the database from the connection pool. All queries run on
  524       a <a href="/pkg/database/sql/#Conn"><code>Conn</code></a> will use the same underlying
  525       connection until <a href="/pkg/database/sql/#Conn.Close"><code>Conn.Close</code></a> is called
  526       to return the connection to the connection pool.
  527     </p>
  528 
  529 </dl><!-- database/sql -->
  530 
  531 <dl id="encoding/asn1"><dt><a href="/pkg/encoding/asn1/">encoding/asn1</a></dt>
  532   <dd>
  533     <p><!-- CL 38660 -->
  534       The new
  535       <a href="/pkg/encoding/asn1/#NullBytes"><code>NullBytes</code></a>
  536       and
  537       <a href="/pkg/encoding/asn1/#NullRawValue"><code>NullRawValue</code></a>
  538       represent the ASN.1 NULL type.
  539     </p>
  540 
  541 </dl><!-- encoding/asn1 -->
  542 
  543 <dl id="encoding/base32"><dt><a href="/pkg/encoding/base32/">encoding/base32</a></dt>
  544   <dd>
  545     <p><!-- CL 38634 -->
  546       The new <a href="/pkg/encoding/base32/#Encoding.WithPadding">Encoding.WithPadding</a>
  547       method adds support for custom padding characters and disabling padding.
  548     </p>
  549 
  550 </dl><!-- encoding/base32 -->
  551 
  552 <dl id="encoding/csv"><dt><a href="/pkg/encoding/csv/">encoding/csv</a></dt>
  553   <dd>
  554     <p><!-- CL 41730 -->
  555       The new field
  556       <a href="/pkg/encoding/csv/#Reader.ReuseRecord"><code>Reader.ReuseRecord</code></a>
  557       controls whether calls to
  558       <a href="/pkg/encoding/csv/#Reader.Read"><code>Read</code></a>
  559       may return a slice sharing the backing array of the previous
  560       call's returned slice for improved performance.
  561     </p>
  562 
  563 </dl><!-- encoding/csv -->
  564 
  565 <dl id="fmt"><dt><a href="/pkg/fmt/">fmt</a></dt>
  566   <dd>
  567     <p><!-- CL 37051 -->
  568       The sharp flag ('<code>#</code>') is now supported when printing
  569       floating point and complex numbers. It will always print a
  570       decimal point
  571       for <code>%e</code>, <code>%E</code>, <code>%f</code>, <code>%F</code>, <code>%g</code>
  572       and <code>%G</code>; it will not remove trailing zeros
  573       for <code>%g</code> and <code>%G</code>.
  574     </p>
  575 
  576 </dl><!-- fmt -->
  577 
  578 <dl id="hash/fnv"><dt><a href="/pkg/hash/fnv/">hash/fnv</a></dt>
  579   <dd>
  580     <p><!-- CL 38356 -->
  581       The package now includes 128-bit FNV-1 and FNV-1a hash support with
  582       <a href="/pkg/hash/fnv/#New128"><code>New128</code></a> and
  583       <a href="/pkg/hash/fnv/#New128a"><code>New128a</code></a>, respectively.
  584     </p>
  585 
  586 </dl><!-- hash/fnv -->
  587 
  588 <dl id="html/template"><dt><a href="/pkg/html/template/">html/template</a></dt>
  589   <dd>
  590     <p><!-- CL 37880, CL 40936 -->
  591       The package now reports an error if a predefined escaper (one of
  592       "html", "urlquery" and "js") is found in a pipeline and does not match
  593       what the auto-escaper would have decided on its own.
  594       This avoids certain security or correctness issues.
  595       Now use of one of these escapers is always either a no-op or an error.
  596       (The no-op case eases migration from <a href="/pkg/text/template/">text/template</a>.)
  597     </p>
  598 
  599 </dl><!-- html/template -->
  600 
  601 <dl id="image"><dt><a href="/pkg/image/">image</a></dt>
  602   <dd>
  603     <p><!-- CL 36734 -->
  604       The <a href="/pkg/image/#Rectangle.Intersect"><code>Rectangle.Intersect</code></a>
  605       method now returns a zero <code>Rectangle</code> when called on
  606       adjacent but non-overlapping rectangles, as documented. In
  607       earlier releases it would incorrectly return an empty but
  608       non-zero <code>Rectangle</code>.
  609     </p>
  610 
  611 </dl><!-- image -->
  612 
  613 <dl id="image/color"><dt><a href="/pkg/image/color/">image/color</a></dt>
  614   <dd>
  615     <p><!-- CL 36732 -->
  616       The YCbCr to RGBA conversion formula has been tweaked to ensure
  617       that rounding adjustments span the complete [0, 0xffff] RGBA
  618       range.
  619     </p>
  620 
  621 </dl><!-- image/color -->
  622 
  623 <dl id="image/png"><dt><a href="/pkg/image/png/">image/png</a></dt>
  624   <dd>
  625     <p><!-- CL 34150 -->
  626       The new <a href="/pkg/image/png/#Encoder.BufferPool"><code>Encoder.BufferPool</code></a>
  627       field allows specifying an <a href="/pkg/image/png/#EncoderBufferPool"><code>EncoderBufferPool</code></a>,
  628       that will be used by the encoder to get temporary <code>EncoderBuffer</code>
  629       buffers when encoding a PNG image.
  630 
  631       The use of a <code>BufferPool</code> reduces the number of
  632       memory allocations performed while encoding multiple images.
  633     </p>
  634 
  635     <p><!-- CL 38271 -->
  636       The package now supports the decoding of transparent 8-bit
  637       grayscale ("Gray8") images.
  638     </p>
  639 
  640 </dl><!-- image/png -->
  641 
  642 <dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
  643   <dd>
  644     <p><!-- CL 36487 -->
  645       The new
  646       <a href="/pkg/math/big/#Int.IsInt64"><code>IsInt64</code></a>
  647       and
  648       <a href="/pkg/math/big/#Int.IsUint64"><code>IsUint64</code></a>
  649       methods report whether an <code>Int</code>
  650       may be represented as an <code>int64</code> or <code>uint64</code>
  651       value.
  652     </p>
  653 
  654 </dl><!-- math/big -->
  655 
  656 <dl id="mime/multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt>
  657   <dd>
  658     <p><!-- CL 39223 -->
  659       The new
  660       <a href="/pkg/mime/multipart/#FileHeader.Size"><code>FileHeader.Size</code></a>
  661       field describes the size of a file in a multipart message.
  662     </p>
  663 
  664 </dl><!-- mime/multipart -->
  665 
  666 <dl id="net"><dt><a href="/pkg/net/">net</a></dt>
  667   <dd>
  668     <p><!-- CL 32572 -->
  669       The new
  670       <a href="/pkg/net/#Resolver.StrictErrors"><code>Resolver.StrictErrors</code></a>
  671       provides control over how Go's built-in DNS resolver handles
  672       temporary errors during queries composed of multiple sub-queries,
  673       such as an A+AAAA address lookup.
  674     </p>
  675 
  676     <p><!-- CL 37260 -->
  677       The new
  678       <a href="/pkg/net/#Resolver.Dial"><code>Resolver.Dial</code></a>
  679       allows a <code>Resolver</code> to use a custom dial function.
  680     </p>
  681 
  682     <p><!-- CL 40510 -->
  683       <a href="/pkg/net/#JoinHostPort"><code>JoinHostPort</code></a> now only places an address in square brackets if the host contains a colon.
  684       In previous releases it would also wrap addresses in square brackets if they contained a percent ('<code>%</code>') sign.
  685     </p>
  686 
  687     <p><!-- CL 37913 -->
  688       The new methods
  689       <a href="/pkg/net/#TCPConn.SyscallConn"><code>TCPConn.SyscallConn</code></a>,
  690       <a href="/pkg/net/#IPConn.SyscallConn"><code>IPConn.SyscallConn</code></a>,
  691       <a href="/pkg/net/#UDPConn.SyscallConn"><code>UDPConn.SyscallConn</code></a>,
  692       and
  693       <a href="/pkg/net/#UnixConn.SyscallConn"><code>UnixConn.SyscallConn</code></a>
  694       provide access to the connections' underlying file descriptors.
  695     </p>
  696 
  697     <p><!-- 45088 -->
  698       It is now safe to call <a href="/pkg/net/#Dial"><code>Dial</code></a> with the address obtained from
  699       <code>(*TCPListener).String()</code> after creating the listener with
  700       <code><a href="/pkg/net/#Listen">Listen</a>("tcp", ":0")</code>.
  701       Previously it failed on some machines with half-configured IPv6 stacks.
  702     </p>
  703 
  704 </dl><!-- net -->
  705 
  706 <dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
  707   <dd>
  708 
  709     <p><!-- CL 37328 -->
  710       The <a href="/pkg/net/http/#Cookie.String"><code>Cookie.String</code></a> method, used for
  711       <code>Cookie</code> and <code>Set-Cookie</code> headers, now encloses values in double quotes
  712       if the value contains either a space or a comma.
  713     </p>
  714 
  715     <p>Server changes:</p>
  716     <ul>
  717       <li><!-- CL 38194 -->
  718         <a href="/pkg/net/http/#ServeMux"><code>ServeMux</code></a> now ignores ports in the host
  719         header when matching handlers. The host is matched unmodified for <code>CONNECT</code> requests.
  720       </li>
  721 
  722       <li><!-- CL 44074 -->
  723         The new <a href="/pkg/net/http/#Server.ServeTLS"><code>Server.ServeTLS</code></a> method wraps
  724         <a href="/pkg/net/http/#Server.Serve"><code>Server.Serve</code></a> with added TLS support.
  725       </li>
  726 
  727       <li><!-- CL 34727 -->
  728         <a href="/pkg/net/http/#Server.WriteTimeout"><code>Server.WriteTimeout</code></a>
  729         now applies to HTTP/2 connections and is enforced per-stream.
  730       </li>
  731 
  732       <li><!-- CL 43231 -->
  733         HTTP/2 now uses the priority write scheduler by default.
  734         Frames are scheduled by following HTTP/2 priorities as described in
  735         <a href="https://tools.ietf.org/html/rfc7540#section-5.3">RFC 7540 Section 5.3</a>.
  736       </li>
  737 
  738       <li><!-- CL 36483 -->
  739         The HTTP handler returned by <a href="/pkg/net/http/#StripPrefix"><code>StripPrefix</code></a>
  740         now calls its provided handler with a modified clone of the original <code>*http.Request</code>.
  741         Any code storing per-request state in maps keyed by <code>*http.Request</code> should
  742         use
  743         <a href="/pkg/net/http/#Request.Context"><code>Request.Context</code></a>,
  744         <a href="/pkg/net/http/#Request.WithContext"><code>Request.WithContext</code></a>,
  745         and
  746         <a href="/pkg/context/#WithValue"><code>context.WithValue</code></a> instead.
  747       </li>
  748 
  749       <li><!-- CL 35490 -->
  750         <a href="/pkg/net/http/#LocalAddrContextKey"><code>LocalAddrContextKey</code></a> now contains
  751         the connection's actual network address instead of the interface address used by the listener.
  752       </li>
  753     </ul>
  754 
  755     <p>Client &amp; Transport changes:</p>
  756     <ul>
  757       <li><!-- CL 35488 -->
  758         The <a href="/pkg/net/http/#Transport"><code>Transport</code></a>
  759         now supports making requests via SOCKS5 proxy when the URL returned by
  760         <a href="/pkg/net/http/#Transport.Proxy"><code>Transport.Proxy</code></a>
  761         has the scheme <code>socks5</code>.
  762       </li>
  763     </ul>
  764 
  765 </dl><!-- net/http -->
  766 
  767 <dl id="net/http/fcgi"><dt><a href="/pkg/net/http/fcgi/">net/http/fcgi</a></dt>
  768   <dd>
  769     <p><!-- CL 40012 -->
  770       The new
  771       <a href="/pkg/net/http/fcgi/#ProcessEnv"><code>ProcessEnv</code></a>
  772       function returns FastCGI environment variables associated with an HTTP request
  773       for which there are no appropriate
  774       <a href="/pkg/net/http/#Request"><code>http.Request</code></a>
  775       fields, such as <code>REMOTE_USER</code>.
  776     </p>
  777 
  778 </dl><!-- net/http/fcgi -->
  779 
  780 <dl id="net/http/httptest"><dt><a href="/pkg/net/http/httptest/">net/http/httptest</a></dt>
  781   <dd>
  782     <p><!-- CL 34639 -->
  783       The new
  784       <a href="/pkg/net/http/httptest/#Server.Client"><code>Server.Client</code></a>
  785       method returns an HTTP client configured for making requests to the test server.
  786     </p>
  787 
  788     <p>
  789       The new
  790       <a href="/pkg/net/http/httptest/#Server.Certificate"><code>Server.Certificate</code></a>
  791       method returns the test server's TLS certificate, if any.
  792     </p>
  793 
  794 </dl><!-- net/http/httptest -->
  795 
  796 <dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
  797   <dd>
  798     <p><!-- CL 43712 -->
  799       The <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a>
  800       now proxies all HTTP/2 response trailers, even those not declared in the initial response
  801       header. Such undeclared trailers are used by the gRPC protocol.
  802     </p>
  803 
  804 </dl><!-- net/http/httputil -->
  805 
  806 <dl id="os"><dt><a href="/pkg/os/">os</a></dt>
  807   <dd>
  808     <p><!-- CL 36800 -->
  809       The <code>os</code> package now uses the internal runtime poller
  810       for file I/O.
  811       This reduces the number of threads required for read/write
  812       operations on pipes, and it eliminates races when one goroutine
  813       closes a file while another is using the file for I/O.
  814     </p>
  815 
  816   <dd>
  817     <p><!-- CL 37915 -->
  818       On Windows,
  819       <a href="/pkg/os/#Args"><code>Args</code></a>
  820       is now populated without <code>shell32.dll</code>, improving process start-up time by 1-7 ms.
  821       </p>
  822 
  823 </dl><!-- os -->
  824 
  825 <dl id="os/exec"><dt><a href="/pkg/os/exec/">os/exec</a></dt>
  826   <dd>
  827     <p><!-- CL 37586 -->
  828       The <code>os/exec</code> package now prevents child processes from being created with
  829       any duplicate environment variables.
  830       If <a href="/pkg/os/exec/#Cmd.Env"><code>Cmd.Env</code></a>
  831       contains duplicate environment keys, only the last
  832       value in the slice for each duplicate key is used.
  833     </p>
  834 
  835 </dl><!-- os/exec -->
  836 
  837 <dl id="os/user"><dt><a href="/pkg/os/user/">os/user</a></dt>
  838   <dd>
  839     <p><!-- CL 37664 -->
  840       <a href="/pkg/os/user/#Lookup"><code>Lookup</code></a> and
  841       <a href="/pkg/os/user/#LookupId"><code>LookupId</code></a> now
  842       work on Unix systems when <code>CGO_ENABLED=0</code> by reading
  843       the <code>/etc/passwd</code> file.
  844     </p>
  845 
  846     <p><!-- CL 33713 -->
  847       <a href="/pkg/os/user/#LookupGroup"><code>LookupGroup</code></a> and
  848       <a href="/pkg/os/user/#LookupGroupId"><code>LookupGroupId</code></a> now
  849       work on Unix systems when <code>CGO_ENABLED=0</code> by reading
  850       the <code>/etc/group</code> file.
  851     </p>
  852 
  853 </dl><!-- os/user -->
  854 
  855 <dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
  856   <dd>
  857     <p><!-- CL 38335 -->
  858       The new
  859       <a href="/pkg/reflect/#MakeMapWithSize"><code>MakeMapWithSize</code></a>
  860       function creates a map with a capacity hint.
  861     </p>
  862 
  863 </dl><!-- reflect -->
  864 
  865 <dl id="pkg-runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
  866   <dd>
  867     <p><!-- CL 37233, CL 37726 -->
  868       Tracebacks generated by the runtime and recorded in profiles are
  869       now accurate in the presence of inlining.
  870       To retrieve tracebacks programmatically, applications should use
  871       <a href="/pkg/runtime/#CallersFrames"><code>runtime.CallersFrames</code></a>
  872       rather than directly iterating over the results of
  873       <a href="/pkg/runtime/#Callers"><code>runtime.Callers</code></a>.
  874     </p>
  875 
  876     <p><!-- CL 38403 -->
  877       On Windows, Go no longer forces the system timer to run at high
  878       resolution when the program is idle.
  879       This should reduce the impact of Go programs on battery life.
  880     </p>
  881 
  882     <p><!-- CL 29341 -->
  883       On FreeBSD, <code>GOMAXPROCS</code> and
  884       <a href="/pkg/runtime/#NumCPU"><code>runtime.NumCPU</code></a>
  885       are now based on the process' CPU mask, rather than the total
  886       number of CPUs.
  887     </p>
  888 
  889     <p><!-- CL 43641 -->
  890       The runtime has preliminary support for Android O.
  891     </p>
  892 
  893 </dl><!-- runtime -->
  894 
  895 <dl id="runtime/debug"><dt><a href="/pkg/runtime/debug/">runtime/debug</a></dt>
  896   <dd>
  897     <p><!-- CL 34013 -->
  898       Calling
  899       <a href="/pkg/runtime/debug/#SetGCPercent"><code>SetGCPercent</code></a>
  900       with a negative value no longer runs an immediate garbage collection.
  901     </p>
  902 
  903 </dl><!-- runtime/debug -->
  904 
  905 <dl id="runtime/trace"><dt><a href="/pkg/runtime/trace/">runtime/trace</a></dt>
  906   <dd>
  907     <p><!-- CL 36015 -->
  908       The execution trace now displays mark assist events, which
  909       indicate when an application goroutine is forced to assist
  910       garbage collection because it is allocating too quickly.
  911     </p>
  912 
  913     <p><!-- CL 40810 -->
  914       "Sweep" events now encompass the entire process of finding free
  915       space for an allocation, rather than recording each individual
  916       span that is swept.
  917       This reduces allocation latency when tracing allocation-heavy
  918       programs.
  919       The sweep event shows how many bytes were swept and how many
  920       were reclaimed.
  921     </p>
  922 
  923 </dl><!-- runtime/trace -->
  924 
  925 <dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
  926   <dd>
  927     <p><!-- CL 34310 -->
  928       <a href="/pkg/sync/#Mutex"><code>Mutex</code></a> is now more fair.
  929     </p>
  930 
  931 </dl><!-- sync -->
  932 
  933 <dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
  934   <dd>
  935     <p><!-- CL 36697 -->
  936       The new field
  937       <a href="/pkg/syscall/#Credential.NoSetGroups"><code>Credential.NoSetGroups</code></a>
  938       controls whether Unix systems make a <code>setgroups</code> system call
  939       to set supplementary groups when starting a new process.
  940     </p>
  941 
  942     <p><!-- CL 43512 -->
  943       The new field
  944       <a href="/pkg/syscall/#SysProcAttr.AmbientCaps"><code>SysProcAttr.AmbientCaps</code></a>
  945       allows setting ambient capabilities on Linux 4.3+ when creating
  946       a new process.
  947     </p>
  948 
  949     <p><!-- CL 37439 -->
  950       On 64-bit x86 Linux, process creation latency has been optimized with
  951       use of <code>CLONE_VFORK</code> and <code>CLONE_VM</code>.
  952     </p>
  953 
  954     <p><!-- CL 37913 -->
  955       The new
  956       <a href="/pkg/syscall/#Conn"><code>Conn</code></a>
  957       interface describes some types in the
  958       <a href="/pkg/net/"><code>net</code></a>
  959       package that can provide access to their underlying file descriptor
  960       using the new
  961       <a href="/pkg/syscall/#RawConn"><code>RawConn</code></a>
  962       interface.
  963     </p>
  964 
  965 </dl><!-- syscall -->
  966 
  967 
  968 <dl id="testing/quick"><dt><a href="/pkg/testing/quick/">testing/quick</a></dt>
  969   <dd>
  970     <p><!-- CL 39152 -->
  971       The package now chooses values in the full range when
  972       generating <code>int64</code> and <code>uint64</code> random
  973       numbers; in earlier releases generated values were always
  974       limited to the [-2<sup>62</sup>, 2<sup>62</sup>) range.
  975     </p>
  976 
  977     <p>
  978       In previous releases, using a nil
  979       <a href="/pkg/testing/quick/#Config.Rand"><code>Config.Rand</code></a>
  980       value caused a fixed deterministic random number generator to be used.
  981       It now uses a random number generator seeded with the current time.
  982       For the old behavior, set <code>Config.Rand</code> to <code>rand.New(rand.NewSource(0))</code>.
  983     </p>
  984 
  985 </dl><!-- testing/quick -->
  986 
  987 <dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt>
  988   <dd>
  989     <p><!-- CL 38420 -->
  990       The handling of empty blocks, which was broken by a Go 1.8
  991       change that made the result dependent on the order of templates,
  992       has been fixed, restoring the old Go 1.7 behavior.
  993     </p>
  994 
  995 </dl><!-- text/template -->
  996 
  997 <dl id="time"><dt><a href="/pkg/time/">time</a></dt>
  998   <dd>
  999     <p><!-- CL 36615 -->
 1000       The new methods
 1001       <a href="/pkg/time/#Duration.Round"><code>Duration.Round</code></a>
 1002       and
 1003       <a href="/pkg/time/#Duration.Truncate"><code>Duration.Truncate</code></a>
 1004       handle rounding and truncating durations to multiples of a given duration.
 1005     </p>
 1006 
 1007     <p><!-- CL 35710 -->
 1008       Retrieving the time and sleeping now work correctly under Wine.
 1009     </p>
 1010 
 1011     <p>
 1012       If a <code>Time</code> value has a monotonic clock reading, its
 1013       string representation (as returned by <code>String</code>) now includes a
 1014       final field <code>"m=±value"</code>, where <code>value</code> is the
 1015       monotonic clock reading formatted as a decimal number of seconds.
 1016     </p>
 1017 
 1018     <p><!-- CL 44832 -->
 1019       The included <code>tzdata</code> timezone database has been
 1020       updated to version 2017b. As always, it is only used if the
 1021       system does not already have the database available.
 1022     </p>
 1023 
 1024 </dl><!-- time -->