"Fossies" - the Fresh Open Source Software Archive

Member "go/doc/go1.5.html" (9 Sep 2020, 47800 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.5 Release Notes",
    3     "Path":  "/doc/go1.5",
    4     "Template": true
    5 }-->
    8 <h2 id="introduction">Introduction to Go 1.5</h2>
   10 <p>
   11 The latest Go release, version 1.5,
   12 is a significant release, including major architectural changes to the implementation.
   13 Despite that, we expect almost all Go programs to continue to compile and run as before,
   14 because the release still maintains the Go 1 <a href="/doc/go1compat.html">promise
   15 of compatibility</a>.
   16 </p>
   18 <p>
   19 The biggest developments in the implementation are:
   20 </p>
   22 <ul>
   24 <li>
   25 The compiler and runtime are now written entirely in Go (with a little assembler).
   26 C is no longer involved in the implementation, and so the C compiler that was
   27 once necessary for building the distribution is gone.
   28 </li>
   30 <li>
   31 The garbage collector is now <a href="https://golang.org/s/go14gc">concurrent</a> and provides dramatically lower
   32 pause times by running, when possible, in parallel with other goroutines.
   33 </li>
   35 <li>
   36 By default, Go programs run with <code>GOMAXPROCS</code> set to the
   37 number of cores available; in prior releases it defaulted to 1.
   38 </li>
   40 <li>
   41 Support for <a href="https://golang.org/s/go14internal">internal packages</a>
   42 is now provided for all repositories, not just the Go core.
   43 </li>
   45 <li>
   46 The <code>go</code> command now provides <a href="https://golang.org/s/go15vendor">experimental
   47 support</a> for "vendoring" external dependencies.
   48 </li>
   50 <li>
   51 A new <code>go tool trace</code> command supports fine-grained
   52 tracing of program execution.
   53 </li>
   55 <li>
   56 A new <code>go doc</code> command (distinct from <code>godoc</code>)
   57 is customized for command-line use.
   58 </li>
   60 </ul>
   62 <p>
   63 These and a number of other changes to the implementation and tools
   64 are discussed below.
   65 </p>
   67 <p>
   68 The release also contains one small language change involving map literals.
   69 </p>
   71 <p>
   72 Finally, the timing of the <a href="https://golang.org/s/releasesched">release</a>
   73 strays from the usual six-month interval,
   74 both to provide more time to prepare this major release and to shift the schedule thereafter to
   75 time the release dates more conveniently.
   76 </p>
   78 <h2 id="language">Changes to the language</h2>
   80 <h3 id="map_literals">Map literals</h3>
   82 <p>
   83 Due to an oversight, the rule that allowed the element type to be elided from slice literals was not
   84 applied to map keys.
   85 This has been <a href="/cl/2591">corrected</a> in Go 1.5.
   86 An example will make this clear.
   87 As of Go 1.5, this map literal,
   88 </p>
   90 <pre>
   91 m := map[Point]string{
   92     Point{29.935523, 52.891566}:   "Persepolis",
   93     Point{-25.352594, 131.034361}: "Uluru",
   94     Point{37.422455, -122.084306}: "Googleplex",
   95 }
   96 </pre>
   98 <p>
   99 may be written as follows, without the <code>Point</code> type listed explicitly:
  100 </p>
  102 <pre>
  103 m := map[Point]string{
  104     {29.935523, 52.891566}:   "Persepolis",
  105     {-25.352594, 131.034361}: "Uluru",
  106     {37.422455, -122.084306}: "Googleplex",
  107 }
  108 </pre>
  110 <h2 id="implementation">The Implementation</h2>
  112 <h3 id="c">No more C</h3>
  114 <p>
  115 The compiler and runtime are now implemented in Go and assembler, without C.
  116 The only C source left in the tree is related to testing or to <code>cgo</code>.
  117 There was a C compiler in the tree in 1.4 and earlier.
  118 It was used to build the runtime; a custom compiler was necessary in part to
  119 guarantee the C code would work with the stack management of goroutines.
  120 Since the runtime is in Go now, there is no need for this C compiler and it is gone.
  121 Details of the process to eliminate C are discussed <a href="https://golang.org/s/go13compiler">elsewhere</a>.
  122 </p>
  124 <p>
  125 The conversion from C was done with the help of custom tools created for the job.
  126 Most important, the compiler was actually moved by automatic translation of
  127 the C code into Go.
  128 It is in effect the same program in a different language.
  129 It is not a new implementation
  130 of the compiler so we expect the process will not have introduced new compiler
  131 bugs.
  132 An overview of this process is available in the slides for
  133 <a href="https://talks.golang.org/2015/gogo.slide">this presentation</a>.
  134 </p>
  136 <h3 id="compiler_and_tools">Compiler and tools</h3>
  138 <p>
  139 Independent of but encouraged by the move to Go, the names of the tools have changed.
  140 The old names <code>6g</code>, <code>8g</code> and so on are gone; instead there
  141 is just one binary, accessible as <code>go</code> <code>tool</code> <code>compile</code>,
  142 that compiles Go source into binaries suitable for the architecture and operating system
  143 specified by <code>$GOARCH</code> and <code>$GOOS</code>.
  144 Similarly, there is now one linker (<code>go</code> <code>tool</code> <code>link</code>)
  145 and one assembler (<code>go</code> <code>tool</code> <code>asm</code>).
  146 The linker was translated automatically from the old C implementation,
  147 but the assembler is a new native Go implementation discussed
  148 in more detail below.
  149 </p>
  151 <p>
  152 Similar to the drop of the names <code>6g</code>, <code>8g</code>, and so on,
  153 the output of the compiler and assembler are now given a plain <code>.o</code> suffix
  154 rather than <code>.8</code>, <code>.6</code>, etc.
  155 </p>
  158 <h3 id="gc">Garbage collector</h3>
  160 <p>
  161 The garbage collector has been re-engineered for 1.5 as part of the development
  162 outlined in the <a href="https://golang.org/s/go14gc">design document</a>.
  163 Expected latencies are much lower than with the collector
  164 in prior releases, through a combination of advanced algorithms,
  165 better <a href="https://golang.org/s/go15gcpacing">scheduling</a> of the collector,
  166 and running more of the collection in parallel with the user program.
  167 The "stop the world" phase of the collector
  168 will almost always be under 10 milliseconds and usually much less.
  169 </p>
  171 <p>
  172 For systems that benefit from low latency, such as user-responsive web sites,
  173 the drop in expected latency with the new collector may be important.
  174 </p>
  176 <p>
  177 Details of the new collector were presented in a
  178 <a href="https://talks.golang.org/2015/go-gc.pdf">talk</a> at GopherCon 2015.
  179 </p>
  181 <h3 id="runtime">Runtime</h3>
  183 <p>
  184 In Go 1.5, the order in which goroutines are scheduled has been changed.
  185 The properties of the scheduler were never defined by the language,
  186 but programs that depend on the scheduling order may be broken
  187 by this change.
  188 We have seen a few (erroneous) programs affected by this change.
  189 If you have programs that implicitly depend on the scheduling
  190 order, you will need to update them.
  191 </p>
  193 <p>
  194 Another potentially breaking change is that the runtime now
  195 sets the default number of threads to run simultaneously,
  196 defined by <code>GOMAXPROCS</code>, to the number
  197 of cores available on the CPU.
  198 In prior releases the default was 1.
  199 Programs that do not expect to run with multiple cores may
  200 break inadvertently.
  201 They can be updated by removing the restriction or by setting
  202 <code>GOMAXPROCS</code> explicitly.
  203 For a more detailed discussion of this change, see
  204 the <a href="https://golang.org/s/go15gomaxprocs">design document</a>.
  205 </p>
  207 <h3 id="build">Build</h3>
  209 <p>
  210 Now that the Go compiler and runtime are implemented in Go, a Go compiler
  211 must be available to compile the distribution from source.
  212 Thus, to build the Go core, a working Go distribution must already be in place.
  213 (Go programmers who do not work on the core are unaffected by this change.)
  214 Any Go 1.4 or later distribution (including <code>gccgo</code>) will serve.
  215 For details, see the <a href="https://golang.org/s/go15bootstrap">design document</a>.
  216 </p>
  218 <h2 id="ports">Ports</h2>
  220 <p>
  221 Due mostly to the industry's move away from the 32-bit x86 architecture,
  222 the set of binary downloads provided is reduced in 1.5.
  223 A distribution for the OS X operating system is provided only for the
  224 <code>amd64</code> architecture, not <code>386</code>.
  225 Similarly, the ports for Snow Leopard (Apple OS X 10.6) still work but are no
  226 longer released as a download or maintained since Apple no longer maintains that version
  227 of the operating system.
  228 Also, the <code>dragonfly/386</code> port is no longer supported at all
  229 because DragonflyBSD itself no longer supports the 32-bit 386 architecture.
  230 </p>
  232 <p>
  233 There are however several new ports available to be built from source.
  234 These include <code>darwin/arm</code> and <code>darwin/arm64</code>.
  235 The new port <code>linux/arm64</code> is mostly in place, but <code>cgo</code>
  236 is only supported using external linking.
  237 </p>
  239 <p>
  240 Also available as experiments are <code>ppc64</code>
  241 and <code>ppc64le</code> (64-bit PowerPC, big- and little-endian).
  242 Both these ports support <code>cgo</code> but
  243 only with internal linking.
  244 </p>
  246 <p>
  247 On FreeBSD, Go 1.5 requires FreeBSD 8-STABLE+ because of its new use of the <code>SYSCALL</code> instruction.
  248 </p>
  250 <p>
  251 On NaCl, Go 1.5 requires SDK version pepper-41. Later pepper versions are not
  252 compatible due to the removal of the sRPC subsystem from the NaCl runtime.
  253 </p>
  255 <p>
  256 On Darwin, the use of the system X.509 certificate interface can be disabled
  257 with the <code>ios</code> build tag.
  258 </p>
  260 <p>
  261 The Solaris port now has full support for cgo and the packages
  262 <a href="/pkg/net/"><code>net</code></a> and
  263 <a href="/pkg/crypto/x509/"><code>crypto/x509</code></a>,
  264 as well as a number of other fixes and improvements.
  265 </p>
  267 <h2 id="tools">Tools</h2>
  269 <h3 id="translate">Translating</h3>
  271 <p>
  272 As part of the process to eliminate C from the tree, the compiler and
  273 linker were translated from C to Go.
  274 It was a genuine (machine assisted) translation, so the new programs are essentially
  275 the old programs translated rather than new ones with new bugs.
  276 We are confident the translation process has introduced few if any new bugs,
  277 and in fact uncovered a number of previously unknown bugs, now fixed.
  278 </p>
  280 <p>
  281 The assembler is a new program, however; it is described below.
  282 </p>
  284 <h3 id="rename">Renaming</h3>
  286 <p>
  287 The suites of programs that were the compilers (<code>6g</code>, <code>8g</code>, etc.),
  288 the assemblers (<code>6a</code>, <code>8a</code>, etc.),
  289 and the linkers (<code>6l</code>, <code>8l</code>, etc.)
  290 have each been consolidated into a single tool that is configured
  291 by the environment variables <code>GOOS</code> and <code>GOARCH</code>.
  292 The old names are gone; the new tools are available through the <code>go</code> <code>tool</code>
  293 mechanism as <code>go tool compile</code>,
  294 <code>go tool asm</code>,
  295 <code>and go tool link</code>.
  296 Also, the file suffixes <code>.6</code>, <code>.8</code>, etc. for the
  297 intermediate object files are also gone; now they are just plain <code>.o</code> files.
  298 </p>
  300 <p>
  301 For example, to build and link a program on amd64 for Darwin
  302 using the tools directly, rather than through <code>go build</code>,
  303 one would run:
  304 </p>
  306 <pre>
  307 $ export GOOS=darwin GOARCH=amd64
  308 $ go tool compile program.go
  309 $ go tool link program.o
  310 </pre>
  312 <h3 id="moving">Moving</h3>
  314 <p>
  315 Because the <a href="/pkg/go/types/"><code>go/types</code></a> package
  316 has now moved into the main repository (see below),
  317 the <a href="/cmd/vet"><code>vet</code></a> and
  318 <a href="/cmd/cover"><code>cover</code></a>
  319 tools have also been moved.
  320 They are no longer maintained in the external <code>golang.org/x/tools</code> repository,
  321 although (deprecated) source still resides there for compatibility with old releases.
  322 </p>
  324 <h3 id="compiler">Compiler</h3>
  326 <p>
  327 As described above, the compiler in Go 1.5 is a single Go program,
  328 translated from the old C source, that replaces <code>6g</code>, <code>8g</code>,
  329 and so on.
  330 Its target is configured by the environment variables <code>GOOS</code> and <code>GOARCH</code>.
  331 </p>
  333 <p>
  334 The 1.5 compiler is mostly equivalent to the old,
  335 but some internal details have changed.
  336 One significant change is that evaluation of constants now uses
  337 the <a href="/pkg/math/big/"><code>math/big</code></a> package
  338 rather than a custom (and less well tested) implementation of high precision
  339 arithmetic.
  340 We do not expect this to affect the results.
  341 </p>
  343 <p>
  344 For the amd64 architecture only, the compiler has a new option, <code>-dynlink</code>,
  345 that assists dynamic linking by supporting references to Go symbols
  346 defined in external shared libraries.
  347 </p>
  349 <h3 id="assembler">Assembler</h3>
  351 <p>
  352 Like the compiler and linker, the assembler in Go 1.5 is a single program
  353 that replaces the suite of assemblers (<code>6a</code>,
  354 <code>8a</code>, etc.) and the environment variables
  355 <code>GOARCH</code> and <code>GOOS</code>
  356 configure the architecture and operating system.
  357 Unlike the other programs, the assembler is a wholly new program
  358 written in Go.
  359 </p>
  361  <p>
  362 The new assembler is very nearly compatible with the previous
  363 ones, but there are a few changes that may affect some
  364 assembler source files.
  365 See the updated <a href="/doc/asm">assembler guide</a>
  366 for more specific information about these changes. In summary:
  368 </p>
  370 <p>
  371 First, the expression evaluation used for constants is a little
  372 different.
  373 It now uses unsigned 64-bit arithmetic and the precedence
  374 of operators (<code>+</code>, <code>-</code>, <code><<</code>, etc.)
  375 comes from Go, not C.
  376 We expect these changes to affect very few programs but
  377 manual verification may be required.
  378 </p>
  380 <p>
  381 Perhaps more important is that on machines where
  382 <code>SP</code> or <code>PC</code> is only an alias
  383 for a numbered register,
  384 such as <code>R13</code> for the stack pointer and
  385 <code>R15</code> for the hardware program counter
  386 on ARM,
  387 a reference to such a register that does not include a symbol
  388 is now illegal.
  389 For example, <code>SP</code> and <code>4(SP)</code> are
  390 illegal but <code>sym+4(SP)</code> is fine.
  391 On such machines, to refer to the hardware register use its
  392 true <code>R</code> name.
  393 </p>
  395 <p>
  396 One minor change is that some of the old assemblers
  397 permitted the notation
  398 </p>
  400 <pre>
  401 constant=value
  402 </pre>
  404 <p>
  405 to define a named constant.
  406 Since this is always possible to do with the traditional
  407 C-like <code>#define</code> notation, which is still
  408 supported (the assembler includes an implementation
  409 of a simplified C preprocessor), the feature was removed.
  410 </p>
  412 <h3 id="link">Linker</h3>
  414 <p>
  415 The linker in Go 1.5 is now one Go program,
  416 that replaces <code>6l</code>, <code>8l</code>, etc.
  417 Its operating system and instruction set are specified
  418 by the environment variables <code>GOOS</code> and <code>GOARCH</code>.
  419 </p>
  421 <p>
  422 There are several other changes.
  423 The most significant is the addition of a <code>-buildmode</code> option that
  424 expands the style of linking; it now supports
  425 situations such as building shared libraries and allowing other languages
  426 to call into Go libraries.
  427 Some of these were outlined in a <a href="https://golang.org/s/execmodes">design document</a>.
  428 For a list of the available build modes and their use, run
  429 </p>
  431 <pre>
  432 $ go help buildmode
  433 </pre>
  435 <p>
  436 Another minor change is that the linker no longer records build time stamps in
  437 the header of Windows executables.
  438 Also, although this may be fixed, Windows cgo executables are missing some
  439 DWARF information.
  440 </p>
  442 <p>
  443 Finally, the <code>-X</code> flag, which takes two arguments,
  444 as in
  445 </p>
  447 <pre>
  448 -X importpath.name value
  449 </pre>
  451 <p>
  452 now also accepts a more common Go flag style with a single argument
  453 that is itself a <code>name=value</code> pair:
  454 </p>
  456 <pre>
  457 -X importpath.name=value
  458 </pre>
  460 <p>
  461 Although the old syntax still works, it is recommended that uses of this
  462 flag in scripts and the like be updated to the new form.
  463 </p>
  465 <h3 id="go_command">Go command</h3>
  467 <p>
  468 The <a href="/cmd/go"><code>go</code></a> command's basic operation
  469 is unchanged, but there are a number of changes worth noting.
  470 </p>
  472 <p>
  473 The previous release introduced the idea of a directory internal to a package
  474 being unimportable through the <code>go</code> command.
  475 In 1.4, it was tested with the introduction of some internal elements
  476 in the core repository.
  477 As suggested in the <a href="https://golang.org/s/go14internal">design document</a>,
  478 that change is now being made available to all repositories.
  479 The rules are explained in the design document, but in summary any
  480 package in or under a directory named <code>internal</code> may
  481 be imported by packages rooted in the same subtree.
  482 Existing packages with directory elements named <code>internal</code> may be
  483 inadvertently broken by this change, which was why it was advertised
  484 in the last release.
  485 </p>
  487 <p>
  488 Another change in how packages are handled is the experimental
  489 addition of support for "vendoring".
  490 For details, see the documentation for the <a href="/cmd/go/#hdr-Vendor_Directories"><code>go</code> command</a>
  491 and the <a href="https://golang.org/s/go15vendor">design document</a>.
  492 </p>
  494 <p>
  495 There have also been several minor changes.
  496 Read the <a href="/cmd/go">documentation</a> for full details.
  497 </p>
  499 <ul>
  501 <li>
  502 SWIG support has been updated such that
  503 <code>.swig</code> and <code>.swigcxx</code>
  504 now require SWIG 3.0.6 or later.
  505 </li>
  507 <li>
  508 The <code>install</code> subcommand now removes the
  509 binary created by the <code>build</code> subcommand
  510 in the source directory, if present,
  511 to avoid problems having two binaries present in the tree.
  512 </li>
  514 <li>
  515 The <code>std</code> (standard library) wildcard package name
  516 now excludes commands.
  517 A new <code>cmd</code> wildcard covers the commands.
  518 </li>
  520 <li>
  521 A new <code>-asmflags</code> build option
  522 sets flags to pass to the assembler.
  523 However,
  524 the <code>-ccflags</code> build option has been dropped;
  525 it was specific to the old, now deleted C compiler .
  526 </li>
  528 <li>
  529 A new <code>-buildmode</code> build option
  530 sets the build mode, described above.
  531 </li>
  533 <li>
  534 A new <code>-pkgdir</code> build option
  535 sets the location of installed package archives,
  536 to help isolate custom builds.
  537 </li>
  539 <li>
  540 A new <code>-toolexec</code> build option
  541 allows substitution of a different command to invoke
  542 the compiler and so on.
  543 This acts as a custom replacement for <code>go tool</code>.
  544 </li>
  546 <li>
  547 The <code>test</code> subcommand now has a <code>-count</code>
  548 flag to specify how many times to run each test and benchmark.
  549 The <a href="/pkg/testing/"><code>testing</code></a> package
  550 does the work here, through the <code>-test.count</code> flag.
  551 </li>
  553 <li>
  554 The <code>generate</code> subcommand has a couple of new features.
  555 The <code>-run</code> option specifies a regular expression to select which directives
  556 to execute; this was proposed but never implemented in 1.4.
  557 The executing pattern now has access to two new environment variables:
  558 <code>$GOLINE</code> returns the source line number of the directive
  559 and <code>$DOLLAR</code> expands to a dollar sign.
  560 </li>
  562 <li>
  563 The <code>get</code> subcommand now has a <code>-insecure</code>
  564 flag that must be enabled if fetching from an insecure repository, one that
  565 does not encrypt the connection.
  566 </li>
  568 </ul>
  570 <h3 id="vet_command">Go vet command</h3>
  572 <p>
  573 The <a href="/cmd/vet"><code>go tool vet</code></a> command now does
  574 more thorough validation of struct tags.
  575 </p>
  577 <h3 id="trace_command">Trace command</h3>
  579 <p>
  580 A new tool is available for dynamic execution tracing of Go programs.
  581 The usage is analogous to how the test coverage tool works.
  582 Generation of traces is integrated into <code>go test</code>,
  583 and then a separate execution of the tracing tool itself analyzes the results:
  584 </p>
  586 <pre>
  587 $ go test -trace=trace.out path/to/package
  588 $ go tool trace [flags] pkg.test trace.out
  589 </pre>
  591 <p>
  592 The flags enable the output to be displayed in a browser window.
  593 For details, run <code>go tool trace -help</code>.
  594 There is also a description of the tracing facility in this
  595 <a href="https://talks.golang.org/2015/dynamic-tools.slide">talk</a>
  596 from GopherCon 2015.
  597 </p>
  599 <h3 id="doc_command">Go doc command</h3>
  601 <p>
  602 A few releases back, the <code>go doc</code>
  603 command was deleted as being unnecessary.
  604 One could always run "<code>godoc .</code>" instead.
  605 The 1.5 release introduces a new <a href="/cmd/doc"><code>go doc</code></a>
  606 command with a more convenient command-line interface than
  607 <code>godoc</code>'s.
  608 It is designed for command-line usage specifically, and provides a more
  609 compact and focused presentation of the documentation for a package
  610 or its elements, according to the invocation.
  611 It also provides case-insensitive matching and
  612 support for showing the documentation for unexported symbols.
  613 For details run "<code>go help doc</code>".
  614 </p>
  616 <h3 id="cgo">Cgo</h3>
  618 <p>
  619 When parsing <code>#cgo</code> lines,
  620 the invocation <code>${SRCDIR}</code> is now
  621 expanded into the path to the source directory.
  622 This allows options to be passed to the
  623 compiler and linker that involve file paths relative to the
  624 source code directory. Without the expansion the paths would be
  625 invalid when the current working directory changes.
  626 </p>
  628 <p>
  629 Solaris now has full cgo support.
  630 </p>
  632 <p>
  633 On Windows, cgo now uses external linking by default.
  634 </p>
  636 <p>
  637 When a C struct ends with a zero-sized field, but the struct itself is
  638 not zero-sized, Go code can no longer refer to the zero-sized field.
  639 Any such references will have to be rewritten.
  640 </p>
  642 <h2 id="performance">Performance</h2>
  644 <p>
  645 As always, the changes are so general and varied that precise statements
  646 about performance are difficult to make.
  647 The changes are even broader ranging than usual in this release, which
  648 includes a new garbage collector and a conversion of the runtime to Go.
  649 Some programs may run faster, some slower.
  650 On average the programs in the Go 1 benchmark suite run a few percent faster in Go 1.5
  651 than they did in Go 1.4,
  652 while as mentioned above the garbage collector's pauses are
  653 dramatically shorter, and almost always under 10 milliseconds.
  654 </p>
  656 <p>
  657 Builds in Go 1.5 will be slower by a factor of about two.
  658 The automatic translation of the compiler and linker from C to Go resulted in
  659 unidiomatic Go code that performs poorly compared to well-written Go.
  660 Analysis tools and refactoring helped to improve the code, but much remains to be done.
  661 Further profiling and optimization will continue in Go 1.6 and future releases.
  662 For more details, see these <a href="https://talks.golang.org/2015/gogo.slide">slides</a>
  663 and associated <a href="https://www.youtube.com/watch?v=cF1zJYkBW4A">video</a>.
  664 </p>
  666 <h2 id="library">Core library</h2>
  668 <h3 id="flag">Flag</h3>
  670 <p>
  671 The flag package's
  672 <a href="/pkg/flag/#PrintDefaults"><code>PrintDefaults</code></a>
  673 function, and method on <a href="/pkg/flag/#FlagSet"><code>FlagSet</code></a>,
  674 have been modified to create nicer usage messages.
  675 The format has been changed to be more human-friendly and in the usage
  676 messages a word quoted with `backquotes` is taken to be the name of the
  677 flag's operand to display in the usage message.
  678 For instance, a flag created with the invocation,
  679 </p>
  681 <pre>
  682 cpuFlag = flag.Int("cpu", 1, "run `N` processes in parallel")
  683 </pre>
  685 <p>
  686 will show the help message,
  687 </p>
  689 <pre>
  690 -cpu N
  691         run N processes in parallel (default 1)
  692 </pre>
  694 <p>
  695 Also, the default is now listed only when it is not the zero value for the type.
  696 </p>
  698 <h3 id="math_big">Floats in math/big</h3>
  700 <p>
  701 The <a href="/pkg/math/big/"><code>math/big</code></a> package
  702 has a new, fundamental data type,
  703 <a href="/pkg/math/big/#Float"><code>Float</code></a>,
  704 which implements arbitrary-precision floating-point numbers.
  705 A <code>Float</code> value is represented by a boolean sign,
  706 a variable-length mantissa, and a 32-bit fixed-size signed exponent.
  707 The precision of a <code>Float</code> (the mantissa size in bits)
  708 can be specified explicitly or is otherwise determined by the first
  709 operation that creates the value.
  710 Once created, the size of a <code>Float</code>'s mantissa may be modified with the
  711 <a href="/pkg/math/big/#Float.SetPrec"><code>SetPrec</code></a> method.
  712 <code>Floats</code> support the concept of infinities, such as are created by
  713 overflow, but values that would lead to the equivalent of IEEE 754 NaNs
  714 trigger a panic.
  715 <code>Float</code> operations support all IEEE-754 rounding modes.
  716 When the precision is set to 24 (53) bits,
  717 operations that stay within the range of normalized <code>float32</code>
  718 (<code>float64</code>)
  719 values produce the same results as the corresponding IEEE-754
  720 arithmetic on those values.
  721 </p>
  723 <h3 id="go_types">Go types</h3>
  725 <p>
  726 The <a href="/pkg/go/types/"><code>go/types</code></a> package
  727 up to now has been maintained in the <code>golang.org/x</code>
  728 repository; as of Go 1.5 it has been relocated to the main repository.
  729 The code at the old location is now deprecated.
  730 There is also a modest API change in the package, discussed below.
  731 </p>
  733 <p>
  734 Associated with this move, the
  735 <a href="/pkg/go/constant/"><code>go/constant</code></a>
  736 package also moved to the main repository;
  737 it was <code>golang.org/x/tools/exact</code> before.
  738 The <a href="/pkg/go/importer/"><code>go/importer</code></a> package
  739 also moved to the main repository,
  740 as well as some tools described above.
  741 </p>
  743 <h3 id="net">Net</h3>
  745 <p>
  746 The DNS resolver in the net package has almost always used <code>cgo</code> to access
  747 the system interface.
  748 A change in Go 1.5 means that on most Unix systems DNS resolution
  749 will no longer require <code>cgo</code>, which simplifies execution
  750 on those platforms.
  751 Now, if the system's networking configuration permits, the native Go resolver
  752 will suffice.
  753 The important effect of this change is that each DNS resolution occupies a goroutine
  754 rather than a thread,
  755 so a program with multiple outstanding DNS requests will consume fewer operating
  756 system resources.
  757 </p>
  759 <p>
  760 The decision of how to run the resolver applies at run time, not build time.
  761 The <code>netgo</code> build tag that has been used to enforce the use
  762 of the Go resolver is no longer necessary, although it still works.
  763 A new <code>netcgo</code> build tag forces the use of the <code>cgo</code> resolver at
  764 build time.
  765 To force <code>cgo</code> resolution at run time set
  766 <code>GODEBUG=netdns=cgo</code> in the environment.
  767 More debug options are documented <a href="https://golang.org/cl/11584">here</a>.
  768 </p>
  770 <p>
  771 This change applies to Unix systems only.
  772 Windows, Mac OS X, and Plan 9 systems behave as before.
  773 </p>
  775 <h3 id="reflect">Reflect</h3>
  777 <p>
  778 The <a href="/pkg/reflect/"><code>reflect</code></a> package
  779 has two new functions: <a href="/pkg/reflect/#ArrayOf"><code>ArrayOf</code></a>
  780 and <a href="/pkg/reflect/#FuncOf"><code>FuncOf</code></a>.
  781 These functions, analogous to the extant
  782 <a href="/pkg/reflect/#SliceOf"><code>SliceOf</code></a> function,
  783 create new types at runtime to describe arrays and functions.
  784 </p>
  786 <h3 id="hardening">Hardening</h3>
  788 <p>
  789 Several dozen bugs were found in the standard library
  790 through randomized testing with the
  791 <a href="https://github.com/dvyukov/go-fuzz"><code>go-fuzz</code></a> tool.
  792 Bugs were fixed in the
  793 <a href="/pkg/archive/tar/"><code>archive/tar</code></a>,
  794 <a href="/pkg/archive/zip/"><code>archive/zip</code></a>,
  795 <a href="/pkg/compress/flate/"><code>compress/flate</code></a>,
  796 <a href="/pkg/encoding/gob/"><code>encoding/gob</code></a>,
  797 <a href="/pkg/fmt/"><code>fmt</code></a>,
  798 <a href="/pkg/html/template/"><code>html/template</code></a>,
  799 <a href="/pkg/image/gif/"><code>image/gif</code></a>,
  800 <a href="/pkg/image/jpeg/"><code>image/jpeg</code></a>,
  801 <a href="/pkg/image/png/"><code>image/png</code></a>, and
  802 <a href="/pkg/text/template/"><code>text/template</code></a>,
  803 packages.
  804 The fixes harden the implementation against incorrect and malicious inputs.
  805 </p>
  807 <h3 id="minor_library_changes">Minor changes to the library</h3>
  809 <ul>
  811 <li>
  812 The <a href="/pkg/archive/zip/"><code>archive/zip</code></a> package's
  813 <a href="/pkg/archive/zip/#Writer"><code>Writer</code></a> type now has a
  814 <a href="/pkg/archive/zip/#Writer.SetOffset"><code>SetOffset</code></a>
  815 method to specify the location within the output stream at which to write the archive.
  816 </li>
  818 <li>
  819 The <a href="/pkg/bufio/#Reader"><code>Reader</code></a> in the
  820 <a href="/pkg/bufio/"><code>bufio</code></a> package now has a
  821 <a href="/pkg/bufio/#Reader.Discard"><code>Discard</code></a>
  822 method to discard data from the input.
  823 </li>
  825 <li>
  826 In the <a href="/pkg/bytes/"><code>bytes</code></a> package,
  827 the <a href="/pkg/bytes/#Buffer"><code>Buffer</code></a> type
  828 now has a <a href="/pkg/bytes/#Buffer.Cap"><code>Cap</code></a> method
  829 that reports the number of bytes allocated within the buffer.
  830 Similarly, in both the <a href="/pkg/bytes/"><code>bytes</code></a>
  831 and <a href="/pkg/strings/"><code>strings</code></a> packages,
  832 the <a href="/pkg/bytes/#Reader"><code>Reader</code></a>
  833 type now has a <a href="/pkg/bytes/#Reader.Size"><code>Size</code></a>
  834 method that reports the original length of the underlying slice or string.
  835 </li>
  837 <li>
  838 Both the <a href="/pkg/bytes/"><code>bytes</code></a> and
  839 <a href="/pkg/strings/"><code>strings</code></a> packages
  840 also now have a <a href="/pkg/bytes/#LastIndexByte"><code>LastIndexByte</code></a>
  841 function that locates the rightmost byte with that value in the argument.
  842 </li>
  844 <li>
  845 The <a href="/pkg/crypto/"><code>crypto</code></a> package
  846 has a new interface, <a href="/pkg/crypto/#Decrypter"><code>Decrypter</code></a>,
  847 that abstracts the behavior of a private key used in asymmetric decryption.
  848 </li>
  850 <li>
  851 In the <a href="/pkg/crypto/cipher/"><code>crypto/cipher</code></a> package,
  852 the documentation for the <a href="/pkg/crypto/cipher/#Stream"><code>Stream</code></a>
  853 interface has been clarified regarding the behavior when the source and destination are
  854 different lengths.
  855 If the destination is shorter than the source, the method will panic.
  856 This is not a change in the implementation, only the documentation.
  857 </li>
  859 <li>
  860 Also in the <a href="/pkg/crypto/cipher/"><code>crypto/cipher</code></a> package,
  861 there is now support for nonce lengths other than 96 bytes in AES's Galois/Counter mode (GCM),
  862 which some protocols require.
  863 </li>
  865 <li>
  866 In the <a href="/pkg/crypto/elliptic/"><code>crypto/elliptic</code></a> package,
  867 there is now a <code>Name</code> field in the
  868 <a href="/pkg/crypto/elliptic/#CurveParams"><code>CurveParams</code></a> struct,
  869 and the curves implemented in the package have been given names.
  870 These names provide a safer way to select a curve, as opposed to
  871 selecting its bit size, for cryptographic systems that are curve-dependent.
  872 </li>
  874 <li>
  875 Also in the <a href="/pkg/crypto/elliptic/"><code>crypto/elliptic</code></a> package,
  876 the <a href="/pkg/crypto/elliptic/#Unmarshal"><code>Unmarshal</code></a> function
  877 now verifies that the point is actually on the curve.
  878 (If it is not, the function returns nils).
  879 This change guards against certain attacks.
  880 </li>
  882 <li>
  883 The <a href="/pkg/crypto/sha512/"><code>crypto/sha512</code></a>
  884 package now has support for the two truncated versions of
  885 the SHA-512 hash algorithm, SHA-512/224 and SHA-512/256.
  886 </li>
  888 <li>
  889 The <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package
  890 minimum protocol version now defaults to TLS 1.0.
  891 The old default, SSLv3, is still available through <a href="/pkg/crypto/tls/#Config"><code>Config</code></a> if needed.
  892 </li>
  894 <li>
  895 The <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package
  896 now supports Signed Certificate Timestamps (SCTs) as specified in RFC 6962.
  897 The server serves them if they are listed in the
  898 <a href="/pkg/crypto/tls/#Certificate"><code>Certificate</code></a> struct,
  899 and the client requests them and exposes them, if present,
  900 in its <a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a> struct.
  902 <li>
  903 The stapled OCSP response to a <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> client connection,
  904 previously only available via the
  905 <a href="/pkg/crypto/tls/#Conn.OCSPResponse"><code>OCSPResponse</code></a> method,
  906 is now exposed in the <a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a> struct.
  907 </li>
  909 <li>
  910 The <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> server implementation
  911 will now always call the
  912 <code>GetCertificate</code> function in
  913 the <a href="/pkg/crypto/tls/#Config"><code>Config</code></a> struct
  914 to select a certificate for the connection when none is supplied.
  915 </li>
  917 <li>
  918 Finally, the session ticket keys in the
  919 <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package
  920 can now be changed while the server is running.
  921 This is done through the new
  922 <a href="/pkg/crypto/tls/#Config.SetSessionTicketKeys"><code>SetSessionTicketKeys</code></a>
  923 method of the
  924 <a href="/pkg/crypto/tls/#Config"><code>Config</code></a> type.
  925 </li>
  927 <li>
  928 In the <a href="/pkg/crypto/x509/"><code>crypto/x509</code></a> package,
  929 wildcards are now accepted only in the leftmost label as defined in
  930 <a href="https://tools.ietf.org/html/rfc6125#section-6.4.3">the specification</a>.
  931 </li>
  933 <li>
  934 Also in the <a href="/pkg/crypto/x509/"><code>crypto/x509</code></a> package,
  935 the handling of unknown critical extensions has been changed.
  936 They used to cause parse errors but now they are parsed and caused errors only
  937 in <a href="/pkg/crypto/x509/#Certificate.Verify"><code>Verify</code></a>.
  938 The new field <code>UnhandledCriticalExtensions</code> of
  939 <a href="/pkg/crypto/x509/#Certificate"><code>Certificate</code></a> records these extensions.
  940 </li>
  942 <li>
  943 The <a href="/pkg/database/sql/#DB"><code>DB</code></a> type of the
  944 <a href="/pkg/database/sql/"><code>database/sql</code></a> package
  945 now has a <a href="/pkg/database/sql/#DB.Stats"><code>Stats</code></a> method
  946 to retrieve database statistics.
  947 </li>
  949 <li>
  950 The <a href="/pkg/debug/dwarf/"><code>debug/dwarf</code></a>
  951 package has extensive additions to better support DWARF version 4.
  952 See for example the definition of the new type
  953 <a href="/pkg/debug/dwarf/#Class"><code>Class</code></a>.
  954 </li>
  956 <li>
  957 The <a href="/pkg/debug/dwarf/"><code>debug/dwarf</code></a> package
  958 also now supports decoding of DWARF line tables.
  959 </li>
  961 <li>
  962 The <a href="/pkg/debug/elf/"><code>debug/elf</code></a>
  963 package now has support for the 64-bit PowerPC architecture.
  964 </li>
  966 <li>
  967 The <a href="/pkg/encoding/base64/"><code>encoding/base64</code></a> package
  968 now supports unpadded encodings through two new encoding variables,
  969 <a href="/pkg/encoding/base64/#RawStdEncoding"><code>RawStdEncoding</code></a> and
  970 <a href="/pkg/encoding/base64/#RawURLEncoding"><code>RawURLEncoding</code></a>.
  971 </li>
  973 <li>
  974 The <a href="/pkg/encoding/json/"><code>encoding/json</code></a> package
  975 now returns an <a href="/pkg/encoding/json/#UnmarshalTypeError"><code>UnmarshalTypeError</code></a>
  976 if a JSON value is not appropriate for the target variable or component
  977 to which it is being unmarshaled.
  978 </li>
  980 <li>
  981 The <code>encoding/json</code>'s
  982 <a href="/pkg/encoding/json/#Decoder"><code>Decoder</code></a>
  983 type has a new method that provides a streaming interface for decoding
  984 a JSON document:
  985 <a href="/pkg/encoding/json/#Decoder.Token"><code>Token</code></a>.
  986 It also interoperates with the existing functionality of <code>Decode</code>,
  987 which will continue a decode operation already started with <code>Decoder.Token</code>.
  988 </li>
  990 <li>
  991 The <a href="/pkg/flag/"><code>flag</code></a> package
  992 has a new function, <a href="/pkg/flag/#UnquoteUsage"><code>UnquoteUsage</code></a>,
  993 to assist in the creation of usage messages using the new convention
  994 described above.
  995 </li>
  997 <li>
  998 In the <a href="/pkg/fmt/"><code>fmt</code></a> package,
  999 a value of type <a href="/pkg/reflect/#Value"><code>Value</code></a> now
 1000 prints what it holds, rather than use the <code>reflect.Value</code>'s <code>Stringer</code>
 1001 method, which produces things like <code>&lt;int Value&gt;</code>.
 1002 </li>
 1004 <li>
 1005 The <a href="/pkg/ast/#EmptyStmt"><code>EmptyStmt</code></a> type
 1006 in the <a href="/pkg/go/ast/"><code>go/ast</code></a> package now
 1007 has a boolean <code>Implicit</code> field that records whether the
 1008 semicolon was implicitly added or was present in the source.
 1009 </li>
 1011 <li>
 1012 For forward compatibility the <a href="/pkg/go/build/"><code>go/build</code></a> package
 1013 reserves <code>GOARCH</code> values for  a number of architectures that Go might support one day.
 1014 This is not a promise that it will.
 1015 Also, the <a href="/pkg/go/build/#Package"><code>Package</code></a> struct
 1016 now has a <code>PkgTargetRoot</code> field that stores the
 1017 architecture-dependent root directory in which to install, if known.
 1018 </li>
 1020 <li>
 1021 The (newly migrated) <a href="/pkg/go/types/"><code>go/types</code></a>
 1022 package allows one to control the prefix attached to package-level names using
 1023 the new <a href="/pkg/go/types/#Qualifier"><code>Qualifier</code></a>
 1024 function type as an argument to several functions. This is an API change for
 1025 the package, but since it is new to the core, it is not breaking the Go 1 compatibility
 1026 rules since code that uses the package must explicitly ask for it at its new location.
 1027 To update, run
 1028 <a href="https://golang.org/cmd/go/#hdr-Run_go_tool_fix_on_packages"><code>go fix</code></a> on your package.
 1029 </li>
 1031 <li>
 1032 In the <a href="/pkg/image/"><code>image</code></a> package,
 1033 the <a href="/pkg/image/#Rectangle"><code>Rectangle</code></a> type
 1034 now implements the <a href="/pkg/image/#Image"><code>Image</code></a> interface,
 1035 so a <code>Rectangle</code> can serve as a mask when drawing.
 1036 </li>
 1038 <li>
 1039 Also in the <a href="/pkg/image/"><code>image</code></a> package,
 1040 to assist in the handling of some JPEG images,
 1041 there is now support for 4:1:1 and 4:1:0 YCbCr subsampling and basic
 1042 CMYK support, represented by the new <code>image.CMYK</code> struct.
 1043 </li>
 1045 <li>
 1046 The <a href="/pkg/image/color/"><code>image/color</code></a> package
 1047 adds basic CMYK support, through the new
 1048 <a href="/pkg/image/color/#CMYK"><code>CMYK</code></a> struct,
 1049 the <a href="/pkg/image/color/#CMYKModel"><code>CMYKModel</code></a> color model, and the
 1050 <a href="/pkg/image/color/#CMYKToRGB"><code>CMYKToRGB</code></a> function, as
 1051 needed by some JPEG images.
 1052 </li>
 1054 <li>
 1055 Also in the <a href="/pkg/image/color/"><code>image/color</code></a> package,
 1056 the conversion of a <a href="/pkg/image/color/#YCbCr"><code>YCbCr</code></a>
 1057 value to <code>RGBA</code> has become more precise.
 1058 Previously, the low 8 bits were just an echo of the high 8 bits;
 1059 now they contain more accurate information.
 1060 Because of the echo property of the old code, the operation
 1061 <code>uint8(r)</code> to extract an 8-bit red value worked, but is incorrect.
 1062 In Go 1.5, that operation may yield a different value.
 1063 The correct code is, and always was, to select the high 8 bits:
 1064 <code>uint8(r&gt;&gt;8)</code>.
 1065 Incidentally, the <code>image/draw</code> package
 1066 provides better support for such conversions; see
 1067 <a href="https://blog.golang.org/go-imagedraw-package">this blog post</a>
 1068 for more information.
 1069 </li>
 1071 <li>
 1072 Finally, as of Go 1.5 the closest match check in
 1073 <a href="/pkg/image/color/#Palette.Index"><code>Index</code></a>
 1074 now honors the alpha channel.
 1075 </li>
 1077 <li>
 1078 The <a href="/pkg/image/gif/"><code>image/gif</code></a> package
 1079 includes a couple of generalizations.
 1080 A multiple-frame GIF file can now have an overall bounds different
 1081 from all the contained single frames' bounds.
 1082 Also, the <a href="/pkg/image/gif/#GIF"><code>GIF</code></a> struct
 1083 now has a <code>Disposal</code> field
 1084 that specifies the disposal method for each frame.
 1085 </li>
 1087 <li>
 1088 The <a href="/pkg/io/"><code>io</code></a> package
 1089 adds a <a href="/pkg/io/#CopyBuffer"><code>CopyBuffer</code></a> function
 1090 that is like <a href="/pkg/io/#Copy"><code>Copy</code></a> but
 1091 uses a caller-provided buffer, permitting control of allocation and buffer size.
 1092 </li>
 1094 <li>
 1095 The <a href="/pkg/log/"><code>log</code></a> package
 1096 has a new <a href="/pkg/log/#LUTC"><code>LUTC</code></a> flag
 1097 that causes time stamps to be printed in the UTC time zone.
 1098 It also adds a <a href="/pkg/log/#Logger.SetOutput"><code>SetOutput</code></a> method
 1099 for user-created loggers.
 1100 </li>
 1102 <li>
 1103 In Go 1.4, <a href="/pkg/math/#Max"><code>Max</code></a> was not detecting all possible NaN bit patterns.
 1104 This is fixed in Go 1.5, so programs that use <code>math.Max</code> on data including NaNs may behave differently,
 1105 but now correctly according to the IEEE754 definition of NaNs.
 1106 </li>
 1108 <li>
 1109 The <a href="/pkg/math/big/"><code>math/big</code></a> package
 1110 adds a new <a href="/pkg/math/big/#Jacobi"><code>Jacobi</code></a>
 1111 function for integers and a new
 1112 <a href="/pkg/math/big/#Int.ModSqrt"><code>ModSqrt</code></a>
 1113 method for the <a href="/pkg/math/big/#Int"><code>Int</code></a> type.
 1114 </li>
 1116 <li>
 1117 The mime package
 1118 adds a new <a href="/pkg/mime/#WordDecoder"><code>WordDecoder</code></a> type
 1119 to decode MIME headers containing RFC 204-encoded words.
 1120 It also provides <a href="/pkg/mime/#BEncoding"><code>BEncoding</code></a> and
 1121 <a href="/pkg/mime/#QEncoding"><code>QEncoding</code></a>
 1122 as implementations of the encoding schemes of RFC 2045 and RFC 2047.
 1123 </li>
 1125 <li>
 1126 The <a href="/pkg/mime/"><code>mime</code></a> package also adds an
 1127 <a href="/pkg/mime/#ExtensionsByType"><code>ExtensionsByType</code></a>
 1128 function that returns the MIME extensions know to be associated with a given MIME type.
 1129 </li>
 1131 <li>
 1132 There is a new <a href="/pkg/mime/quotedprintable/"><code>mime/quotedprintable</code></a>
 1133 package that implements the quoted-printable encoding defined by RFC 2045.
 1134 </li>
 1136 <li>
 1137 The <a href="/pkg/net/"><code>net</code></a> package will now
 1138 <a href="/pkg/net/#Dial"><code>Dial</code></a> hostnames by trying each
 1139 IP address in order until one succeeds.
 1140 The <code><a href="/pkg/net/#Dialer">Dialer</a>.DualStack</code>
 1141 mode now implements Happy Eyeballs
 1142 (<a href="https://tools.ietf.org/html/rfc6555">RFC 6555</a>) by giving the
 1143 first address family a 300ms head start; this value can be overridden by
 1144 the new <code>Dialer.FallbackDelay</code>.
 1145 </li>
 1147 <li>
 1148 A number of inconsistencies in the types returned by errors in the
 1149 <a href="/pkg/net/"><code>net</code></a> package have been
 1150 tidied up.
 1151 Most now return an
 1152 <a href="/pkg/net/#OpError"><code>OpError</code></a> value
 1153 with more information than before.
 1154 Also, the <a href="/pkg/net/#OpError"><code>OpError</code></a>
 1155 type now includes a <code>Source</code> field that holds the local
 1156 network address.
 1157 </li>
 1159 <li>
 1160 The <a href="/pkg/net/http/"><code>net/http</code></a> package now
 1161 has support for setting trailers from a server <a href="/pkg/net/http/#Handler"><code>Handler</code></a>.
 1162 For details, see the documentation for
 1163 <a href="/pkg/net/http/#ResponseWriter"><code>ResponseWriter</code></a>.
 1164 </li>
 1166 <li>
 1167 There is a new method to cancel a <a href="/pkg/net/http/"><code>net/http</code></a>
 1168 <code>Request</code> by setting the new
 1169 <a href="/pkg/net/http/#Request"><code>Request.Cancel</code></a>
 1170 field.
 1171 It is supported by <code>http.Transport</code>.
 1172 The <code>Cancel</code> field's type is compatible with the
 1173 <a href="https://godoc.org/golang.org/x/net/context"><code>context.Context.Done</code></a>
 1174 return value.
 1175 </li>
 1177 <li>
 1178 Also in the <a href="/pkg/net/http/"><code>net/http</code></a> package,
 1179 there is code to ignore the zero <a href="/pkg/time/#Time"><code>Time</code></a> value
 1180 in the <a href="/pkg/net/#ServeContent"><code>ServeContent</code></a> function.
 1181 As of Go 1.5, it now also ignores a time value equal to the Unix epoch.
 1182 </li>
 1184 <li>
 1185 The <a href="/pkg/net/http/fcgi/"><code>net/http/fcgi</code></a> package
 1186 exports two new errors,
 1187 <a href="/pkg/net/http/fcgi/#ErrConnClosed"><code>ErrConnClosed</code></a> and
 1188 <a href="/pkg/net/http/fcgi/#ErrRequestAborted"><code>ErrRequestAborted</code></a>,
 1189 to report the corresponding error conditions.
 1190 </li>
 1192 <li>
 1193 The <a href="/pkg/net/http/cgi/"><code>net/http/cgi</code></a> package
 1194 had a bug that mishandled the values of the environment variables
 1195 <code>REMOTE_ADDR</code> and <code>REMOTE_HOST</code>.
 1196 This has been fixed.
 1197 Also, starting with Go 1.5 the package sets the <code>REMOTE_PORT</code>
 1198 variable.
 1199 </li>
 1201 <li>
 1202 The <a href="/pkg/net/mail/"><code>net/mail</code></a> package
 1203 adds an <a href="/pkg/net/mail/#AddressParser"><code>AddressParser</code></a>
 1204 type that can parse mail addresses.
 1205 </li>
 1207 <li>
 1208 The <a href="/pkg/net/smtp/"><code>net/smtp</code></a> package
 1209 now has a <a href="/pkg/net/smtp/#Client.TLSConnectionState"><code>TLSConnectionState</code></a>
 1210 accessor to the <a href="/pkg/net/smtp/#Client"><code>Client</code></a>
 1211 type that returns the client's TLS state.
 1212 </li>
 1214 <li>
 1215 The <a href="/pkg/os/"><code>os</code></a> package
 1216 has a new <a href="/pkg/os/#LookupEnv"><code>LookupEnv</code></a> function
 1217 that is similar to <a href="/pkg/os/#Getenv"><code>Getenv</code></a>
 1218 but can distinguish between an empty environment variable and a missing one.
 1219 </li>
 1221 <li>
 1222 The <a href="/pkg/os/signal/"><code>os/signal</code></a> package
 1223 adds new <a href="/pkg/os/signal/#Ignore"><code>Ignore</code></a> and
 1224 <a href="/pkg/os/signal/#Reset"><code>Reset</code></a> functions.
 1225 </li>
 1227 <li>
 1228 The <a href="/pkg/runtime/"><code>runtime</code></a>,
 1229 <a href="/pkg/runtime/trace/"><code>runtime/trace</code></a>,
 1230 and <a href="/pkg/net/http/pprof/"><code>net/http/pprof</code></a> packages
 1231 each have new functions to support the tracing facilities described above:
 1232 <a href="/pkg/runtime/#ReadTrace"><code>ReadTrace</code></a>,
 1233 <a href="/pkg/runtime/#StartTrace"><code>StartTrace</code></a>,
 1234 <a href="/pkg/runtime/#StopTrace"><code>StopTrace</code></a>,
 1235 <a href="/pkg/runtime/trace/#Start"><code>Start</code></a>,
 1236 <a href="/pkg/runtime/trace/#Stop"><code>Stop</code></a>, and
 1237 <a href="/pkg/net/http/pprof/#Trace"><code>Trace</code></a>.
 1238 See the respective documentation for details.
 1239 </li>
 1241 <li>
 1242 The <a href="/pkg/runtime/pprof/"><code>runtime/pprof</code></a> package
 1243 by default now includes overall memory statistics in all memory profiles.
 1244 </li>
 1246 <li>
 1247 The <a href="/pkg/strings/"><code>strings</code></a> package
 1248 has a new <a href="/pkg/strings/#Compare"><code>Compare</code></a> function.
 1249 This is present to provide symmetry with the <a href="/pkg/bytes/"><code>bytes</code></a> package
 1250 but is otherwise unnecessary as strings support comparison natively.
 1251 </li>
 1253 <li>
 1254 The <a href="/pkg/sync/#WaitGroup"><code>WaitGroup</code></a> implementation in
 1255 package <a href="/pkg/sync/"><code>sync</code></a>
 1256 now diagnoses code that races a call to <a href="/pkg/sync/#WaitGroup.Add"><code>Add</code></a>
 1257 against a return from <a href="/pkg/sync/#WaitGroup.Wait"><code>Wait</code></a>.
 1258 If it detects this condition, the implementation panics.
 1259 </li>
 1261 <li>
 1262 In the <a href="/pkg/syscall/"><code>syscall</code></a> package,
 1263 the Linux <code>SysProcAttr</code> struct now has a
 1264 <code>GidMappingsEnableSetgroups</code> field, made necessary
 1265 by security changes in Linux 3.19.
 1266 On all Unix systems, the struct also has new <code>Foreground</code> and <code>Pgid</code> fields
 1267 to provide more control when exec'ing.
 1268 On Darwin, there is now a <code>Syscall9</code> function
 1269 to support calls with too many arguments.
 1270 </li>
 1272 <li>
 1273 The <a href="/pkg/testing/quick/"><code>testing/quick</code></a> will now
 1274 generate <code>nil</code> values for pointer types,
 1275 making it possible to use with recursive data structures.
 1276 Also, the package now supports generation of array types.
 1277 </li>
 1279 <li>
 1280 In the <a href="/pkg/text/template/"><code>text/template</code></a> and
 1281 <a href="/pkg/html/template/"><code>html/template</code></a> packages,
 1282 integer constants too large to be represented as a Go integer now trigger a
 1283 parse error. Before, they were silently converted to floating point, losing
 1284 precision.
 1285 </li>
 1287 <li>
 1288 Also in the <a href="/pkg/text/template/"><code>text/template</code></a> and
 1289 <a href="/pkg/html/template/"><code>html/template</code></a> packages,
 1290 a new <a href="/pkg/text/template/#Template.Option"><code>Option</code></a> method
 1291 allows customization of the behavior of the template during execution.
 1292 The sole implemented option allows control over how a missing key is
 1293 handled when indexing a map.
 1294 The default, which can now be overridden, is as before: to continue with an invalid value.
 1295 </li>
 1297 <li>
 1298 The <a href="/pkg/time/"><code>time</code></a> package's
 1299 <code>Time</code> type has a new method
 1300 <a href="/pkg/time/#Time.AppendFormat"><code>AppendFormat</code></a>,
 1301 which can be used to avoid allocation when printing a time value.
 1302 </li>
 1304 <li>
 1305 The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated
 1306 support throughout the system has been upgraded from version 7.0 to
 1307 <a href="http://www.unicode.org/versions/Unicode8.0.0/">Unicode 8.0</a>.
 1308 </li>
 1310 </ul>