go1.11.html 29.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
<!--{
	"Title": "Go 1.11 Release Notes",
	"Path":  "/doc/go1.11",
	"Template": true
}-->

<!--
NOTE: In this document and others in this directory, the convention is to
set fixed-width phrases with non-fixed-width spaces, as in
<code>hello</code> <code>world</code>.
Do not send CLs removing the interior tags from such phrases.
-->

<style>
  ul li { margin: 0.5em 0; }
</style>

<h2 id="introduction">DRAFT RELEASE NOTES - Introduction to Go 1.11</h2>

<p>
  <strong>
    Go 1.11 is not yet released. These are work-in-progress
    release notes. Go 1.11 is expected to be released in August 2018.
  </strong>
</p>

<p>
  The latest Go release, version 1.11, arrives six months after <a href="go1.10">Go 1.10</a>.
  Most of its changes are in the implementation of the toolchain, runtime, and libraries.
  As always, the release maintains the Go 1 <a href="/doc/go1compat.html">promise of compatibility</a>.
  We expect almost all Go programs to continue to compile and run as before.
</p>

<h2 id="language">Changes to the language</h2>

<p>
  There are no changes to the language specification.
</p>

<h2 id="ports">Ports</h2>

42
<p> <!-- CL 94255, CL 115038, etc -->
43 44 45 46 47
  As <a href="go1.10#ports">announced in the Go 1.10 release notes</a>, Go 1.11 now requires
  OpenBSD 6.2 or later, macOS 10.10 Yosemite or later, or Windows 7 or later;
  Support for previous versions of these operating systems has been removed.
</p>

48 49 50 51 52
<p> <!-- CL 121657 -->
  Go 1.11 supports the upcoming OpenBSD 6.4 release. Due to changes in
  the OpenBSD kernel, older versions of Go will not work on OpenBSD 6.4.
</p>

53 54 55 56 57
<p>
  There are <a href="https://golang.org/issue/25206">known issues</a> with NetBSD on i386 hardware.
</p>

<p><!-- CL 107935 -->
58 59 60
  The race detector is now supported on <code>linux/ppc64le</code>
  and, to a lesser extent, on <code>netbsd/amd64</code>. The NetBSD race detector support
  has <a href="https://golang.org/issue/26403">known issues</a>.
61 62
</p>

63 64 65 66
<p><!-- CL 109255 -->
  The memory sanitizer (<code>-msan</code>) is now supported on <code>linux/arm64</code>.
</p>

67 68 69 70 71 72 73 74 75 76 77 78 79 80
<p><!-- CL 93875 -->
  The build modes <code>c-shared</code> and <code>c-archive</code> are now supported on
  <code>freebsd/amd64</code>.
</p>

<p id="mips"><!-- CL 108475 -->
  On 64-bit MIPS systems, the new environment variable settings
  <code>GOMIPS64=hardfloat</code> (the default) and
  <code>GOMIPS64=softfloat</code> select whether to use
  hardware instructions or software emulation for floating-point computations.
  For 32-bit systems, the environment variable is still <code>GOMIPS</code>,
  as <a href="go1.10#mips">added in Go 1.10</a>.
</p>

81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
<p><!-- CL 107475 -->
  On soft-float ARM systems (<code>GOARM=5</code>), Go now uses a more
  efficient software floating point interface. This is transparent to
  Go code, but ARM assembly that uses floating-point instructions not
  guarded on GOARM will break and must be ported to
  the <a href="https://golang.org/cl/107475">new interface</a>.
</p>

<p><!-- CL 94076 -->
  Go 1.11 on ARMv7 no longer requires a Linux kernel configured
  with <code>KUSER_HELPERS</code>. This setting is enabled in default
  kernel configurations, but is sometimes disabled in stripped-down
  configurations.
</p>

96 97 98 99
<h3 id="wasm">WebAssembly</h3>
<p>
  Go 1.11 adds an experimental port to WebAssembly (<code>js/wasm</code>).
</p>
100 101 102 103 104 105 106 107 108 109 110
<p>
  Go programs currently compile to one WebAssembly module that
  includes the Go runtime for goroutine scheduling, garbage
  collection, maps, etc.
  As a result, the resulting size is at minimum around
  2 MB, or 500 KB compressed. Go programs can call into JavaScript
  using the new experimental
  <a href="/pkg/syscall/js/"><code>syscall/js</code></a> package.
  Binary size and interop with other languages has not yet been a
  priority but may be addressed in future releases.
</p>
111 112 113 114 115 116
<p>
  As a result of the addition of the new <code>GOOS</code> value
  "<code>js</code>" and <code>GOARCH</code> value "<code>wasm</code>",
  Go files named <code>*_js.go</code> or <code>*_wasm.go</code> will
  now be <a href="/pkg/go/build/#hdr-Build_Constraints">ignored by Go
  tools</a> except when those GOOS/GOARCH values are being used.
117
  If you have existing filenames matching those patterns, you will need to rename them.
118
</p>
119

120 121 122 123 124 125 126 127 128 129 130
<h3 id="riscv">RISC-V GOARCH values reserved</h3>
<p><!-- CL 106256 -->
  The main Go compiler does not yet support the RISC-V architecture
  but we've reserved the <code>GOARCH</code> values
  "<code>riscv</code>" and "<code>riscv64</code>", as used by Gccgo,
  which does support RISC-V. This means that Go files
  named <code>*_riscv.go</code> will now also
  be <a href="/pkg/go/build/#hdr-Build_Constraints">ignored by Go
  tools</a> except when those GOOS/GOARCH values are being used.
</p>

131 132 133
<h2 id="tools">Tools</h2>

<h3 id="modules">Modules, package versioning, and dependency management</h3>
134
<p>
135
  Go 1.11 adds preliminary support for a <a href="/cmd/go/#hdr-Modules__module_versions__and_more">new concept called “modules,”</a>
136 137 138 139 140
  an alternative to GOPATH with integrated support for versioning and
  package distribution.
  Using modules, developers are no longer confined to working inside GOPATH,
  version dependency information is explicit yet lightweight,
  and builds are more reliable and reproducible.
141 142
</p>

143
<p>
144 145 146 147 148 149 150 151 152 153
  Module support is considered experimental.
  Details are likely to change in response to feedback from Go 1.11 users,
  and we have more tools planned.
  Although the details of module support may change, projects that convert
  to modules using Go 1.11 will continue to work with Go 1.12 and later.
  If you encounter bugs using modules,
  please <a href="https://golang.org/issue/new">file issues</a>
  so we can fix them.
</p>

154 155 156 157 158 159 160 161 162 163 164 165
<h3 id="importpath">Import path restriction</h3>

<p>
  Because Go module support assigns special meaning to the
  <code>@</code> symbol in command line operations,
  the <code>go</code> command now disallows the use of
  import paths containing <code>@</code> symbols.
  Such import paths were never allowed by <code>go</code> <code>get</code>,
  so this restriction can only affect users building
  custom GOPATH trees by other means.
</p>

Austin Clements's avatar
Austin Clements committed
166
<h3 id="gopackages">Package loading</h3>
167 168 169 170 171

<p>
  TODO: Note about go/build versus golang.org/x/tools/go/packages.
</p>

Austin Clements's avatar
Austin Clements committed
172
<h3 id="gocache">Build cache requirement</h3>
173 174 175 176 177 178 179 180 181 182 183 184

<p>
  Go 1.11 will be the last release to support setting the environment
  variable <code>GOCACHE=off</code> to disable the
  <a href="/cmd/go/#hdr-Build_and_test_caching">build cache</a>,
  introduced in Go 1.10.
  Starting in Go 1.12, the build cache will be required,
  as a step toward eliminating <code>$GOPATH/pkg</code>.
  The module and package loading support described above
  already require that the build cache be enabled.
  If you have disabled the build cache to avoid problems you encountered,
  please <a href="https://golang.org/issue/new">file an issue</a> to let us know about them.
185 186
</p>

187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
<h3 id="compiler">Compiler toolchain</h3>

<p><!-- CL 109918 -->
  More functions are now eligible for inlining by default, including
  functions that call <code>panic</code>.
</p>

<p><!-- CL 97375 -->
  The compiler toolchain now supports column information
  in <a href="/cmd/compile/#hdr-Compiler_Directives">line
  directives</a>.
</p>

<p><!-- CL 106797 -->
  A new package export data format has been introduced.
  This should be transparent to end users, except for speeding up
  build times for large Go projects.
  If it does cause problems, it can be turned off again by
  passing <code>-gcflags=all=-iexport=false</code> to
  the <code>go</code> tool when building a binary.
</p>

<p><!-- CL 100459 -->
  The compiler now rejects unused variables declared in a type switch
  guard, such as <code>x</code> in the following example:
</p>
<pre>
func f(v interface{}) {
	switch x := v.(type) {
	}
}
</pre>
<p>
  This was already rejected by both <code>gccgo</code>
  and <a href="/pkg/go/types/">go/types</a>.
</p>

<h3 id="assembler">Assembler</h3>

<p><!-- CL 113315 -->
  The assembler for <code>amd64</code> now accepts AVX512 instructions.
</p>

<h3 id="debugging">Debugging</h3>

<p><!-- CL 100738, CL 93664 -->
  The compiler now produces significantly more accurate debug
  information for optimized binaries, including variable location
  information, line numbers, and breakpoint locations.

  This should make it possible to debug binaries
  compiled <em>without</em> <code>-N</code>&nbsp;<code>-l</code>.

  There are still limitations to the quality of the debug information,
  some of which are fundamental, and some of which will continue to
  improve with future releases.
</p>

<p><!-- CL 118276 -->
  DWARF sections are now compressed by default because of the expanded
  and more accurate debug information produced by the compiler.

  This is transparent to most ELF tools (such as debuggers on Linux
  and *BSD) and is supported by the Delve debugger on all platforms,
  but has limited support in the native tools on macOS and Windows.

  To disable DWARF compression,
  pass <code>-ldflags=-compressdwarf=false</code> to
  the <code>go</code> tool when building a binary.
</p>

<p><!-- CL 109699 -->
  Go 1.11 adds experimental support for calling Go functions from
  within a debugger.

  This is useful, for example, to call <code>String</code> methods
  when paused at a breakpoint.
  <!-- TODO(austin): Make sure methods calls are actually supported by Delve -->

  This is currently only supported by Delve.
</p>

269 270 271 272 273
<h2 id="tools">Tools</h2>

<h3 id="test">Test</h3>

<p>
Austin Clements's avatar
Austin Clements committed
274
  Since Go 1.10, the <code>go</code>&nbsp;<code>test</code> command runs
275 276 277 278 279 280
  <code>go</code>&nbsp;<code>vet</code> on the package being tested,
  to identify problems before running the test. Since <code>vet</code>
  typechecks the code with <a href="/pkg/go/types/">go/types</a>
  before running, tests that do not typecheck will now fail.

  In particular, tests that contain an unused variable inside a
281
  closure compiled with Go 1.10, because the Go compiler incorrectly
282 283 284 285 286
  accepted them (<a href="https://golang.org/issues/3059">Issue #3059</a>),
  but will now fail, since <code>go/types</code> correctly reports an
  "unused variable" error in this case.
</p>

287 288 289 290 291 292
<p><!-- CL 102696 -->
  The <code>-memprofile</code> flag
  to <code>go</code>&nbsp;<code>test</code> now defaults to the
  "allocs" profile, which records the total bytes allocated since the
  test began (including garbage-collected bytes).
</p>
293 294 295 296 297 298 299 300 301 302

<h3 id="vet">Vet</h3>

<p><!-- CL 108555 -->
  The <a href="/cmd/vet/"><code>go</code>&nbsp;<code>vet</code></a>
  command now reports a fatal error when the package under analysis
  does not typecheck. Previously, a type checking error simply caused
  a warning to be printed, and <code>vet</code> to exit with status 1.
</p>

303 304 305 306 307 308 309 310 311 312
<h2 id="runtime">Runtime</h2>

<p><!-- CL 85887 -->
  The runtime now uses a sparse heap layout so there is no longer a
  limit to the size of the Go heap (previously, the limit was 512GiB).
  This also fixes rare "address space conflict" failures in mixed Go/C
  binaries or binaries compiled with <code>-race</code>.
</p>

<p><!-- CL 108679 -->
313
  On macOS and iOS, the runtime now uses <code>libSystem.so</code> instead of
314
  calling the kernel directly. This should make Go binaries more
315
  compatible with future versions of macOS and iOS.
316 317 318
  The <a href="/pkg/syscall">syscall</a> package still makes direct
  system calls; fixing this is planned for a future release.
</p>
319

320 321 322 323 324 325 326 327 328 329 330 331 332 333
<h2 id="library">Core library</h2>

<p>
  All of the changes to the standard library are minor.
</p>

<h3 id="minor_library_changes">Minor changes to the library</h3>

<p>
  As always, there are various minor changes and updates to the library,
  made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
  in mind.
</p>

334
<!-- CL 115095: https://golang.org/cl/115095: yes (`go test pkg` now always builds pkg even if there are no test files): cmd/go: output coverage report even if there are no test files -->
335 336 337 338 339 340 341
<!-- CL 110395: https://golang.org/cl/110395: cmd/go, cmd/compile: use Windows response files to avoid arg length limits -->
<!-- CL 112436: https://golang.org/cl/112436: cmd/pprof: add readline support similar to upstream -->


<dl id="crypto"><dt><a href="/pkg/crypto/">crypto</a></dt>
  <dd>
    <p><!-- CL 64451 -->
342
      Certain crypto operations, including
Filippo Valsorda's avatar
Filippo Valsorda committed
343 344 345
      <a href="/pkg/crypto/ecdsa/#Sign"><code>ecdsa.Sign</code></a>,
      <a href="/pkg/crypto/rsa/#EncryptPKCS1v15"><code>rsa.EncryptPKCS1v15</code></a> and
      <a href="/pkg/crypto/rsa/#GenerateKey"><code>rsa.GenerateKey</code></a>,
346
      now randomly read an extra byte of randomness to ensure tests don't rely on internal behavior.
347 348 349 350 351 352 353
    </p>

</dl><!-- crypto -->

<dl id="crypto/cipher"><dt><a href="/pkg/crypto/cipher/">crypto/cipher</a></dt>
  <dd>
    <p><!-- CL 48510, CL 116435 -->
Filippo Valsorda's avatar
Filippo Valsorda committed
354
      The new function <a href="/pkg/crypto/cipher/#NewGCMWithTagSize"><code>NewGCMWithTagSize</code></a>
355
      implements Galois Counter Mode with non-standard tag lengths for compatibility with existing cryptosystems.
356 357 358 359 360 361 362
    </p>

</dl><!-- crypto/cipher -->

<dl id="crypto/rsa"><dt><a href="/pkg/crypto/rsa/">crypto/rsa</a></dt>
  <dd>
    <p><!-- CL 103876 -->
363 364 365
      <a href="/pkg/crypto/rsa/#PublicKey"><code>PublicKey</code></a> now implements a
      <a href="/pkg/crypto/rsa/#PublicKey.Size"><code>Size</code></a> method that
      returns the modulus size in bytes.
366 367 368 369
    </p>

</dl><!-- crypto/rsa -->

370 371 372 373 374 375 376 377 378 379 380 381 382
<dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
  <dd>
    <p><!-- CL 85115 -->
      <a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a>'s new
      <code>ExportKeyingMaterial</code> field allows exporting keying material bound to the
      connection according to RFC 5705.
    </p>

</dl><!-- crypto/tls -->

<dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
  <dd>
    <p><!-- CL 123355, CL 123695 -->
Filippo Valsorda's avatar
Filippo Valsorda committed
383
      The deprecated, legacy behavior of treating the <code>CommonName</code> field as
384 385
      a hostname when no Subject Alternative Names are present is now disabled when the CN is not a
      valid hostname.
Filippo Valsorda's avatar
Filippo Valsorda committed
386
      The <code>CommonName</code> can be completely ignored by adding the experimental value
387 388 389 390 391 392 393
      <code>x509ignoreCN=1</code> to the <code>GODEBUG</code> environment variable.
      When the CN is ignored, certificates without SANs validate under chains with name constraints
      instead of returning <code>NameConstraintsWithoutSANs</code>.
    </p>

    <p><!-- CL 113475 -->
      Extended key usage restrictions are again checked only if they appear in the <code>KeyUsages</code>
Filippo Valsorda's avatar
Filippo Valsorda committed
394 395
      field of <a href="/pkg/crypto/x509/#VerifyOptions"><code>VerifyOptions</code></a>, instead of always being checked.
      This matches the behavior of Go 1.9 and earlier.
396 397 398 399 400 401 402 403 404
    </p>

    <p><!-- CL 102699 -->
      The value returned by <a href="/pkg/crypto/x509/#SystemCertPool"><code>SystemCertPool</code></a>
      is now cached and might not reflect system changes between invocations.
    </p>

</dl><!-- crypto/x509 -->

405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436
<dl id="debug/elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt>
  <dd>
    <p><!-- CL 112115 -->
      TODO: <a href="https://golang.org/cl/112115">https://golang.org/cl/112115</a>: add machine and OSABI constants
    </p>

</dl><!-- debug/elf -->

<dl id="encoding/asn1"><dt><a href="/pkg/encoding/asn1/">encoding/asn1</a></dt>
  <dd>
    <p><!-- CL 110561 -->
      TODO: <a href="https://golang.org/cl/110561">https://golang.org/cl/110561</a>: allow Marshaling and Unmarshaling private tag class
    </p>

</dl><!-- encoding/asn1 -->

<dl id="encoding/base32"><dt><a href="/pkg/encoding/base32/">encoding/base32</a></dt>
  <dd>
    <p><!-- CL 112516 -->
      TODO: <a href="https://golang.org/cl/112516">https://golang.org/cl/112516</a>: handle surplus padding consistently
    </p>

</dl><!-- encoding/base32 -->

<dl id="encoding/csv"><dt><a href="/pkg/encoding/csv/">encoding/csv</a></dt>
  <dd>
    <p><!-- CL 99696 -->
      TODO: <a href="https://golang.org/cl/99696">https://golang.org/cl/99696</a>: disallow quote for use as Comma
    </p>

</dl><!-- encoding/csv -->

437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
<dl id="go/scanner"><dt><a href="/pkg/go/scanner/">go/scanner</a></dt>
  <dd>
    <p><!-- CL 100235 -->
      TODO: <a href="https://golang.org/cl/100235">https://golang.org/cl/100235</a>: report errors for incorrect line directives
    </p>

</dl><!-- go/scanner -->

<dl id="html/template"><dt><a href="/pkg/html/template/">html/template</a></dt>
  <dd>
    <p><!-- CL 121815 -->
      TODO: <a href="https://golang.org/cl/121815">https://golang.org/cl/121815</a>: ignore untyped nil arguments to default escapers
    </p>

</dl><!-- html/template -->

453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474
<dl id="image/gif"><dt><a href="/pkg/image/gif/">image/gif</a></dt>
  <dd>
    <p><!-- CL 93076 -->
      TODO: <a href="https://golang.org/cl/93076">https://golang.org/cl/93076</a>: support non-looping animated gifs (LoopCount=-1)
    </p>

</dl><!-- image/gif -->

<dl id="io/ioutil"><dt><a href="/pkg/io/ioutil/">io/ioutil</a></dt>
  <dd>
    <p><!-- CL 105675 -->
      TODO: <a href="https://golang.org/cl/105675">https://golang.org/cl/105675</a>: change TempFile prefix to a pattern
    </p>

</dl><!-- io/ioutil -->

<dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
  <dd>
    <p><!-- CL 74851 -->
      TODO: <a href="https://golang.org/cl/74851">https://golang.org/cl/74851</a>: speed-up addMulVVW on amd64
    </p>

475 476 477 478
    <p><!-- CL 108996 -->
      <a href="/pkg/math/bin/#Int.ModInverse"><code>ModInverse</code></a> now returns nil when g and n are not relatively prime. The result was previously undefined.
    </p>

479 480
</dl><!-- math/big -->

481 482 483 484 485 486 487 488 489 490 491
<dl id="mime/multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt>
  <dd>
    <p><!-- CL 121055 -->
      TODO: <a href="https://golang.org/cl/121055">https://golang.org/cl/121055</a>: restore 1.9 handling of missing/empty form-data file name
    </p>

</dl><!-- mime/multipart -->

<dl id="mime/quotedprintable"><dt><a href="/pkg/mime/quotedprintable/">mime/quotedprintable</a></dt>
  <dd>
    <p><!-- CL 121095 -->
492 493
      To support invalid input found in the wild, the package now
      permits non-ASCII bytes but does not validate their encoding.
494 495 496 497
    </p>

</dl><!-- mime/quotedprintable -->

498 499 500
<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
  <dd>
    <p><!-- CL 72810 -->
501 502 503
      The new <a href="/pkg/net/#ListenConfig"><code>ListenConfig</code></a> type and the new
      <a href="/pkg/net/#Dialer.Control"><code>Dialer.Control</code></a> field permit
      setting socket options before accepting and creating connections, respectively.
504 505 506 507 508 509 510
    </p>

    <p><!-- CL 76391 -->
      TODO: <a href="https://golang.org/cl/76391">https://golang.org/cl/76391</a>: implement (*syscall.RawConn).Read/Write on Windows
    </p>

    <p><!-- CL 107715 -->
511 512 513 514 515
      The <code>net</code> package now automatically uses the
      <a href="http://man7.org/linux/man-pages/man2/splice.2.html"><code>splice</code> system call</a>
      on Linux when calling copying data between TCP connections in
      <a href="/pkg/net/#TCPConn.ReadFrom"><code>TCPConn.ReadFrom</code></a>, as called by
      <a href="/pkg/io/#Copy"><code>io.Copy</code>. The result is faster, more efficient TCP proxying.
516 517 518 519 520 521 522 523 524 525
    </p>

    <p><!-- CL 108297 -->
      TODO: <a href="https://golang.org/cl/108297">https://golang.org/cl/108297</a>: calling File leaves the socket in nonblocking mode
    </p>

</dl><!-- net -->

<dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
  <dd>
526
    <p><!-- CL 71272 -->
527 528 529 530
      The <a href="/pkg/net/http/#Transport"><code>Transport</code></a> has a
      new <a href="/pkg/net/http/#Transport.MaxConnsPerHost"><code>MaxConnsPerHost</code></a>
      option that permits limiting the maximum number of connections
      per host.
531 532 533
    </p>

    <p><!-- CL 79919 -->
534 535 536 537 538 539 540
      The <a href="/pkg/net/http/#Cookie"><code>Cookie</code></a> type has a new
      The <a href="/pkg/net/http/#Cookie.SameSite"><code>SameSite</code></a> field
      (of new type also named
      <a href="/pkg/net/http/#SameSite"><code>SameSite</code></a>) to represent the new cookie attribute recently supported by most browsers.
      The <code>net/http</code>'s <code>Transport</code> does not use the <code>SameSite</code>
      attribute itself, but the package supports parsing and serializing the
      attribute for browsers to use.
541 542 543
    </p>

    <p><!-- CL 81778 -->
544 545 546 547 548 549
      It is no longer allowed to reuse a <a href="/pkg/net/http/#Server"><code>Server</code></a>
      after a call to
      <a href="/pkg/net/http/#Server.Shutdown"><code>Shutdown</code></a> or
      <a href="/pkg/net/http/#Server.Close"><code>Close</code></a>. It was never officially supported
      in the past and had often surprising behavior. Now, all future calls to the server's <code>Serve</code>
      methods will return errors after a shutdown or close.
550 551
    </p>

552
    <p><!-- CL 89275 -->
553 554
      The HTTP server will no longer automatically set the Content-Type if a
      <code>Handler</code> sets the "<code>X-Content-Type-Options</code>" header to "<code>nosniff</code>".
555 556 557
    </p>

    <p><!-- CL 93296 -->
558
      The constant <code>StatusMisdirectedRequest</code> is now defined for HTTP status code 421.
559 560
    </p>

561
    <p><!-- CL 123875 -->
562 563 564 565 566
      The HTTP server will no longer cancel contexts or send on
      <a href="/pkg/net/http/#CloseNotifier"><code>CloseNotifier</code></a>
      channels upon receiving pipelined HTTP/1.1 requests. Browsers do
      not use HTTP pipelining, but some clients (such as
      Debian's <code>apt</code>) may be configured to do so.
567 568
    </p>

569 570 571 572 573 574
    <p><!-- CL 115255 -->
      <a href="/pkg/net/http/#ProxyFromEnvironment"><code>ProxyFromEnvironment</code></a>, which is used by the
      <a href="/pkg/net/http/#DefaultTransport"><code>DefaultTransport</code></a>, now
      supports CIDR notation and ports in the <code>NO_PROXY</code> environment variable.
    </p>

575 576
</dl><!-- net/http -->

577 578 579 580 581 582 583 584 585 586 587 588
<dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
  <dd>
    <p><!-- CL 77410 -->
      The
      <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a>
      has a new
      <a href="/pkg/net/http/httputil/#ReverseProxy.ErrorHandler"><code>ErrorHandler</code></a>
      option to permit changing how errors are handled.
    </p>

</dl><!-- net/http/httputil -->

589 590 591
<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
  <dd>
    <p><!-- CL 78835 -->
592 593
      The new <a href="/pkg/os/#UserCacheDir"><code>UserCacheDir</code></a> function
      returns the default root directory to use for user-specific cached data.
594 595 596
    </p>

    <p><!-- CL 94856 -->
597 598 599 600 601
      The new <a href="/pkg/os/#ModeIrregular"><code>ModeIrregular</code></a>
      is a <a href="/pkg/os/#FileMode"><code>FileMode</code></a> bit to represent
      that a file is not a regular file, but nothing else is known about it, or that
      it's not a socket, device, named pipe, symlink, or other file type for which
      Go has a defined mode bit.
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616
    </p>

    <p><!-- CL 99337 -->
      TODO: <a href="https://golang.org/cl/99337">https://golang.org/cl/99337</a>: enable symlink creation on Windows 10
    </p>

    <p><!-- CL 100077 -->
      TODO: <a href="https://golang.org/cl/100077">https://golang.org/cl/100077</a>: use poller when NewFile is called with a blocking descriptor.
    </p>

</dl><!-- os -->

<dl id="os/signal"><dt><a href="/pkg/os/signal/">os/signal</a></dt>
  <dd>
    <p><!-- CL 108376 -->
617 618
      The new <a href="/pkg/os/signal/#Ignored"><code>Ignored</code></a> function reports
      whether a signal is currently ignored.
619 620 621 622 623 624 625
    </p>

</dl><!-- os/signal -->

<dl id="os/user"><dt><a href="/pkg/os/user/">os/user</a></dt>
  <dd>
    <p><!-- CL 92456 -->
626 627 628 629 630 631
      The <code>os/user</code> package can now be built in pure Go
      mode using the build tag "<code>osusergo</code>",
      independent of the use of the environment
      variable <code>CGO_ENABLED=0</code>. Previously the only way to use
      the package's pure Go implementation was to disable <code>cgo</code>
      support across the entire program.
632 633 634 635
    </p>

</dl><!-- os/user -->

636
<!-- CL 101715 was reverted -->
637 638 639 640 641 642 643

<dl id="runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
  <dd>
    <p><!-- CL 106156 -->
      TODO: <a href="https://golang.org/cl/106156">https://golang.org/cl/106156</a>: use fixed TLS offsets on darwin/amd64 and darwin/386
    </p>

644
    <p><!-- CL 70993 -->
645 646 647 648
      Setting the <code>GODEBUG=tracebackancestors=<em>N</em></code>
      environment variable now extends tracebacks with the stacks at
      which goroutines were created, where <em>N</em> limits the
      number of ancestor goroutines to report.
649 650
    </p>

651 652 653 654 655
</dl><!-- runtime -->

<dl id="runtime/pprof"><dt><a href="/pkg/runtime/pprof/">runtime/pprof</a></dt>
  <dd>
    <p><!-- CL 102696 -->
656 657 658
      This release adds a new "allocs" profile type that profiles
      total number of bytes allocated since the program began
      (including garbage-collected bytes). This is identical to the
659 660 661
      existing "heap" profile viewed in <code>-alloc_space</code> mode.
      Now <code>go test -memprofile=...</code> reports an "allocs" profile
      instead of "heap" profile.
662 663 664 665 666 667 668
    </p>

</dl><!-- runtime/pprof -->

<dl id="runtime/trace"><dt><a href="/pkg/runtime/trace/">runtime/trace</a></dt>
  <dd>
    <p><!-- CL 63274 -->
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720
      This release adds a new user annotation API.
      It introduces three basic building blocks: Log, Span, and Task.
    </p>

    <p>
      Log is for basic logging. When called, the message will be recorded
      to the trace along with timestamp, goroutine id, and stack info.
    </p>

    <pre>trace.Log(ctx, messageType message)</pre>

    <p>
      Span can be thought as an extension of log to record interesting
      time interval during a goroutine's execution. A span is local to a
      goroutine by definition.
    </p>

    <pre>
trace.WithSpan(ctx, "doVeryExpensiveOp", func(ctx context) {
    /* do something very expensive */
})</pre>

    <p>
      Task is higher-level concept that aids tracing of complex operations
      that encompass multiple goroutines or are asynchronous.
      For example, an RPC request, a HTTP request, a file write, or a
      batch job can be traced with a Task.
    </p>

    <p>
      Note we chose to design the API around context.Context so it allows
      easier integration with other tracing tools, often designed around
      context.Context as well. Log and WithSpan APIs recognize the task
      information embedded in the context and record it in the trace as
      well. That allows the Go execution tracer to associate and group
      the spans and log messages based on the task information.
    </p>

    <p>
      In order to create a Task,
    </p>

    <pre>ctx, end := trace.NewContext(ctx, "myTask")
defer end()</pre>

    <p>
      The Go execution tracer measures the time between the task created
      and the task ended for the task latency.
    </p>

    <p>
      More discussion history is in <a href="https://golang.org/cl/59572">golang.org/cl/59572</a>.
721 722 723 724
    </p>

</dl><!-- runtime/trace -->

725 726 727
<dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
  <dd>
    <p><!-- CL 87095 -->
728
      The mutex profile now includes reader/writer contention
729
      for <a href="/pkg/sync/#RWMutex"><code>RWMutex</code></a>.
730 731
      Writer/writer contention was already included in the mutex
      profile.
732 733 734 735 736 737 738
    </p>

</dl><!-- sync -->

<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
  <dd>
    <p><!-- CL 106275 -->
739 740 741 742 743 744 745 746
      On Windows, several fields were changed from <code>uintptr</code> to a new
      <a href="/pkg/syscall/?GOOS=windows&GOARCH=amd64#Pointer"><code>Pointer</code></a>
      type to avoid problems with Go's garbage collector. The same change was made
      to the <a href="https://godoc.org/golang.org/x/sys/windows"><code>golang.org/x/sys/windows</code></a>
      package. For any code affected, users should first migrate away from the <code>syscall</code>
      package to the <code>golang.org/x/sys/windows</code> package, and then change
      to using the <code>Pointer</code>, while obeying the
      <a href="/pkg/unsafe/#Pointer"><code>unsafe.Pointer</code> conversion rules</a>.
747 748
    </p>

749
    <p><!-- CL 118658 -->
750 751 752 753
      On Linux, the <code>flags</code> parameter to
      <a href="/pkg/syscall/?GOOS=linux&GOARCH=amd64#Fchmodat"><code>Fchmodat</code></a>
      is now validated. Linux's <code>fchmodat</code> doesn't support the <code>flags</code> parameter
      so we now mimic glibc's behavior and return an error if it's non-zero.
754 755
    </p>

756 757 758 759 760
</dl><!-- syscall -->

<dl id="text/scanner"><dt><a href="/pkg/text/scanner/">text/scanner</a></dt>
  <dd>
    <p><!-- CL 112037 -->
761 762
      <code>Scan()</code> now returns a <code>RawString</code> token instead of <code>String</code>
      for raw string literals.
763 764 765 766 767 768 769
    </p>

</dl><!-- text/scanner -->

<dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt>
  <dd>
    <p><!-- CL 84480 -->
770 771 772 773 774 775 776 777 778 779 780 781 782
      Modifying template variables via assignments is now permitted via the <code>=</code> token:
    </p>
    <pre>
  {{"{{"}} $v := "init" {{"}}"}}
  {{"{{"}} if true {{"}}"}}
    {{"{{"}} $v = "changed" {{"}}"}}
  {{"{{"}} end {{"}}"}}
  v: {{"{{"}} $v {{"}}"}} {{"{{"}}/* "changed" */{{"}}"}}</pre>

    <p>
      This required backwards-incompatible changes to the <code>text/template/parse</code>
      package, but was deemed acceptable since the package's documentation clearly states
      that it isn't intended for general use.
783 784
    </p>

785
    <p><!-- CL 95215 -->
786 787 788 789
      In previous versions, passing an untyped nil to a template function
      would result in an incorrect error stating that the function was missing an argument.
      Errors resulting from untyped nil values being passed to template-evaluated functions
      are now properly reported.
790 791
    </p>

792 793 794 795 796
</dl><!-- text/template -->

<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
  <dd>
    <p><!-- CL 98157 -->
797 798 799 800 801
	  Parsing of timezones denoted by sign and offset is now
	  supported. In previous versions, numeric timezone names
	  (such as <code>+03</code>) were not considered valid, and only
	  three-letter abbreviations (such as <code>MST</code>) were accepted
	  when expecting a timezone name.
802 803
    </p>
</dl><!-- time -->