Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1 | <!--{ |
| 2 | "Title": "Go 1.10 Release Notes", |
| 3 | "Path": "/doc/go1.10", |
| 4 | "Template": true |
| 5 | }--> |
| 6 | |
| 7 | <!-- |
| 8 | NOTE: In this document and others in this directory, the convention is to |
| 9 | set fixed-width phrases with non-fixed-width spaces, as in |
| 10 | <code>hello</code> <code>world</code>. |
| 11 | Do not send CLs removing the interior tags from such phrases. |
| 12 | --> |
| 13 | |
| 14 | <style> |
| 15 | ul li { margin: 0.5em 0; } |
| 16 | </style> |
| 17 | |
| 18 | <h2 id="introduction">DRAFT RELEASE NOTES - Introduction to Go 1.10</h2> |
| 19 | |
| 20 | <p><strong> |
| 21 | Go 1.10 is not yet released. These are work-in-progress |
| 22 | release notes. Go 1.10 is expected to be released in February 2018. |
| 23 | </strong></p> |
| 24 | |
| 25 | <p> |
| 26 | The latest Go release, version 1.10, arrives six months after <a href="go1.9">go1.9</a>. |
| 27 | Most of its changes are in the implementation of the toolchain, runtime, and libraries. |
| 28 | As always, the release maintains the Go 1 <a href="/doc/go1compat.html">promise of compatibility</a>. |
| 29 | We expect almost all Go programs to continue to compile and run as before. |
| 30 | </p> |
| 31 | |
| 32 | <p> |
| 33 | OVERVIEW HERE |
| 34 | </p> |
| 35 | |
| 36 | <h2 id="language">Changes to the language</h2> |
| 37 | |
| 38 | <p> |
Andrew Bonventre | dbe559e | 2017-12-11 17:05:14 -0500 | [diff] [blame] | 39 | There are no significant changes to the language. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 40 | </p> |
| 41 | |
| 42 | <p><!-- CL 60230 --> |
| 43 | A corner case involving shifts by untyped constants has been clarified, |
| 44 | and as a result the compilers have been updated to allow the index expression |
| 45 | <code>x[1.0</code> <code><<</code> <code>s]</code> where <code>s</code> is an untyped constant; |
| 46 | the <a href="/pkg/go/types/">go/types</a> package already did. |
| 47 | </p> |
| 48 | |
| 49 | <p><!-- CL 73233 --> |
| 50 | The grammar for method expressions has been updated to relax the |
| 51 | syntax to allow any type expression as a receiver; |
| 52 | this matches what the compilers were already implementing. |
| 53 | For example, <code>struct{io.Reader}.Read</code> is a valid, if unusual, |
| 54 | method expression that the compilers already accepted and is |
| 55 | now permitted by the language grammar. |
| 56 | </p> |
| 57 | |
| 58 | <h2 id="ports">Ports</h2> |
| 59 | |
| 60 | <p> |
| 61 | There are no new supported operating systems or processor architectures in this release. |
| 62 | Most of the work has focused on strengthening the support for existing ports, |
| 63 | in particular <a href="#asm">new instructions in the assembler</a> |
| 64 | and improvements to the code generated by the compilers. |
| 65 | </p> |
| 66 | |
Russ Cox | 9b8d604 | 2017-12-06 13:38:10 -0500 | [diff] [blame] | 67 | <p id="darwin"> |
Russ Cox | 81c19cc | 2017-12-13 11:00:14 -0500 | [diff] [blame] | 68 | Go 1.10 is the last release that will run on OS X 10.8 Mountain Lion or on OS X 10.9 Mavericks. |
| 69 | Go 1.11 will require OS X 10.10 Yosemite or later. |
Russ Cox | 9b8d604 | 2017-12-06 13:38:10 -0500 | [diff] [blame] | 70 | </p> |
| 71 | |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 72 | <p id="freebsd"> |
| 73 | As <a href="go1.9#freebsd">announced in the Go 1.9 release notes</a>, |
| 74 | Go 1.10 now requires FreeBSD 10.3 or later; |
| 75 | support for FreeBSD 9.3 has been removed. |
| 76 | </p> |
| 77 | |
Brad Fitzpatrick | 617fc0f | 2017-12-06 18:44:13 +0000 | [diff] [blame] | 78 | <p id="netbsd"> |
Russ Cox | 81c19cc | 2017-12-13 11:00:14 -0500 | [diff] [blame] | 79 | Go now runs on NetBSD again but requires the unreleased NetBSD 8. |
Brad Fitzpatrick | 513a469 | 2017-12-13 21:18:28 +0000 | [diff] [blame] | 80 | Only <code>GOARCH</code> <code>amd64</code> and <code>386</code> have |
| 81 | been fixed. The <code>arm</code> port is still broken. |
Brad Fitzpatrick | 617fc0f | 2017-12-06 18:44:13 +0000 | [diff] [blame] | 82 | </p> |
| 83 | |
| 84 | <p id="openbsd"> |
| 85 | Go 1.10 is the last release that will run on OpenBSD 6.0. |
| 86 | Go 1.11 will require OpenBSD 6.2. |
| 87 | </p> |
| 88 | |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 89 | <p id="mips"> |
| 90 | On 32-bit MIPS systems, the new environment variable settings |
| 91 | <code>GOMIPS=hardfloat</code> (the default) and |
| 92 | <code>GOMIPS=softfloat</code> select whether to use |
| 93 | hardware instructions or software emulation for floating-point computations. |
| 94 | </p> |
| 95 | |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 96 | <h2 id="tools">Tools</h2> |
| 97 | |
| 98 | <h3 id="goroot">Default GOROOT & GOTMPDIR</h3> |
| 99 | |
| 100 | <p> |
| 101 | TODO: default GOROOT changes in cmd/go |
| 102 | TODO: computed GOROOT change |
| 103 | </p> |
| 104 | |
| 105 | <p> |
| 106 | By default, the go tool creates its temporary files and directories |
| 107 | in the system temporary directory (for example, <code>$TMPDIR</code> on Unix). |
| 108 | If the new environment variable <code>$GOTMPDIR</code> is set, |
| 109 | the go tool will creates its temporary files and directories in that directory instead. |
| 110 | </p> |
| 111 | |
| 112 | <h3 id="build">Build & Install</h3> |
| 113 | |
| 114 | <p> |
| 115 | The <code>go</code> <code>build</code> command now detects out-of-date packages |
| 116 | purely based on the content of source files, specified build flags, and metadata stored in the compiled packages. |
| 117 | Modification times are no longer consulted or relevant. |
| 118 | The old advice to add <code>-a</code> to force a rebuild in cases where |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 119 | the modification times were misleading for one reason or another |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 120 | (for example, changes in build flags) is no longer necessary: |
| 121 | builds now always detect when packages must be rebuilt. |
| 122 | (If you observe otherwise, please file a bug.) |
| 123 | </p> |
| 124 | |
| 125 | <p> |
| 126 | The <code>go</code> <code>build</code> <code>-asmflags</code>, <code>-gcflags</code>, <code>-gccgoflags</code>, and <code>-ldflags</code> options |
| 127 | now apply by default only to the packages listed directly on the command line. |
| 128 | For example, <code>go</code> <code>build</code> <code>-gcflags=-m</code> <code>mypkg</code> |
| 129 | passes the compiler the <code>-m</code> flag when building <code>mypkg</code> |
| 130 | but not its dependencies. |
| 131 | The new, more general form <code>-asmflags=pattern=flags</code> (and similarly for the others) |
| 132 | applies the <code>flags</code> only to the packages matching the pattern. |
| 133 | For example: <code>go</code> <code>install</code> <code>-ldflags=cmd/gofmt=-X=main.version=1.2.3</code> <code>cmd/...</code> |
| 134 | installs all the commands matching <code>cmd/...</code> but only applies the <code>-X</code> option |
| 135 | to the linker flags for <code>cmd/gofmt</code>. |
Russ Cox | c56fda6 | 2017-12-06 00:01:26 -0500 | [diff] [blame] | 136 | For more details, see <a href="/cmd/go/#hdr-Compile_packages_and_dependencies"><code>go</code> <code>help</code> <code>build</code></a>. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 137 | </p> |
| 138 | |
| 139 | <p> |
| 140 | The <code>go</code> <code>build</code> command now maintains a cache of |
| 141 | recently built packages, separate from the installed packages in <code>$GOROOT/pkg</code> or <code>$GOPATH/pkg</code>. |
| 142 | The effect of the cache should be to speed builds that do not explicitly install packages |
| 143 | or when switching between different copies of source code (for example, when changing |
| 144 | back and forth between different branches in a version control system). |
| 145 | The old advice to add the <code>-i</code> flag for speed, as in <code>go</code> <code>build</code> <code>-i</code> |
| 146 | or <code>go</code> <code>test</code> <code>-i</code>, |
| 147 | is no longer necessary: builds run just as fast without <code>-i</code>. |
| 148 | For more details, see <a href="TODO"><code>go</code> <code>help</code> <code>cache</code></a>. |
| 149 | </p> |
| 150 | |
| 151 | <p> |
Tobias Klauser | d1fa587 | 2017-12-08 14:43:40 +0100 | [diff] [blame] | 152 | The <code>go</code> <code>install</code> command now installs only the |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 153 | packages and commands listed directly on the command line. |
| 154 | For example, <code>go</code> <code>install</code> <code>cmd/gofmt</code> |
| 155 | installs the gofmt program but not any of the packages on which it depends. |
| 156 | The new build cache makes future commands still run as quickly as if the |
| 157 | dependencies had been installed. |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 158 | To force the installation of dependencies, use the new |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 159 | <code>go</code> <code>install</code> <code>-i</code> flag. |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 160 | Installing dependency packages should not be necessary in general, |
| 161 | and the very concept of installed packages may disappear in a future release. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 162 | </p> |
| 163 | |
| 164 | <p> |
| 165 | Many details of the <code>go</code> <code>build</code> implementation have changed to support these improvements. |
| 166 | One new requirement implied by these changes is that |
| 167 | binary-only packages must now declare accurate import blocks in their |
| 168 | stub source code, so that those imports can be made available when |
| 169 | linking a program using the binary-only package. |
Russ Cox | c56fda6 | 2017-12-06 00:01:26 -0500 | [diff] [blame] | 170 | For more details, see <a href="/cmd/go/#hdr-File_types"><code>go</code> <code>help</code> <code>filetype</code></a>. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 171 | </p> |
| 172 | |
| 173 | <h3 id="test">Test</h3> |
| 174 | |
| 175 | <p> |
| 176 | The <code>go</code> <code>test</code> command now caches test results: |
| 177 | if the test executable and command line match a previous run |
| 178 | and the files and environment variables consulted by that run |
| 179 | have not changed either, <code>go</code> <code>test</code> will print |
| 180 | the previous test output, replacing the elapsed time with the string “(cached).” |
| 181 | Test caching applies only to successful test results; |
| 182 | only to <code>go</code> <code>test</code> |
| 183 | commands with an explicit list of packages; and |
| 184 | only to command lines using a subset of the |
| 185 | <code>-cpu</code>, <code>-list</code>, <code>-parallel</code>, |
| 186 | <code>-run</code>, <code>-short</code>, and <code>-v</code> test flags. |
| 187 | The idiomatic way to bypass test caching is to use <code>-count=1</code>. |
| 188 | </p> |
| 189 | |
| 190 | <p> |
| 191 | The <code>go</code> <code>test</code> command now automatically runs |
| 192 | <code>go</code> <code>vet</code> on the package being tested, |
| 193 | to identify significant problems before running the test. |
| 194 | Any such problems are treated like build errors and prevent execution of the test. |
| 195 | Only a high-confidence subset of the available <code>go</code> <code>vet</code> |
| 196 | checks are enabled for this automatic check. |
| 197 | To disable the running of <code>go</code> <code>vet</code>, use |
| 198 | <code>go</code> <code>test</code> <code>-vet=off</code>. |
| 199 | </p> |
| 200 | |
| 201 | <p> |
| 202 | The <code>go</code> <code>test</code> <code>-coverpkg</code> flag now |
| 203 | interprets its argument as a comma-separated list of patterns to match against |
| 204 | the dependencies of each test, not as a list of packages to load anew. |
| 205 | For example, <code>go</code> <code>test</code> <code>-coverpkg=all</code> |
| 206 | is now a meaningful way to run a test with coverage enabled for the test package |
| 207 | and all its dependencies. |
| 208 | Also, the <code>go</code> <code>test</code> <code>-coverprofile</code> option is now |
| 209 | supported when running multiple tests. |
| 210 | </p> |
| 211 | |
| 212 | <p> |
| 213 | In case of failure due to timeout, tests are now more likely to write their profiles before exiting. |
| 214 | </p> |
| 215 | |
| 216 | <p> |
| 217 | The <code>go</code> <code>test</code> command now always |
| 218 | merges the standard output and standard error from a given test binary execution |
| 219 | and writes both to <code>go</code> <code>test</code>'s standard output. |
| 220 | In past releases, <code>go</code> <code>test</code> only applied this |
| 221 | merging most of the time. |
| 222 | </p> |
| 223 | |
| 224 | <p> |
| 225 | The <code>go</code> <code>test</code> <code>-v</code> output |
| 226 | now includes <code>PAUSE</code> and <code>CONT</code> status update |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 227 | lines to mark when <a href="/pkg/testing/#T.Parallel">parallel tests</a> pause and continue. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 228 | </p> |
| 229 | |
| 230 | <p> |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 231 | The new <code>go</code> <code>test</code> <code>-failfast</code> flag |
| 232 | disables running additional tests after any test fails. |
| 233 | Note that tests running in parallel with the failing test are allowed to complete. |
| 234 | </p> |
| 235 | |
| 236 | <p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 237 | Finally, the new <code>go</code> <code>test</code> <code>-json</code> flag |
| 238 | filters test output through the new command |
| 239 | <code>go</code> <code>tool</code> <code>test2json</code> |
| 240 | to produce a machine-readable JSON-formatted description of test execution. |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 241 | This allows the creation of rich presentations of test execution |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 242 | in IDEs and other tools. |
| 243 | </p> |
| 244 | |
| 245 | |
| 246 | <p> |
| 247 | For more details about all these changes, |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 248 | see <a href="/cmd/go/#hdr-Test_packages"><code>go</code> <code>help</code> <code>test</code></a> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 249 | and the <a href="/cmd/test2json/">test2json documentation</a>. |
| 250 | </p> |
| 251 | |
| 252 | <h3 id="cgo">Cgo</h3> |
| 253 | |
| 254 | <p> |
| 255 | Cgo now implements a C typedef like “<code>typedef</code> <code>X</code> <code>Y</code>;” using a Go type alias, |
| 256 | so that Go code may use the types <code>C.X</code> and <code>C.Y</code> interchangeably. |
| 257 | It also now supports the use of niladic function-like macros. |
| 258 | Also, the documentation has been updated to clarify that |
| 259 | Go structs and Go arrays are not supported in the type signatures of cgo-exported functions. |
| 260 | </p> |
| 261 | |
| 262 | <p> |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 263 | TODO: CL 70890 "permit passing string values directly between Go and C." |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 264 | </p> |
| 265 | |
| 266 | <p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 267 | During toolchain bootstrap, the environment variables <code>CC</code> and <code>CC_FOR_TARGET</code> specify |
| 268 | the default C compiler that the resulting toolchain will use for host and target builds, respectively. |
| 269 | However, if the toolchain will be used with multiple targets, it may be necessary to specify a different C compiler for each |
| 270 | (for example, a different compiler for <code>darwin/arm64</code> versus <code>linux/ppc64le</code>). |
| 271 | The new set of environment variables <code>CC_FOR_<i>goos</i>_<i>goarch</i></code> |
| 272 | allows specifying a different default C compiler for each target. |
| 273 | Note that these variables only apply during toolchain bootstrap, |
| 274 | to set the defaults used by the resulting toolchain. |
| 275 | Later <code>go</code> <code>build</code> commands refer to the <code>CC</code> environment |
| 276 | variable or else the built-in default. |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 277 | </p> |
| 278 | |
| 279 | <p> |
Keith Randall | 25363de | 2017-12-08 08:38:15 -0800 | [diff] [blame] | 280 | Cgo now translates some C types that would normally map to a pointer |
| 281 | type in Go, to a <code>uintptr</code> instead. These types include |
| 282 | the <code>CFTypeRef</code> hierarchy in Darwin's CoreFoundation |
| 283 | framework and the <code>jobject</code> hierarchy in Java's JNI |
| 284 | interface. |
| 285 | </p> |
| 286 | |
| 287 | <p> |
| 288 | These types must be <code>uintptr</code> on the Go side because they |
| 289 | would otherwise confuse the Go garbage collector; they are sometimes |
| 290 | not really pointers but data structures encoded in a pointer type. |
| 291 | </p> |
| 292 | |
| 293 | <p> |
| 294 | Because of this change, values of the affected types need to be |
| 295 | zero-initialized with the constant <code>0</code> instead of the |
| 296 | constant <code>nil</code>. Go 1.10 provides <code>gofix</code> |
| 297 | modules to help with that rewrite: |
| 298 | <pre> |
Tobias Klauser | fa90442 | 2017-12-14 10:48:53 +0100 | [diff] [blame] | 299 | go tool fix -r cftype <pkg> |
| 300 | go tool fix -r jni <pkg> |
Keith Randall | 25363de | 2017-12-08 08:38:15 -0800 | [diff] [blame] | 301 | </pre> |
| 302 | </p> |
| 303 | |
| 304 | <p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 305 | For more details, see the <a href="/cmd/cgo/">cgo documentation</a>. |
| 306 | </p> |
| 307 | |
| 308 | <h3 id="doc">Doc</h3> |
| 309 | |
| 310 | <p> |
| 311 | The <code>go</code> <code>doc</code> tool now adds functions returning slices of <code>T</code> or <code>*T</code> |
| 312 | to the display of type <code>T</code>, similar to the existing behavior for functions returning single <code>T</code> or <code>*T</code> results. |
| 313 | For example: |
| 314 | </p> |
| 315 | |
| 316 | <pre> |
| 317 | $ go doc mail.Address |
| 318 | package mail // import "net/mail" |
| 319 | |
| 320 | type Address struct { |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 321 | Name string |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 322 | Address string |
| 323 | } |
| 324 | Address represents a single mail address. |
| 325 | |
| 326 | func ParseAddress(address string) (*Address, error) |
| 327 | func ParseAddressList(list string) ([]*Address, error) |
| 328 | func (a *Address) String() string |
| 329 | $ |
| 330 | </pre> |
| 331 | |
| 332 | <p> |
| 333 | Previously, <code>ParseAddressList</code> was only shown in the package overview (<code>go</code> <code>doc</code> <code>mail</code>). |
| 334 | </p> |
| 335 | |
| 336 | <h3 id="fix">Fix</h3> |
| 337 | |
| 338 | <p> |
| 339 | The <code>go</code> <code>fix</code> tool now replaces imports of <code>"golang.org/x/net/context"</code> |
| 340 | with <code>"context"</code>. |
| 341 | (Forwarding aliases in the former make it completely equivalent to the latter when using Go 1.9 or later.) |
| 342 | </p> |
| 343 | |
| 344 | <h3 id="get">Get</h3> |
| 345 | |
| 346 | <p> |
| 347 | The <code>go</code> <code>get</code> command now supports Fossil source code repositories. |
| 348 | </p> |
| 349 | |
| 350 | <h3 id="pprof">Pprof</h3> |
| 351 | |
| 352 | <p> |
| 353 | The blocking and mutex profiles produced by the <code>runtime/pprof</code> package |
| 354 | now include symbol information, so they can be viewed |
| 355 | in <code>go</code> <code>tool</code> <code>pprof</code> |
| 356 | without the binary that produced the profile. |
| 357 | (All other profile types were changed to include symbol information in Go 1.9.) |
| 358 | </p> |
| 359 | |
| 360 | <p> |
| 361 | The <a href="/cmd/pprof/"><code>go</code> <code>tool</code> <code>pprof</code></a> profile visualizer has been updated to |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 362 | the latest version from <a href="https://github.com/google/pprof">github.com/google/pprof</a>, |
| 363 | which includes an updated web interface. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 364 | </p> |
| 365 | |
| 366 | <h3 id="vet">Vet</h3> |
| 367 | |
| 368 | <p> |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 369 | The <a href="/cmd/vet/"><code>go</code> <code>vet</code></a> command now always has access to |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 370 | complete, up-to-date type information when checking packages, even for packages using cgo or vendored imports. |
| 371 | The reports should be more accurate as a result. |
| 372 | Note that only <code>go</code> <code>vet</code> has access to this information; |
| 373 | the more low-level <code>go</code> <code>tool</code> <code>vet</code> does not |
| 374 | and should be avoided except when working on <code>vet</code> itself. |
| 375 | (As of Go 1.9, <code>go</code> <code>vet</code> provides access to all the same flags as |
| 376 | <code>go</code> <code>tool</code> <code>vet</code>.) |
| 377 | </p> |
| 378 | |
| 379 | <h3 id="diag">Diagnostics</h3> |
| 380 | |
| 381 | <p> |
| 382 | This release includes a new <a href="/doc/diagnostics.html">overview of available Go program diagnostic tools</a>. |
| 383 | </p> |
| 384 | |
| 385 | <h3 id="gofmt">Gofmt</h3> |
| 386 | |
| 387 | <p> |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 388 | Two minor details of the default formatting of Go source code have changed. |
| 389 | First, certain complex three-index slice expressions previously formatted like |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 390 | <code>x[i+1</code> <code>:</code> <code>j:k]</code> and now |
| 391 | format with more consistent spacing: <code>x[i+1</code> <code>:</code> <code>j</code> <code>:</code> <code>k]</code>. |
| 392 | Second, single-method interface literals written on a single line, |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 393 | which are sometimes used in type assertions, |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 394 | are no longer split onto multiple lines. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 395 | </p> |
| 396 | |
| 397 | <p> |
| 398 | Note that these kinds of minor updates to gofmt are expected from time to time. |
| 399 | In general, we recommend against building systems that check that source code |
| 400 | matches the output of a specific version of gofmt. |
| 401 | For example, a continuous integration test that fails if any code already checked into |
| 402 | a repository is not “properly formatted” is inherently fragile and not recommended. |
| 403 | </p> |
| 404 | |
| 405 | <p> |
| 406 | If multiple programs must agree about which version of gofmt is used to format a source file, |
| 407 | we recommend that they do this by arranging to invoke the same gofmt binary. |
| 408 | For example, in the Go open source repository, we arrange for goimports and |
| 409 | our Git pre-commit hook to agree about source code formatting by having both |
| 410 | invoke the gofmt binary found in the current path. |
| 411 | TODO: Make goimports actually do that. #22695. |
| 412 | As another example, inside Google we arrange that source code presubmit |
| 413 | checks run a gofmt binary maintained at a fixed path in a shared, distributed file system; |
| 414 | that on engineering workstations <code>/usr/bin/gofmt</code> |
| 415 | is a symbolic link to that same path; |
| 416 | and that all editor integrations used for Google development |
| 417 | explicitly invoke /usr/bin/gofmt. |
| 418 | TODO: TMI? |
| 419 | </p> |
| 420 | |
| 421 | <h3 id="compiler">Compiler Toolchain</h3> |
| 422 | |
| 423 | <p> |
| 424 | The compiler includes many improvements to the performance of generated code, |
| 425 | spread fairly evenly across the supported architectures. |
| 426 | </p> |
| 427 | |
| 428 | <p> |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 429 | The DWARF debug information recorded in binaries has been improved in a few ways: |
| 430 | constant values are now recorded; |
| 431 | line number information is more accurate, making source-level stepping through a program work better; |
| 432 | and each package is now presented as its own DWARF compilation unit. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 433 | </p> |
| 434 | |
| 435 | <p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 436 | The various <a href="https://docs.google.com/document/d/1nr-TQHw_er6GOQRsF6T43GGhFDelrAP0NqSS_00RgZQ/edit">build modes</a> |
| 437 | has been ported to more systems. |
| 438 | Specifically, <code>c-shared</code> now works on <code>linux/ppc64le</code>, <code>windows/386</code>, and <code>windows/amd64</code>; |
| 439 | <code>pie</code> now works on <code>darwin/amd64</code> and also forces the use of external linking on all systems; |
Brad Fitzpatrick | 132b528 | 2017-12-13 01:20:02 +0000 | [diff] [blame] | 440 | and <code>plugin</code> now works on <code>linux/ppc64le</code> and <code>darwin/amd64</code>. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 441 | </p> |
| 442 | |
| 443 | <p> |
| 444 | The <code>linux/ppc64le</code> port now requires the use of external linking |
| 445 | with any programs that use cgo, even uses by the standard library. |
| 446 | </p> |
| 447 | |
| 448 | <h3 id="asm">Assembler</h3> |
| 449 | |
| 450 | <p> |
| 451 | For the ARM 32-bit port, the assembler now supports the instructions |
| 452 | <code><small>BFC</small></code>, |
| 453 | <code><small>BFI</small></code>, |
| 454 | <code><small>BFX</small></code>, |
| 455 | <code><small>BFXU</small></code>, |
| 456 | <code><small>FMULAD</small></code>, |
| 457 | <code><small>FMULAF</small></code>, |
| 458 | <code><small>FMULSD</small></code>, |
| 459 | <code><small>FMULSF</small></code>, |
| 460 | <code><small>FNMULAD</small></code>, |
| 461 | <code><small>FNMULAF</small></code>, |
| 462 | <code><small>FNMULSD</small></code>, |
| 463 | <code><small>FNMULSF</small></code>, |
| 464 | <code><small>MULAD</small></code>, |
| 465 | <code><small>MULAF</small></code>, |
| 466 | <code><small>MULSD</small></code>, |
| 467 | <code><small>MULSF</small></code>, |
| 468 | <code><small>NMULAD</small></code>, |
| 469 | <code><small>NMULAF</small></code>, |
| 470 | <code><small>NMULD</small></code>, |
| 471 | <code><small>NMULF</small></code>, |
| 472 | <code><small>NMULSD</small></code>, |
| 473 | <code><small>NMULSF</small></code>, |
| 474 | <code><small>XTAB</small></code>, |
| 475 | <code><small>XTABU</small></code>, |
| 476 | <code><small>XTAH</small></code>, |
| 477 | and |
| 478 | <code><small>XTAHU</small></code>. |
| 479 | </p> |
| 480 | |
| 481 | <p> |
| 482 | For the ARM 64-bit port, the assembler now supports the |
| 483 | <code><small>VADD</small></code>, |
| 484 | <code><small>VADDP</small></code>, |
| 485 | <code><small>VADDV</small></code>, |
| 486 | <code><small>VAND</small></code>, |
| 487 | <code><small>VCMEQ</small></code>, |
| 488 | <code><small>VDUP</small></code>, |
| 489 | <code><small>VEOR</small></code>, |
| 490 | <code><small>VLD1</small></code>, |
| 491 | <code><small>VMOV</small></code>, |
| 492 | <code><small>VMOVI</small></code>, |
| 493 | <code><small>VMOVS</small></code>, |
| 494 | <code><small>VORR</small></code>, |
| 495 | <code><small>VREV32</small></code>, |
| 496 | and |
| 497 | <code><small>VST1</small></code> |
| 498 | instructions. |
| 499 | </p> |
| 500 | |
| 501 | <p> |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 502 | For the PowerPC 64-bit port, the assembler now supports the POWER9 instructions |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 503 | <code><small>ADDEX</small></code>, |
| 504 | <code><small>CMPEQB</small></code>, |
| 505 | <code><small>COPY</small></code>, |
| 506 | <code><small>DARN</small></code>, |
| 507 | <code><small>LDMX</small></code>, |
| 508 | <code><small>MADDHD</small></code>, |
| 509 | <code><small>MADDHDU</small></code>, |
| 510 | <code><small>MADDLD</small></code>, |
| 511 | <code><small>MFVSRLD</small></code>, |
| 512 | <code><small>MTVSRDD</small></code>, |
| 513 | <code><small>MTVSRWS</small></code>, |
| 514 | <code><small>PASTECC</small></code>, |
| 515 | <code><small>VCMPNEZB</small></code>, |
| 516 | <code><small>VCMPNEZBCC</small></code>, |
| 517 | and |
| 518 | <code><small>VMSUMUDM</small></code>. |
| 519 | </p> |
| 520 | |
| 521 | <p> |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 522 | For the S390X port, the assembler now supports the |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 523 | <code><small>TMHH</small></code>, |
| 524 | <code><small>TMHL</small></code>, |
| 525 | <code><small>TMLH</small></code>, |
| 526 | and |
| 527 | <code><small>TMLL</small></code> |
| 528 | instructions. |
| 529 | </p> |
| 530 | |
| 531 | <p> |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 532 | For the X86 64-bit port, the assembler now supports 359 new instructions, |
| 533 | including the full AVX, AVX2, BMI, BMI2, F16C, FMA3, SSE2, SSE3, SSSE3, SSE4.1, and SSE4.2 extension sets. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 534 | The assembler also no longer implements <code><small>MOVL</small></code> <code><small>$0,</small></code> <code><small>AX</small></code> |
| 535 | as an <code><small>XORL</small></code> instruction, |
| 536 | to avoid clearing the condition flags unexpectedly. |
| 537 | </p> |
| 538 | |
| 539 | <h3 id="gccgo">Gccgo</h3> |
| 540 | |
| 541 | <p> |
| 542 | TODO: Words about GCC 8 and Go 1.10. |
| 543 | </p> |
| 544 | |
| 545 | <h2 id="runtime">Runtime</h2> |
| 546 | |
| 547 | <p> |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 548 | The behavior of nested calls to |
| 549 | <a href="/pkg/runtime/#LockOSThread"><code>LockOSThread</code></a> and |
| 550 | <a href="/pkg/runtime/#UnlockOSThread"><code>UnlockOSThread</code></a> |
| 551 | has changed. |
| 552 | These functions control whether a goroutine is locked to a specific operating system thread, |
| 553 | so that the goroutine only runs on that thread, and the thread only runs that goroutine. |
| 554 | Previously, calling <code>LockOSThread</code> more than once in a row |
| 555 | was equivalent to calling it once, and a single <code>UnlockOSThread</code> |
| 556 | always unlocked the thread. |
| 557 | Now, the calls nest: if <code>LockOSThread</code> is called multiple times, |
| 558 | <code>UnlockOSThread</code> must be called the same number of times |
| 559 | in order to unlock the thread. |
| 560 | Existing code that was careful not to nest these calls will remain correct. |
| 561 | Existing code that incorrectly assumed the calls nested will become correct. |
| 562 | Most uses of these functions in public Go source falls into the second category. |
| 563 | </p> |
| 564 | |
| 565 | <p> |
| 566 | Because one common use of <code>LockOSThread</code> and <code>UnlockOSThread</code> |
| 567 | is to allow Go code to reliably modify thread-local state (for example, Linux or Plan 9 name spaces), |
| 568 | the runtime now treats locked threads as unsuitable for reuse or for creating new threads. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 569 | </p> |
| 570 | |
| 571 | <p> |
| 572 | Stack traces no longer include implicit wrapper functions (previously marked <code><autogenerated></code>), |
| 573 | unless a fault or panic happens in the wrapper itself. |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 574 | As a result, skip counts passed to functions like <a href="/pkg/runtime/#Caller"><code>Caller</code></a> |
| 575 | should now always match the structure of the code as written, rather than depending on |
| 576 | optimization decisions and implementation details. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 577 | </p> |
| 578 | |
| 579 | <p> |
| 580 | There is no longer a limit on the <a href="/pkg/runtime/#GOMAXPROCS"><code>GOMAXPROCS</code></a> setting. |
| 581 | (In Go 1.9 the limit was 1024.) |
| 582 | </p> |
| 583 | |
Russ Cox | c56fda6 | 2017-12-06 00:01:26 -0500 | [diff] [blame] | 584 | <p> |
| 585 | TODO: Anything about CL 59970: "runtime: separate soft and hard heap limits"? |
| 586 | </p> |
| 587 | |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 588 | <h2 id="performance">Performance</h2> |
| 589 | |
| 590 | <p> |
| 591 | As always, the changes are so general and varied that precise |
| 592 | statements about performance are difficult to make. Most programs |
| 593 | should run a bit faster, due to speedups in the garbage collector, |
| 594 | better generated code, and optimizations in the core library. |
| 595 | </p> |
| 596 | |
| 597 | <h2 id="gc">Garbage Collector</h2> |
| 598 | |
| 599 | <p> |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 600 | Many applications should experience significantly lower allocation latency and overall performance overhead when the garbage collector is active. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 601 | </p> |
| 602 | |
| 603 | <h2 id="library">Core library</h2> |
| 604 | |
| 605 | <p> |
| 606 | All of the changes to the standard library are minor. |
| 607 | The changes in <a href="#bytes">bytes</a> |
| 608 | and <a href="#net/url">net/url</a> are the most likely to require updating of existing programs. |
| 609 | </p> |
| 610 | |
| 611 | <h3 id="minor_library_changes">Minor changes to the library</h3> |
| 612 | |
| 613 | <p> |
| 614 | As always, there are various minor changes and updates to the library, |
| 615 | made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a> |
| 616 | in mind. |
| 617 | </p> |
| 618 | |
| 619 | <dl id="archive/tar"><dt><a href="/pkg/archive/tar/">archive/tar</a></dt> |
| 620 | <dd> |
| 621 | <p> |
| 622 | In general, the handling of special header formats is significantly improved and expanded. |
| 623 | </p> |
| 624 | <p> |
| 625 | <a href="/pkg/archive/tar/#FileInfoHeader"><code>FileInfoHeader</code></a> has always |
| 626 | recorded the Unix UID and GID numbers from its <a href="/pkg/os/#FileInfo"><code>os.FileInfo</code></a> argument |
| 627 | (specifically, from the system-dependent information returned by the <code>FileInfo</code>'s <code>Sys</code> method) |
| 628 | in the returned <a href="/pkg/archive/tar/#Header"><code>Header</code></a>. |
| 629 | Now it also records the user and group names corresponding to those IDs, |
| 630 | as well as the major and minor device numbers for device files. |
| 631 | </p> |
| 632 | <p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 633 | The new <a href="/pkg/archive/tar/#Header"><code>Header.Format</code></a> field |
| 634 | of type <a href="/pkg/archive/tar/#Format"><code>Format</code></a> |
| 635 | controls which tar header format the <a href="/pkg/archive/tar/#Writer"><code>Writer</code></a> uses. |
| 636 | The default, as before, is to select the most widely-supported header type |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 637 | that can encode the fields needed by the header (USTAR if possible, or else PAX if possible, or else GNU). |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 638 | The <a href="/pkg/archive/tar/#Reader"><code>Reader</code></a> sets <code>Header.Format</code> for each header it reads. |
| 639 | </p> |
| 640 | <p> |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 641 | <code>Reader</code> and the <code>Writer</code> now support arbitrary PAX records, |
| 642 | using the new <a href="/pkg/archive/tar/#Header"><code>Header.PAXRecords</code></a> field, |
| 643 | a generalization of the existing <code>Xattrs</code> field. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 644 | </p> |
| 645 | <p> |
| 646 | The <code>Reader</code> no longer insists that the file name or link name in GNU headers |
| 647 | be valid UTF-8. |
| 648 | </p> |
| 649 | <p> |
| 650 | When writing PAX- or GNU-format headers, the <code>Writer</code> now includes |
| 651 | the <code>Header.AccessTime</code> and <code>Header.ChangeTime</code> fields (if set). |
| 652 | When writing PAX-format headers, the times include sub-second precision. |
| 653 | </p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 654 | </dl> |
| 655 | |
| 656 | <dl id="archive/zip"><dt><a href="/pkg/archive/zip/">archive/zip</a></dt> |
| 657 | <dd> |
| 658 | <p> |
| 659 | Go 1.10 adds more complete support for times and character set encodings in ZIP archives. |
| 660 | </p> |
| 661 | <p> |
| 662 | The original ZIP format used the standard MS-DOS encoding of year, month, day, hour, minute, and second into fields in two 16-bit values. |
| 663 | That encoding cannot represent time zones or odd seconds, so multiple extensions have been |
| 664 | introduced to allow richer encodings. |
| 665 | In Go 1.10, the <a href="/pkg/archive/zip/#Reader"><code>Reader</code></a> and <a href="/pkg/archive/zip/#Writer"><code>Writer</code></a> |
| 666 | now support the widely-understood Info-Zip extension that encodes the time separately in the 32-bit Unix “seconds since epoch” form. |
| 667 | The <a href="/pkg/archive/zip/#FileHeader"><code>FileHeader</code></a>'s new <code>Modified</code> field of type <a href="/pkg/time/#Time"><code>time.Time</code></a> |
| 668 | obsoletes the <code>ModifiedTime</code> and <code>ModifiedDate</code> fields, which continue to hold the MS-DOS encoding. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 669 | The <code>Reader</code> and <code>Writer</code> now adopt the common |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 670 | convention that a ZIP archive storing a time zone-independent Unix time |
| 671 | also stores the local time in the MS-DOS field, |
| 672 | so that the time zone offset can be inferred. |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 673 | For compatibility, the <a href="/pkg/archive/zip/#FileHeader.ModTime"><code>ModTime</code></a> and |
| 674 | <a href="/pkg/archive/zip/#FileHeader.SetModTime"><code>SetModTime</code></a> methods |
| 675 | behave the same as in earlier releases; new code should use <code>Modified</code> directly. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 676 | </p> |
| 677 | <p> |
| 678 | The header for each file in a ZIP archive has a flag bit indicating whether |
| 679 | the name and comment fields are encoded as UTF-8, as opposed to a system-specific default encoding. |
| 680 | In Go 1.8 and earlier, the <code>Writer</code> never set the UTF-8 bit. |
| 681 | In Go 1.9, the <code>Writer</code> changed to set the UTF-8 bit almost always. |
| 682 | This broke the creation of ZIP archives containing Shift-JIS file names. |
| 683 | In Go 1.10, the <code>Writer</code> now sets the UTF-8 bit only when |
| 684 | both the name and the comment field are valid UTF-8 and at least one is non-ASCII. |
| 685 | Because non-ASCII encodings very rarely look like valid UTF-8, the new |
| 686 | heuristic should be correct nearly all the time. |
| 687 | Setting a <code>FileHeader</code>'s new <code>NonUTF8</code> field to true |
| 688 | disables the heuristic entirely for that file. |
| 689 | </p> |
| 690 | <p> |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 691 | The <code>Writer</code> also now supports setting the end-of-central-directory record's comment field, |
| 692 | by calling the <code>Writer</code>'s new <a href="/pkg/archive/zip/#Writer.SetComment"><code>SetComment</code></a> method. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 693 | </p> |
| 694 | </dl> |
| 695 | |
| 696 | <dl id="bufio"><dt><a href="/pkg/bufio/">bufio</a></dt> |
| 697 | <dd> |
| 698 | <p> |
| 699 | The new <a href="/pkg/bufio/#Reader.Size"><code>Reader.Size</code></a> |
| 700 | and <a href="/pkg/bufio/#Writer.Size"><code>Writer.Size</code></a> |
| 701 | methods report the <code>Reader</code> or <code>Writer</code>'s underlying buffer size. |
| 702 | </p> |
| 703 | </dl> |
| 704 | |
| 705 | <dl id="bytes"><dt><a href="/pkg/bytes/">bytes</a></dt> |
| 706 | <dd> |
| 707 | <p> |
| 708 | The |
| 709 | <a href="/pkg/bytes/#Fields"><code>Fields</code></a>, |
| 710 | <a href="/pkg/bytes/#FieldsFunc"><code>FieldsFunc</code></a>, |
| 711 | <a href="/pkg/bytes/#Split"><code>Split</code></a>, |
| 712 | and |
| 713 | <a href="/pkg/bytes/#SplitAfter"><code>SplitAfter</code></a> |
| 714 | each already returned slices pointing into the same underlying array as its input. |
| 715 | Go 1.10 changes each of the returned subslices to have capacity equal to its length, |
| 716 | so that appending to a subslice will not overwrite adjacent data in the original input. |
| 717 | </p> |
| 718 | </dl> |
| 719 | |
| 720 | <dl id="crypto/cipher"><dt><a href="/pkg/crypto/cipher/">crypto/cipher</a></dt> |
| 721 | <dd> |
| 722 | <p> |
| 723 | <a href="/pkg/crypto/cipher/#NewOFB"><code>NewOFB</code></a> now panics if given |
| 724 | an initialization vector of incorrect length, like the other constructors in the |
| 725 | package always have. |
| 726 | (Previously it returned a nil <code>Stream</code> implementation.) |
| 727 | </p> |
| 728 | </dl> |
| 729 | |
| 730 | <dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt> |
| 731 | <dd> |
| 732 | <p> |
| 733 | The TLS server now advertises support for SHA-512 signatures when using TLS 1.2. |
| 734 | The server already supported the signatures, but some clients would not select |
| 735 | them unless explicitly advertised. |
| 736 | </p> |
| 737 | </dl> |
| 738 | |
| 739 | <dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt> |
| 740 | <dd> |
| 741 | <p> |
| 742 | Leaf certificate validation now enforces the name constraints for all |
| 743 | names contained in the certificate, not just the one name that a client has asked about. |
| 744 | Extended key usage restrictions are similarly now checked all at once. |
| 745 | As a result, after a certificate has been validated, now it can be trusted in its entirety. |
| 746 | It is no longer necessary to revalidate the certificate for each additional name |
| 747 | or key usage. |
| 748 | TODO: Link to docs that may not exist yet. |
| 749 | </p> |
| 750 | |
| 751 | <p> |
| 752 | Parsed certificates also now report URI names and IP, email, and URI constraints, using the new |
| 753 | <a href="/pkg/crypto/x509/#Certificate"><code>Certificate</code></a> fields |
| 754 | <code>URIs</code>, <code>PermittedIPRanges</code>, <code>ExcludedIPRanges</code>, |
| 755 | <code>PermittedEmailAddresses</code>, <code>ExcludedEmailAddresses</code>, |
| 756 | <code>PermittedURIDomains</code>, and <code>ExcludedURIDomains</code>. |
| 757 | </p> |
| 758 | |
| 759 | <p> |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 760 | The new <a href="/pkg/crypto/x509/#MarshalPKCS1PublicKey"><code>MarshalPKCS1PublicKey</code></a> |
| 761 | and <a href="/pkg/crypto/x509/#ParsePKCS1PublicKey"><code>ParsePKCS1PublicKey</code></a> |
| 762 | functions convert an RSA public key to and from PKCS#1-encoded form. |
| 763 | </p> |
| 764 | |
| 765 | <p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 766 | The new <a href="/pkg/crypto/x509/#MarshalPKCS8PrivateKey"><code>MarshalPKCS8PrivateKey</code></a> |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 767 | function converts a private key to PKCS#8-encoded form. |
| 768 | (<a href="/pkg/crypto/x509/#ParsePKCS8PrivateKey"><code>ParsePKCS8PrivateKey</code></a> |
| 769 | has existed since Go 1.) |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 770 | </p> |
| 771 | </dl> |
| 772 | |
| 773 | <dl id="crypto/x509/pkix"><dt><a href="/pkg/crypto/x509/pkix/">crypto/x509/pkix</a></dt> |
| 774 | <dd> |
| 775 | <p> |
| 776 | <a href="/pkg/crypto/x509/pkix/#Name"><code>Name</code></a> now implements a |
| 777 | <a href="/pkg/crypto/x509/pkix/#Name.String"><code>String</code></a> method that |
| 778 | formats the X.509 distinguished name in the standard RFC 2253 format. |
| 779 | </p> |
| 780 | </dl> |
| 781 | |
| 782 | <dl id="database/sql/driver"><dt><a href="/pkg/database/sql/driver/">database/sql/driver</a></dt> |
| 783 | <dd> |
| 784 | <p> |
| 785 | Drivers that want to construct a <a href="/pkg/database/sql/#DB"><code>sql.DB</code></a> for |
| 786 | their clients can now implement the <a href="/pkg/database/sql/driver/#Connector"><code>Connector</code></a> interface |
| 787 | and call the new <a href="/pkg/database/sql/#OpenDB"><code>sql.OpenDB</code></a> function, |
| 788 | instead of needing to encode all configuration into a string |
| 789 | passed to <a href="/pkg/database/sql/#Open"><code>sql.Open</code></a>. |
| 790 | </p> |
| 791 | <p> |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 792 | Drivers that want to parse the configuration string only once per <code>sql.DB</code> |
| 793 | instead of once per <a href="/pkg/database/sql/#Conn"><code>sql.Conn</code></a>, |
| 794 | or that want access to each <code>sql.Conn</code>'s underlying context, |
| 795 | can make their <a href="/pkg/database/sql/driver/#Driver"><code>Driver</code></a> |
| 796 | implementations also implement <a href="/pkg/database/sql/driver/#DriverContext"><code>DriverContext</code></a>'s |
| 797 | new <code>OpenConnector</code> method. |
| 798 | </p> |
| 799 | <p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 800 | Drivers that implement <a href="/pkg/database/sql/driver/#ExecerContext"><code>ExecerContext</code></a> |
| 801 | no longer need to implement <a href="/pkg/database/sql/driver/#Execer"><code>Execer</code></a>; |
| 802 | similarly, drivers that implement <a href="/pkg/database/sql/driver/#QueryerContext"><code>QueryerContext</code></a> |
| 803 | no longer need to implement <a href="/pkg/database/sql/driver/#Queryer"><code>Queryer</code></a>. |
| 804 | Previously, even if the context-based interfaces were implemented they were ignored |
| 805 | unless the non-context-based interfaces were also implemented. |
| 806 | </p> |
| 807 | <p> |
| 808 | To allow drivers to better isolate different clients using a cached driver connection in succession, |
| 809 | if a <a href="/pkg/database/sql/driver/#Conn"><code>Conn</code></a> implements the new |
| 810 | <a href="/pkg/database/sql/driver/#SessionResetter"><code>SessionResetter</code></a> interface, |
| 811 | <code>database/sql</code> will now call <code>ResetSession</code> before |
| 812 | reusing the <code>Conn</code> for a new client. |
| 813 | </p> |
| 814 | </dl> |
| 815 | |
| 816 | <dl id="debug/elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt> |
| 817 | <dd> |
| 818 | <p> |
| 819 | This release adds 348 new relocation constants divided between the relocation types |
| 820 | <a href="/pkg/debug/elf/#R_386"><code>R_386</code></a>, |
| 821 | <a href="/pkg/debug/elf/#R_AARCH64"><code>R_AARCH64</code></a>, |
| 822 | <a href="/pkg/debug/elf/#R_ARM"><code>R_ARM</code></a>, |
| 823 | <a href="/pkg/debug/elf/#R_PPC64"><code>R_PPC64</code></a>, |
| 824 | and |
| 825 | <a href="/pkg/debug/elf/#R_X86_64"><code>R_X86_64</code></a>. |
| 826 | </p> |
| 827 | </dl> |
| 828 | |
| 829 | <dl id="debug/macho"><dt><a href="/pkg/debug/macho/">debug/macho</a></dt> |
| 830 | <dd> |
| 831 | <p> |
| 832 | Go 1.10 adds support for reading relocations from Mach-O sections, |
| 833 | using the <a href="/pkg/debug/macho#Section"><code>Section</code></a> struct's new <code>Relocs</code> field |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 834 | and the new <a href="/pkg/debug/macho/#Reloc"><code>Reloc</code></a>, |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 835 | <a href="/pkg/debug/macho/#RelocTypeARM"><code>RelocTypeARM</code></a>, |
| 836 | <a href="/pkg/debug/macho/#RelocTypeARM64"><code>RelocTypeARM64</code></a>, |
| 837 | <a href="/pkg/debug/macho/#RelocTypeGeneric"><code>RelocTypeGeneric</code></a>, |
| 838 | and |
| 839 | <a href="/pkg/debug/macho/#RelocTypeX86_64"><code>RelocTypeX86_64</code></a> |
| 840 | types and associated constants. |
| 841 | </p> |
| 842 | <p> |
| 843 | Go 1.10 also adds support for the <code>LC_RPATH</code> load command, |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 844 | represented by the types |
| 845 | <a href="/pkg/debug/macho/#RpathCmd"><code>RpathCmd</code></a> and |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 846 | <a href="/pkg/debug/macho/#Rpath"><code>Rpath</code></a>, |
| 847 | and new <a href="/pkg/debug/macho/#pkg-constants">named constants</a> |
| 848 | for the various flag bits found in headers. |
| 849 | </p> |
| 850 | </dl> |
| 851 | |
| 852 | <dl id="encoding/asn1"><dt><a href="/pkg/encoding/asn1/">encoding/asn1</a></dt> |
| 853 | <dd> |
| 854 | <p> |
| 855 | <a href="/pkg/encoding/asn1/#Marshal"><code>Marshal</code></a> now correctly encodes |
| 856 | strings containing asterisks as type UTF8String instead of PrintableString, |
| 857 | unless the string is in a struct field with a tag forcing the use of PrintableString. |
| 858 | <code>Marshal</code> also now respects struct tags containing <code>application</code> directives. |
| 859 | </p> |
| 860 | <p> |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 861 | The new <a href="/pkg/encoding/asn1/#MarshalWithParams"><code>MarshalWithParams</code></a> |
| 862 | function marshals its argument as if the additional params were its associated |
| 863 | struct field tag. |
| 864 | </p> |
| 865 | <p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 866 | <a href="/pkg/encoding/asn1/#Unmarshal"><code>Unmarshal</code></a> now respects |
| 867 | struct field tags using the <code>explicit</code> and <code>tag</code> |
| 868 | directives. |
| 869 | </p> |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 870 | <p> |
| 871 | Both <code>Marshal</code> and <code>Unmarshal</code> now support a new struct field tag |
| 872 | <code>numeric</code>, indicating an ASN.1 NumericString. |
| 873 | </p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 874 | </dl> |
| 875 | |
| 876 | <dl id="encoding/csv"><dt><a href="/pkg/encoding/csv/">encoding/csv</a></dt> |
| 877 | <dd> |
| 878 | <p> |
| 879 | <a href="/pkg/encoding/csv/#Reader"><code>Reader</code></a> now disallows the use of |
| 880 | nonsensical <code>Comma</code> and <code>Comment</code> settings, |
| 881 | such as NUL, carriage return, newline, invalid runes, and the Unicode replacement character, |
| 882 | or setting <code>Comma</code> and <code>Comment</code> equal to each other. |
| 883 | </p> |
| 884 | <p> |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 885 | In the case of a syntax error in a CSV record that spans multiple input lines, <code>Reader</code> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 886 | now reports the line on which the record started in the <a href="/pkg/encoding/csv/#ParseError"><code>ParseError</code></a>'s new <code>StartLine</code> field. |
| 887 | </p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 888 | </dl> |
| 889 | |
| 890 | <dl id="encoding/hex"><dt><a href="/pkg/encoding/hex/">encoding/hex</a></dt> |
| 891 | <dd> |
| 892 | <p> |
| 893 | The new functions |
| 894 | <a href="/pkg/encoding/hex/#NewEncoder"><code>NewEncoder</code></a> |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 895 | and |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 896 | <a href="/pkg/encoding/hex/#NewDecoder"><code>NewDecoder</code></a> |
| 897 | provide streaming conversions to and from hexadecimal, |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 898 | analogous to equivalent functions already in |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 899 | <a href="/pkg/encoding/base32/">encoding/base32</a> |
| 900 | and |
| 901 | <a href="/pkg/encoding/base64/">encoding/base64</a>. |
| 902 | </p> |
| 903 | |
| 904 | <p> |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 905 | When the functions |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 906 | <a href="/pkg/encoding/hex/#Decode"><code>Decode</code></a> |
| 907 | and |
| 908 | <a href="/pkg/encoding/hex/#DecodeString"><code>DecodeString</code></a> |
| 909 | encounter malformed input, |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 910 | they now return the number of bytes already converted |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 911 | along with the error. |
| 912 | Previously they always returned a count of 0 with any error. |
| 913 | </p> |
| 914 | </dl> |
| 915 | |
| 916 | <dl id="encoding/json"><dt><a href="/pkg/encoding/json/">encoding/json</a></dt> |
| 917 | <dd> |
| 918 | <p> |
| 919 | The <a href="/pkg/encoding/json/#Decoder"><code>Decoder</code></a> |
| 920 | adds a new method |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 921 | <a href="/pkg/encoding/json/#Decoder.DisallowUnknownFields"><code>DisallowUnknownFields</code></a> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 922 | that causes it to report inputs with unknown JSON fields as a decoding error. |
| 923 | (The default behavior has always been to discard unknown fields.) |
| 924 | </p> |
Russ Cox | c56fda6 | 2017-12-06 00:01:26 -0500 | [diff] [blame] | 925 | |
| 926 | <p> |
| 927 | As a result of <a href="#reflect">fixing a reflect bug</a>, |
| 928 | <a href="/pkg/encoding/json/#Unmarshal"><code>Unmarshal</code></a> |
| 929 | can no longer decode into fields inside |
| 930 | embedded pointers to unexported struct types, |
| 931 | because it cannot initialize the unexported embedded pointer |
| 932 | to point at fresh storage. |
| 933 | <code>Unmarshal</code> now returns an error in this case. |
| 934 | </p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 935 | </dl> |
| 936 | |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 937 | <dl id="encoding/pem"><dt><a href="/pkg/encoding/pem/">encoding/pem</a></dt> |
| 938 | <dd> |
| 939 | <p> |
| 940 | <a href="/pkg/encoding/pem/#Encode"><code>Encode</code></a> |
| 941 | and |
| 942 | <a href="/pkg/encoding/pem/#EncodeToMemory"><code>EncodeToMemory</code></a> |
| 943 | no longer generate partial output when presented with a |
| 944 | block that is impossible to encode as PEM data. |
| 945 | </p> |
| 946 | </dl> |
| 947 | |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 948 | <dl id="encoding/xml"><dt><a href="/pkg/encoding/xml/">encoding/xml</a></dt> |
| 949 | <dd> |
| 950 | <p> |
| 951 | The new function |
| 952 | <a href="/pkg/encoding/xml/#NewTokenDecoder"><code>NewTokenDecoder</code></a> |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 953 | is like |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 954 | <a href="/pkg/encoding/xml/#NewDecoder"><code>NewDecoder</code></a> |
| 955 | but creates a decoder reading from a <a href="/pkg/encoding/xml/#TokenReader"><code>TokenReader</code></a> |
| 956 | instead of an XML-formatted byte stream. |
| 957 | This is meant to enable the construction of XML stream transformers in client libraries. |
| 958 | </p> |
| 959 | </dl> |
| 960 | |
| 961 | <dl id="flag"><dt><a href="/pkg/flag/">flag</a></dt> |
| 962 | <dd> |
| 963 | <p> |
| 964 | The default |
| 965 | <a href="/pkg/flag/#Usage"><code>Usage</code></a> function now prints |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 966 | its first line of output to |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 967 | <code>CommandLine.Output()</code> |
| 968 | instead of assuming <code>os.Stderr</code>, |
| 969 | so that the usage message is properly redirected for |
| 970 | clients using <code>CommandLine.SetOutput</code>. |
| 971 | </p> |
| 972 | <p> |
| 973 | <a href="/pkg/flag/#PrintDefaults"><code>PrintDefaults</code></a> now |
| 974 | adds appropriate indentation after newlines in flag usage strings, |
| 975 | so that multi-line usage strings display nicely. |
| 976 | </p> |
| 977 | <p> |
| 978 | <a href="/pkg/flag/#FlagSet"><code>FlagSet</code></a> adds new methods |
| 979 | <a href="/pkg/flag/#FlagSet.ErrorHandling"><code>ErrorHandling</code></a>, |
| 980 | <a href="/pkg/flag/#FlagSet.Name"><code>Name</code></a>, |
| 981 | and |
| 982 | <a href="/pkg/flag/#FlagSet.Output"><code>Output</code></a>, |
| 983 | to retrieve the settings passed to |
| 984 | <a href="/pkg/flag/#NewFlagSet"><code>NewFlagSet</code></a> |
| 985 | and |
| 986 | <a href="/pkg/flag/#FlagSet.SetOutput"><code>FlagSet.SetOutput</code></a>. |
| 987 | </p> |
| 988 | </dl> |
| 989 | |
| 990 | <dl id="go/doc"><dt><a href="/pkg/go/doc/">go/doc</a></dt> |
| 991 | <dd> |
| 992 | <p> |
| 993 | To support the <a href="#doc">doc change</a> described above, |
| 994 | functions returning slices of <code>T</code>, <code>*T</code>, <code>**T</code>, and so on |
| 995 | are now reported in <code>T</code>'s <a href="/pkg/go/doc/#Type"><code>Type</code></a>'s <code>Funcs</code> list, |
| 996 | instead of in the <a href="/pkg/go/doc/#Package"><code>Package</code></a>'s <code>Funcs</code> list. |
| 997 | </p> |
| 998 | </dl> |
| 999 | |
| 1000 | <dl id="go/importer"><dt><a href="/pkg/go/importer/">go/importer</a></dt> |
| 1001 | <dd> |
| 1002 | <p> |
| 1003 | The <a href="/pkg/go/importer/#For"><code>For</code></a> function now accepts a non-nil lookup argument. |
| 1004 | </p> |
| 1005 | </dl> |
| 1006 | |
| 1007 | <dl id="go/printer"><dt><a href="/pkg/go/printer/">go/printer</a></dt> |
| 1008 | <dd> |
| 1009 | <p> |
| 1010 | The changes to the default formatting of Go source code |
| 1011 | discussed in the <a href="#gofmt">gofmt section</a> above |
| 1012 | are implemented in the <a href="/pkg/go/printer/">go/printer</a> package |
| 1013 | and also affect the output of the higher-level <a href="/pkg/go/format/">go/format</a> package. |
| 1014 | </p> |
| 1015 | </dl> |
| 1016 | |
| 1017 | <dl id="hash"><dt><a href="/pkg/hash/">hash</a></dt> |
| 1018 | <dd> |
| 1019 | <p> |
| 1020 | Implementations of the <a href="/pkg/hash/#Hash"><code>Hash</code></a> interface are now |
| 1021 | encouraged to implement <a href="/pkg/encoding/#BinaryMarshaler"><code>encoding.BinaryMarshaler</code></a> |
| 1022 | and <a href="/pkg/encoding/#BinaryUnmarshaler"><code>encoding.BinaryUnmarshaler</code></a> |
| 1023 | to allow saving and recreating their internal state, |
| 1024 | and all implementations in the standard library |
| 1025 | (<a href="/pkg/hash/crc32/">hash/crc32</a>, <a href="/pkg/crypto/sha256/">crypto/sha256</a>, and so on) |
| 1026 | now implement those interfaces. |
| 1027 | </p> |
| 1028 | </dl> |
| 1029 | |
| 1030 | <dl id="html/template"><dt><a href="/pkg/html/template/">html/template</a></dt> |
| 1031 | <dd> |
| 1032 | <p> |
| 1033 | The new actions <code>{{"{{break}}"}}</code> and <code>{{"{{continue}}"}}</code> |
| 1034 | break out of the innermost <code>{{"{{range"}}</code> ...<code>}}</code> loop, |
| 1035 | like the corresponding Go statements. |
| 1036 | </p> |
| 1037 | <p> |
| 1038 | TODO: something about the AddParseTree problem (#21844). |
| 1039 | </p> |
| 1040 | </dl> |
| 1041 | |
| 1042 | <dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt> |
| 1043 | <dd> |
| 1044 | <p> |
| 1045 | <a href="/pkg/math/big/#Int"><code>Int</code></a> now supports conversions to and from bases 2 through 62 |
| 1046 | in its <a href="/pkg/math/big/#Int.SetString"><code>SetString</code></a> and <a href="/pkg/math/big/#Text"><code>Text</code></a> methods. |
| 1047 | (Previously it only allowed bases 2 through 36.) |
| 1048 | The value of the constant <code>MaxBase</code> has been updated. |
| 1049 | </p> |
| 1050 | <p> |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 1051 | <a href="/pkg/math/big/#Int"><code>Int</code></a> adds a new |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1052 | <a href="/pkg/math/big/#CmpAbs"><code>CmpAbs</code></a> method |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 1053 | that is like <a href="/pkg/math/big/#Cmp"><code>Cmp</code></a> but |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1054 | compares only the absolute values (not the signs) of its arguments. |
| 1055 | </p> |
| 1056 | <p> |
| 1057 | <a href="/pkg/math/big/#Float"><code>Float</code></a> adds a new |
| 1058 | <a href="/pkg/math/big/#Float.Sqrt"><code>Sqrt</code></a> method to |
| 1059 | compute square roots. |
| 1060 | </p> |
| 1061 | </dl> |
| 1062 | |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 1063 | <dl id="math/cmplx"><dt><a href="/pkg/math/cmplx/">math/cmplx</a></dt> |
| 1064 | <dd> |
| 1065 | <p> |
| 1066 | Branch cuts and other boundary cases in |
Brad Fitzpatrick | 4f1fca9 | 2017-12-07 23:27:11 +0000 | [diff] [blame] | 1067 | <a href="/pkg/math/cmplx/#Asin"><code>Asin</code></a>, |
| 1068 | <a href="/pkg/math/cmplx/#Asinh"><code>Asinh</code></a>, |
| 1069 | <a href="/pkg/math/cmplx/#Atan"><code>Atan</code></a>, |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 1070 | and |
Brad Fitzpatrick | 4f1fca9 | 2017-12-07 23:27:11 +0000 | [diff] [blame] | 1071 | <a href="/pkg/math/cmplx/#Sqrt"><code>Sqrt</code></a> |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 1072 | have been corrected to match the definitions used in the C99 standard. |
| 1073 | </p> |
| 1074 | </dl> |
| 1075 | |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1076 | <dl id="math/rand"><dt><a href="/pkg/math/rand/">math/rand</a></dt> |
| 1077 | <dd> |
| 1078 | <p> |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 1079 | The new <a href="/pkg/math/rand/#Shuffle"><code>Shuffle</code></a> function and corresponding |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1080 | <a href="/pkg/math/rand/#Rand.Shuffle"><code>Rand.Shuffle</code></a> method |
| 1081 | shuffle an input sequence. |
| 1082 | </p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1083 | </dl> |
| 1084 | |
| 1085 | <dl id="math"><dt><a href="/pkg/math/">math</a></dt> |
| 1086 | <dd> |
| 1087 | <p> |
| 1088 | The new functions |
| 1089 | <a href="/pkg/math/#Round"><code>Round</code></a> |
| 1090 | and |
| 1091 | <a href="/pkg/math/#RoundToEven"><code>RoundToEven</code></a> |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 1092 | round their arguments to the nearest floating-point integer; |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1093 | <code>Round</code> rounds a half-integer to its larger integer neighbor (away from zero) |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 1094 | while <code>RoundToEven</code> rounds a half-integer to its even integer neighbor. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1095 | </p> |
| 1096 | |
| 1097 | <p> |
| 1098 | The new functions |
| 1099 | <a href="/pkg/math/#Erfinv"><code>Erfinv</code></a> |
| 1100 | and |
| 1101 | <a href="/pkg/math/#Erfcinv"><code>Erfcinv</code></a> |
| 1102 | compute the inverse error function and the |
| 1103 | inverse complementary error function. |
| 1104 | </p> |
| 1105 | </dl> |
| 1106 | |
| 1107 | <dl id="mime/multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt> |
| 1108 | <dd> |
| 1109 | <p> |
| 1110 | <a href="/pkg/mime/multipart/#Reader"><code>Reader</code></a> |
| 1111 | now accepts parts with empty filename attributes. |
| 1112 | </p> |
| 1113 | </dl> |
| 1114 | |
| 1115 | <dl id="mime"><dt><a href="/pkg/mime/">mime</a></dt> |
| 1116 | <dd> |
| 1117 | <p> |
| 1118 | <a href="/pkg/mime/#ParseMediaType"><code>ParseMediaType</code></a> now discards |
| 1119 | invalid attribute values; previously it returned those values as empty strings. |
| 1120 | </p> |
| 1121 | </dl> |
| 1122 | |
| 1123 | <dl id="net"><dt><a href="/pkg/net/">net</a></dt> |
| 1124 | <dd> |
| 1125 | <p> |
| 1126 | The <a href="/pkg/net/#Conn"><code>Conn</code></a> and |
| 1127 | <a href="/pkg/net/#Conn"><code>Listener</code></a> implementations |
| 1128 | in this package now guarantee that when <code>Close</code> returns, |
| 1129 | the underlying file descriptor has been closed. |
| 1130 | (In earlier releases, if the <code>Close</code> stopped pending I/O |
| 1131 | in other goroutines, the closing of the file descriptor could happen in one of those |
| 1132 | goroutines shortly after <code>Close</code> returned.) |
| 1133 | </p> |
| 1134 | |
| 1135 | <p> |
| 1136 | <a href="/pkg/net/#TCPListener"><code>TCPListener</code></a> and |
| 1137 | <a href="/pkg/net/#UnixListener"><code>UnixListener</code></a> |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 1138 | now implement |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1139 | <a href="/pkg/syscall/#Conn"><code>syscall.Conn</code></a>, |
| 1140 | to allow setting options on the underlying file descriptor |
| 1141 | using <a href="/pkg/syscall/#RawConn"><code>syscall.RawConn.Control</code></a>. |
| 1142 | </p> |
| 1143 | |
| 1144 | <p> |
| 1145 | The <code>Conn</code> implementations returned by <a href="/pkg/net/#Pipe"><code>Pipe</code></a> |
| 1146 | now support setting read and write deadlines. |
| 1147 | </p> |
| 1148 | |
| 1149 | <p> |
| 1150 | The <a href="/pkg/net/#IPConn.ReadMsgIP"><code>IPConn.ReadMsgIP</code></a>, |
| 1151 | <a href="/pkg/net/#IPConn.WriteMsgIP"><code>IPConn.WriteMsgIP</code></a>, |
| 1152 | <a href="/pkg/net/#UDPConn.ReadMsgUDP"><code>UDPConn.ReadMsgUDP</code></a>, |
| 1153 | and |
| 1154 | <a href="/pkg/net/#UDPConn.WriteMsgUDP"><code>UDPConn.WriteMsgUDP</code></a>, |
| 1155 | methods are now implemented on Windows. |
| 1156 | </p> |
| 1157 | </dl> |
| 1158 | |
| 1159 | <dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt> |
| 1160 | <dd> |
| 1161 | <p> |
| 1162 | On the client side, an HTTP proxy (most commonly configured by |
| 1163 | <a href="/pkg/net/http/#ProxyFromEnvironment"><code>ProxyFromEnvironment</code></a>) |
| 1164 | can now be specified as an <code>https://</code> URL, |
| 1165 | meaning that the client connects to the proxy over HTTPS before issuing a standard, proxied HTTP request. |
| 1166 | (Previously, HTTP proxy URLs were required to begin with <code>http://</code> or <code>socks5://</code>.) |
| 1167 | </p> |
| 1168 | <p> |
| 1169 | On the server side, <a href="/pkg/net/http/#FileServer"><code>FileServer</code></a> and its single-file equivalent <a href="/pkg/net/http/#ServeFile"><code>ServeFile</code></a> |
| 1170 | now apply <code>If-Range</code> checks to <code>HEAD</code> requests. |
| 1171 | <code>FileServer</code> also now reports directory read failures to the <a href="/pkg/net/http/#Server"><code>Server</code></a>'s <code>ErrorLog</code>. |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 1172 | The content-serving handlers also now omit the <code>Content-Type</code> header when serving zero-length content. |
| 1173 | </p> |
| 1174 | <p> |
| 1175 | <a href="/pkg/net/http/#ResponseWriter"><code>ResponseWriter</code></a>'s <code>WriteHeader</code> method now panics |
| 1176 | if passed an invalid (non-3-digit) status code. |
| 1177 | </p> |
| 1178 | <p> |
| 1179 | <a href="/pkg/net/http/#Redirect"><code>Redirect</code></a> now sets the <code>Content-Type</code> header before writing its HTTP response. |
| 1180 | </p> |
| 1181 | </dl> |
| 1182 | |
| 1183 | <dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt> |
| 1184 | <dd> |
| 1185 | <p> |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 1186 | TODO: ReverseProxy and back end errors and ModifyResponse. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1187 | </p> |
| 1188 | </dl> |
| 1189 | |
| 1190 | <dl id="net/mail"><dt><a href="/pkg/net/mail/">net/mail</a></dt> |
| 1191 | <dd> |
| 1192 | <p> |
| 1193 | <a href="/pkg/net/mail/#ParseAddress"><code>ParseAddress</code></a> and |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 1194 | <a href="/pkg/net/mail/#ParseAddressList"><code>ParseAddressList</code></a> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1195 | now support a variety of obsolete address formats. |
| 1196 | </p> |
| 1197 | </dl> |
| 1198 | |
| 1199 | <dl id="net/smtp"><dt><a href="/pkg/net/smtp/">net/smtp</a></dt> |
| 1200 | <dd> |
| 1201 | <p> |
| 1202 | The <a href="/pkg/net/smtp/#Client"><code>Client</code></a> adds a new |
| 1203 | <a href="/pkg/net/smtp/#Client.Noop"><code>Noop</code></a> method, |
| 1204 | to test whether the server is still responding. |
| 1205 | It also now defends against possible SMTP injection in the inputs |
| 1206 | to the <a href="/pkg/net/smtp/#Client.Hello"><code>Hello</code></a> |
| 1207 | and <a href="/pkg/net/smtp/#Client.Verify"><code>Verify</code></a> methods. |
| 1208 | </p> |
| 1209 | </dl> |
| 1210 | |
| 1211 | <dl id="net/textproto"><dt><a href="/pkg/net/textproto/">net/textproto</a></dt> |
| 1212 | <dd> |
| 1213 | <p> |
| 1214 | <a href="/pkg/net/textproto/#ReadMIMEHeader"><code>ReadMIMEHeader</code></a> |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 1215 | now rejects any header that begins with a continuation (indented) header line. |
| 1216 | Previously a header with an indented first line was treated as if the first line |
| 1217 | were not indented. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1218 | </p> |
| 1219 | </dl> |
| 1220 | |
| 1221 | <dl id="net/url"><dt><a href="/pkg/net/url/">net/url</a></dt> |
| 1222 | <dd> |
| 1223 | <p> |
| 1224 | <a href="/pkg/net/url/#ResolveReference"><code>ResolveReference</code></a> |
| 1225 | now preseves multiple leading slashes in the target URL. |
| 1226 | Previously it rewrote multiple leading slashes to a single slash, |
| 1227 | which resulted in the <a href="/pkg/net/http/#Client"><code>http.Client</code></a> |
| 1228 | following certain redirects incorrectly. |
| 1229 | </p> |
| 1230 | <p> |
| 1231 | For example, this code's output has changed: |
| 1232 | </p> |
| 1233 | <pre> |
| 1234 | base, _ := url.Parse("http://host//path//to/page1") |
| 1235 | target, _ := url.Parse("page2") |
| 1236 | fmt.Println(base.ResolveReference(target)) |
| 1237 | </pre> |
| 1238 | <p> |
| 1239 | Note the doubled slashes around <code>path</code>. |
| 1240 | In Go 1.9 and earlier, the resolved URL was <code>http://host/path//to/page2</code>: |
| 1241 | the doubled slash before <code>path</code> was incorrectly rewritten |
| 1242 | to a single slash, while the doubled slash after <code>path</code> was |
| 1243 | correctly preserved. |
| 1244 | Go 1.10 preserves both doubled slashes, resolving to <code>http://host//path//to/page2</code> |
| 1245 | as required by <a href="https://tools.ietf.org/html/rfc3986#section-5.2">RFC 3986</a>. |
| 1246 | </p> |
| 1247 | |
| 1248 | <p>This change may break existing buggy programs that unintentionally |
| 1249 | construct a base URL with a leading doubled slash in the path and inadvertently |
| 1250 | depend on <code>ResolveReference</code> to correct that mistake. |
| 1251 | For example, this can happen if code adds a host prefix |
| 1252 | like <code>http://host/</code> to a path like <code>/my/api</code>, |
| 1253 | resulting in a URL with a doubled slash: <code>http://host//my/api</code>. |
| 1254 | </p> |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 1255 | |
| 1256 | <p> |
| 1257 | <a href="/pkg/net/url/#UserInfo"><code>UserInfo</code></a>'s methods |
| 1258 | now treat a nil receiver as equivalent to a pointer to a zero <code>UserInfo</code>. |
| 1259 | Previously, they panicked. |
| 1260 | </p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1261 | </dl> |
| 1262 | |
| 1263 | <dl id="os"><dt><a href="/pkg/os/">os</a></dt> |
| 1264 | <dd> |
| 1265 | <p> |
| 1266 | <a href="/pkg/os/#File"><code>File</code></a> adds new methods |
| 1267 | <a href="/pkg/os/#File.SetDeadline"><code>SetDeadline</code></a>, |
| 1268 | <a href="/pkg/os/#File.SetReadDeadline"><code>SetReadDeadline</code></a>, |
| 1269 | and |
| 1270 | <a href="/pkg/os/#File.SetWriteDeadline"><code>SetWriteDeadline</code></a> |
| 1271 | that allow setting I/O deadlines when the |
| 1272 | underlying file descriptor supports non-blocking I/O operations. |
| 1273 | The definition of these methods matches those in <a href="/pkg/net/#Conn"><code>net.Conn</code></a>. |
Ian Lance Taylor | 15bc0a1 | 2018-01-02 16:37:48 -0800 | [diff] [blame^] | 1274 | If an I/O method fails due to missing a deadline, it will return a |
| 1275 | timeout error; the |
| 1276 | new <a href="/pkg/os/#IsTimeout"><code>IsTimeout</code></a> function |
| 1277 | reports whether an error represents a timeout. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1278 | </p> |
| 1279 | |
| 1280 | <p> |
| 1281 | Also matching <code>net.Conn</code>, |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 1282 | <code>File</code>'s |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1283 | <a href="/pkg/os/#File.Close"><code>Close</code></a> method |
| 1284 | now guarantee that when <code>Close</code> returns, |
| 1285 | the underlying file descriptor has been closed. |
| 1286 | (In earlier releases, like for <code>net.Conn</code>'s, |
| 1287 | if the <code>Close</code> stopped pending I/O |
| 1288 | in other goroutines, the closing of the file descriptor could happen in one of those |
| 1289 | goroutines shortly after <code>Close</code> returned.) |
| 1290 | </p> |
| 1291 | |
| 1292 | <p> |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 1293 | On BSD, macOS, and Solaris systems, |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1294 | <a href="/pkg/os/#Chtimes"><code>Chtimes</code></a> |
| 1295 | now supports setting file times with nanosecond precision |
| 1296 | (assuming the underlying file system can represent them). |
| 1297 | </p> |
| 1298 | </dl> |
| 1299 | |
| 1300 | <dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt> |
| 1301 | <dd> |
| 1302 | <p> |
| 1303 | The <a href="/pkg/reflect/#Copy"><code>Copy</code></a> function now allows copying |
| 1304 | from a string into a byte array or byte slice, to match the |
| 1305 | <a href="/pkg/builtin/#copy">built-in copy function</a>. |
| 1306 | </p> |
Russ Cox | 8114a85 | 2017-12-05 23:36:53 -0500 | [diff] [blame] | 1307 | |
| 1308 | <p> |
Russ Cox | c56fda6 | 2017-12-06 00:01:26 -0500 | [diff] [blame] | 1309 | In structs, embedded pointers to unexported struct types were |
| 1310 | previously incorrectly reported with an empty <code>PkgPath</code> |
| 1311 | in the corresponding <a href="/pkg/reflect/#StructField">StructField</a>, |
| 1312 | with the result that for those fields, |
| 1313 | and <a href="/pkg/reflect/#Value.CanSet"><code>Value.CanSet</code></a> |
| 1314 | incorrectly returned true and |
| 1315 | and <a href="/pkg/reflect/#Value.Set"><code>Value.Set</code></a> |
| 1316 | incorrectly succeeded. |
| 1317 | The underlying metadata has been corrected; |
| 1318 | for those fields, |
| 1319 | <code>CanSet</code> now correctly returns false |
| 1320 | and <code>Set</code> now correctly panics. |
| 1321 | This may affect reflection-based unmarshalers |
| 1322 | that could previously unmarshal into such fields |
| 1323 | but no longer can. |
| 1324 | For example, see the <a href="#encoding/json"><code>encoding/json</code> notes</a>. |
| 1325 | </p> |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1326 | </dl> |
| 1327 | |
| 1328 | <dl id="runtime/pprof"><dt><a href="/pkg/runtime/pprof/">runtime/pprof</a></dt> |
| 1329 | <dd> |
| 1330 | <p> |
| 1331 | As <a href="#pprof">noted above</a>, the blocking and mutex profiles |
| 1332 | now include symbol information so that they can be viewed without needing |
| 1333 | the binary that generated them. |
| 1334 | </p> |
| 1335 | </dl> |
| 1336 | |
| 1337 | <dl id="strconv"><dt><a href="/pkg/strconv/">strconv</a></dt> |
| 1338 | <dd> |
| 1339 | <p> |
Andrew Bonventre | 05deefe | 2017-12-11 16:42:25 -0500 | [diff] [blame] | 1340 | <a href="/pkg/strconv/#ParseUint"><code>ParseUint</code></a> now returns |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1341 | the maximum magnitude integer of the appropriate size |
| 1342 | with any <code>ErrRange</code> error, as it was already documented to do. |
| 1343 | Previously it returned 0 with <code>ErrRange</code> errors. |
| 1344 | </p> |
| 1345 | </dl> |
| 1346 | |
| 1347 | <dl id="strings"><dt><a href="/pkg/strings/">strings</a></dt> |
| 1348 | <dd> |
| 1349 | <p> |
| 1350 | A new type |
| 1351 | <a href="/pkg/strings/#Builder"><code>Builder</code></a> is a replacement for |
| 1352 | <a href="/pkg/bytes/#Buffer"><code>bytes.Buffer</code></a> for the use case of |
| 1353 | accumulating text into a <code>string</code> result. |
| 1354 | The <code>Builder</code>'s API is a restricted subset of <code>bytes.Buffer</code>'s |
| 1355 | that allows it to safely avoid making a duplicate copy of the data |
| 1356 | during the <a href="/pkg/strings/#Builder.String"><code>String</code></a> method. |
| 1357 | </p> |
| 1358 | </dl> |
| 1359 | |
| 1360 | <dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt> |
| 1361 | <dd> |
| 1362 | <p> |
| 1363 | On Windows, |
| 1364 | the new <a href="/pkg/syscall/#SysProcAttr"><code>SysProcAttr</code></a> field <code>Token</code>, |
| 1365 | of type <a href="/pkg/syscall/#Token"><code>Token</code></a> allows the creation of a process that |
| 1366 | runs as another user during <a href="/pkg/syscall/#StartProcess"><code>StartProcess</code></a> |
| 1367 | (and therefore also during <a href="/pkg/os/#StartProcess"><code>os.StartProcess</code></a> and |
| 1368 | <a href="/pkg/os/exec/#Cmd.Start"><code>exec.Cmd.Start</code></a>). |
| 1369 | The new function <a href="/pkg/syscall/#CreateProcessAsUser"><code>CreateProcessAsUser</code></a> |
| 1370 | gives access to the underlying system call. |
| 1371 | </p> |
| 1372 | |
| 1373 | <p> |
| 1374 | On BSD, macOS, and Solaris systems, <a href="/pkg/syscall/#UtimesNano"><code>UtimesNano</code></a> |
| 1375 | is now implemented. |
| 1376 | </p> |
| 1377 | </dl> |
| 1378 | |
| 1379 | <dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt> |
| 1380 | <dd> |
| 1381 | <p> |
| 1382 | The new actions <code>{{"{{break}}"}}</code> and <code>{{"{{continue}}"}}</code> |
| 1383 | break out of the innermost <code>{{"{{range"}}</code> ...<code>}}</code> loop, |
| 1384 | like the corresponding Go statements. |
| 1385 | </p> |
| 1386 | </dl> |
| 1387 | |
| 1388 | <dl id="time"><dt><a href="/pkg/time/">time</a></dt> |
| 1389 | <dd> |
| 1390 | <p> |
| 1391 | <a href="/pkg/time/#LoadLocation"><code>LoadLocation</code></a> now uses the directory |
| 1392 | or uncompressed zip file named by the <code>$ZONEINFO</code> |
| 1393 | environment variable before looking in the default system-specific list of |
| 1394 | known installation locations or in <code>$GOROOT/lib/time/zoneinfo.zip</code>. |
| 1395 | </p> |
| 1396 | <p> |
Russ Cox | d628090 | 2017-12-05 22:20:46 -0500 | [diff] [blame] | 1397 | The new function <a href="/pkg/time/#LoadLocationFromTZData"><code>LoadLocationFromTZData</code></a> |
| 1398 | allows conversion of IANA time zone file data to a <a href="/pkg/time/#Location"><code>Location</code></a>. |
Russ Cox | 0434426 | 2017-11-15 15:44:09 -0500 | [diff] [blame] | 1399 | </p> |
| 1400 | </dl> |
| 1401 | |
| 1402 | <dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt> |
| 1403 | <dd> |
| 1404 | <p> |
| 1405 | The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated |
| 1406 | support throughout the system has been upgraded from version 9.0 to |
| 1407 | <a href="http://www.unicode.org/versions/Unicode10.0.0/">Unicode 10.0</a>, |
| 1408 | which adds 8,518 new characters, including four new scripts, one new property, |
| 1409 | a Bitcoin currency symbol, and 56 new emoji. |
| 1410 | </p> |
| 1411 | </dl> |