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