github.com/letsencrypt/go@v0.0.0-20160714163537-4054769a31f6/doc/go1.7.html (about)

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