go1.8.html 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666
  1. <!--{
  2. "Title": "Go 1.8 Release Notes",
  3. "Path": "/doc/go1.8",
  4. "Template": true
  5. }-->
  6. <!--
  7. NOTE: In this document and others in this directory, the convention is to
  8. set fixed-width phrases with non-fixed-width spaces, as in
  9. <code>hello</code> <code>world</code>.
  10. Do not send CLs removing the interior tags from such phrases.
  11. -->
  12. <style>
  13. main ul li { margin: 0.5em 0; }
  14. </style>
  15. <h2 id="introduction">Introduction to Go 1.8</h2>
  16. <p>
  17. The latest Go release, version 1.8, arrives six months after <a href="go1.7">Go 1.7</a>.
  18. Most of its changes are in the implementation of the toolchain, runtime, and libraries.
  19. There are <a href="#language">two minor changes</a> to the language specification.
  20. As always, the release maintains the Go 1 <a href="/doc/go1compat.html">promise of compatibility</a>.
  21. We expect almost all Go programs to continue to compile and run as before.
  22. </p>
  23. <p>
  24. The release <a href="#ports">adds support for 32-bit MIPS</a>,
  25. <a href="#compiler">updates the compiler back end</a> to generate more efficient code,
  26. <a href="#gc">reduces GC pauses</a> by eliminating stop-the-world stack rescanning,
  27. <a href="#h2push">adds HTTP/2 Push support</a>,
  28. <a href="#http_shutdown">adds HTTP graceful shutdown</a>,
  29. <a href="#more_context">adds more context support</a>,
  30. <a href="#mutex_prof">enables profiling mutexes</a>,
  31. and <a href="#sort_slice">simplifies sorting slices</a>.
  32. </p>
  33. <h2 id="language">Changes to the language</h2>
  34. <p>
  35. When explicitly converting a value from one struct type to another,
  36. as of Go 1.8 the tags are ignored. Thus two structs that differ
  37. only in their tags may be converted from one to the other:
  38. </p>
  39. <pre>
  40. func example() {
  41. type T1 struct {
  42. X int `json:"foo"`
  43. }
  44. type T2 struct {
  45. X int `json:"bar"`
  46. }
  47. var v1 T1
  48. var v2 T2
  49. v1 = T1(v2) // now legal
  50. }
  51. </pre>
  52. <p> <!-- CL 17711 -->
  53. The language specification now only requires that implementations
  54. support up to 16-bit exponents in floating-point constants. This does not affect
  55. either the “<a href="/cmd/compile/"><code>gc</code></a>” or
  56. <code>gccgo</code> compilers, both of
  57. which still support 32-bit exponents.
  58. </p>
  59. <h2 id="ports">Ports</h2>
  60. <p>
  61. Go now supports 32-bit MIPS on Linux for both big-endian
  62. (<code>linux/mips</code>) and little-endian machines
  63. (<code>linux/mipsle</code>) that implement the MIPS32r1 instruction set with FPU
  64. or kernel FPU emulation. Note that many common MIPS-based routers lack an FPU and
  65. have firmware that doesn't enable kernel FPU emulation; Go won't run on such machines.
  66. </p>
  67. <p>
  68. On DragonFly BSD, Go now requires DragonFly 4.4.4 or later. <!-- CL 29491, CL 29971 -->
  69. </p>
  70. <p>
  71. On OpenBSD, Go now requires OpenBSD 5.9 or later. <!-- CL 34093 -->
  72. </p>
  73. <p>
  74. The Plan 9 port's networking support is now much more complete
  75. and matches the behavior of Unix and Windows with respect to deadlines
  76. and cancelation. For Plan 9 kernel requirements, see the
  77. <a href="https://golang.org/wiki/Plan9">Plan 9 wiki page</a>.
  78. </p>
  79. <p>
  80. Go 1.8 now only supports OS X 10.8 or later. This is likely the last
  81. Go release to support 10.8. Compiling Go or running
  82. binaries on older OS X versions is untested.
  83. </p>
  84. <p>
  85. Go 1.8 will be the last release to support Linux on ARMv5E and ARMv6 processors:
  86. Go 1.9 will likely require the ARMv6K (as found in the Raspberry Pi 1) or later.
  87. To identify whether a Linux system is ARMv6K or later, run
  88. “<code>go</code> <code>tool</code> <code>dist</code> <code>-check-armv6k</code>”
  89. (to facilitate testing, it is also possible to just copy the <code>dist</code> command to the
  90. system without installing a full copy of Go 1.8)
  91. and if the program terminates with output "ARMv6K supported." then the system
  92. implements ARMv6K or later.
  93. Go on non-Linux ARM systems already requires ARMv6K or later.
  94. </p>
  95. <h3 id="known_issues">Known Issues</h3>
  96. <p>
  97. There are some instabilities on FreeBSD and NetBSD that are known but not understood.
  98. These can lead to program crashes in rare cases.
  99. See
  100. <a href="https://golang.org/issue/15658">issue 15658</a> and
  101. <a href="https://golang.org/issue/16511">issue 16511</a>.
  102. Any help in solving these issues would be appreciated.
  103. </p>
  104. <h2 id="tools">Tools</h2>
  105. <h3 id="cmd_asm">Assembler</h3>
  106. <p>
  107. For 64-bit x86 systems, the following instructions have been added:
  108. <code>VBROADCASTSD</code>,
  109. <code>BROADCASTSS</code>,
  110. <code>MOVDDUP</code>,
  111. <code>MOVSHDUP</code>,
  112. <code>MOVSLDUP</code>,
  113. <code>VMOVDDUP</code>,
  114. <code>VMOVSHDUP</code>, and
  115. <code>VMOVSLDUP</code>.
  116. </p>
  117. <p>
  118. For 64-bit PPC systems, the common vector scalar instructions have been
  119. added:
  120. <code>LXS</code>,
  121. <code>LXSDX</code>,
  122. <code>LXSI</code>,
  123. <code>LXSIWAX</code>,
  124. <code>LXSIWZX</code>,
  125. <code>LXV</code>,
  126. <code>LXVD2X</code>,
  127. <code>LXVDSX</code>,
  128. <code>LXVW4X</code>,
  129. <code>MFVSR</code>,
  130. <code>MFVSRD</code>,
  131. <code>MFVSRWZ</code>,
  132. <code>MTVSR</code>,
  133. <code>MTVSRD</code>,
  134. <code>MTVSRWA</code>,
  135. <code>MTVSRWZ</code>,
  136. <code>STXS</code>,
  137. <code>STXSDX</code>,
  138. <code>STXSI</code>,
  139. <code>STXSIWX</code>,
  140. <code>STXV</code>,
  141. <code>STXVD2X</code>,
  142. <code>STXVW4X</code>,
  143. <code>XSCV</code>,
  144. <code>XSCVDPSP</code>,
  145. <code>XSCVDPSPN</code>,
  146. <code>XSCVDPSXDS</code>,
  147. <code>XSCVDPSXWS</code>,
  148. <code>XSCVDPUXDS</code>,
  149. <code>XSCVDPUXWS</code>,
  150. <code>XSCVSPDP</code>,
  151. <code>XSCVSPDPN</code>,
  152. <code>XSCVSXDDP</code>,
  153. <code>XSCVSXDSP</code>,
  154. <code>XSCVUXDDP</code>,
  155. <code>XSCVUXDSP</code>,
  156. <code>XSCVX</code>,
  157. <code>XSCVXP</code>,
  158. <code>XVCV</code>,
  159. <code>XVCVDPSP</code>,
  160. <code>XVCVDPSXDS</code>,
  161. <code>XVCVDPSXWS</code>,
  162. <code>XVCVDPUXDS</code>,
  163. <code>XVCVDPUXWS</code>,
  164. <code>XVCVSPDP</code>,
  165. <code>XVCVSPSXDS</code>,
  166. <code>XVCVSPSXWS</code>,
  167. <code>XVCVSPUXDS</code>,
  168. <code>XVCVSPUXWS</code>,
  169. <code>XVCVSXDDP</code>,
  170. <code>XVCVSXDSP</code>,
  171. <code>XVCVSXWDP</code>,
  172. <code>XVCVSXWSP</code>,
  173. <code>XVCVUXDDP</code>,
  174. <code>XVCVUXDSP</code>,
  175. <code>XVCVUXWDP</code>,
  176. <code>XVCVUXWSP</code>,
  177. <code>XVCVX</code>,
  178. <code>XVCVXP</code>,
  179. <code>XXLAND</code>,
  180. <code>XXLANDC</code>,
  181. <code>XXLANDQ</code>,
  182. <code>XXLEQV</code>,
  183. <code>XXLNAND</code>,
  184. <code>XXLNOR</code>,
  185. <code>XXLOR</code>,
  186. <code>XXLORC</code>,
  187. <code>XXLORQ</code>,
  188. <code>XXLXOR</code>,
  189. <code>XXMRG</code>,
  190. <code>XXMRGHW</code>,
  191. <code>XXMRGLW</code>,
  192. <code>XXPERM</code>,
  193. <code>XXPERMDI</code>,
  194. <code>XXSEL</code>,
  195. <code>XXSI</code>,
  196. <code>XXSLDWI</code>,
  197. <code>XXSPLT</code>, and
  198. <code>XXSPLTW</code>.
  199. </p>
  200. <h3 id="tool_yacc">Yacc</h3>
  201. <p> <!-- CL 27324, CL 27325 -->
  202. The <code>yacc</code> tool (previously available by running
  203. “<code>go</code> <code>tool</code> <code>yacc</code>”) has been removed.
  204. As of Go 1.7 it was no longer used by the Go compiler.
  205. It has moved to the “tools” repository and is now available at
  206. <code><a href="https://godoc.org/golang.org/x/tools/cmd/goyacc">golang.org/x/tools/cmd/goyacc</a></code>.
  207. </p>
  208. <h3 id="tool_fix">Fix</h3>
  209. <p> <!-- CL 28872 -->
  210. The <code>fix</code> tool has a new “<code>context</code>”
  211. fix to change imports from “<code>golang.org/x/net/context</code>”
  212. to “<a href="/pkg/context/"><code>context</code></a>”.
  213. </p>
  214. <h3 id="tool_pprof">Pprof</h3>
  215. <p> <!-- CL 33157 -->
  216. The <code>pprof</code> tool can now profile TLS servers
  217. and skip certificate validation by using the “<code>https+insecure</code>”
  218. URL scheme.
  219. </p>
  220. <p> <!-- CL 23781 -->
  221. The callgrind output now has instruction-level granularity.
  222. </p>
  223. <h3 id="tool_trace">Trace</h3>
  224. <p> <!-- CL 23324 -->
  225. The <code>trace</code> tool has a new <code>-pprof</code> flag for
  226. producing pprof-compatible blocking and latency profiles from an
  227. execution trace.
  228. </p>
  229. <p> <!-- CL 30017, CL 30702 -->
  230. Garbage collection events are now shown more clearly in the
  231. execution trace viewer. Garbage collection activity is shown on its
  232. own row and GC helper goroutines are annotated with their roles.
  233. </p>
  234. <h3 id="tool_vet">Vet</h3>
  235. <p>Vet is stricter in some ways and looser where it
  236. previously caused false positives.</p>
  237. <p>Vet now checks for copying an array of locks,
  238. duplicate JSON and XML struct field tags,
  239. non-space-separated struct tags,
  240. deferred calls to HTTP <code>Response.Body.Close</code>
  241. before checking errors, and
  242. indexed arguments in <code>Printf</code>.
  243. It also improves existing checks.</p>
  244. </p>
  245. <h3 id="compiler">Compiler Toolchain</h3>
  246. <p>
  247. Go 1.7 introduced a new compiler back end for 64-bit x86 systems.
  248. In Go 1.8, that back end has been developed further and is now used for
  249. all architectures.
  250. </p>
  251. <p>
  252. The new back end, based on
  253. <a href="https://en.wikipedia.org/wiki/Static_single_assignment_form">static single assignment form</a> (SSA),
  254. generates more compact, more efficient code
  255. and provides a better platform for optimizations
  256. such as bounds check elimination.
  257. The new back end reduces the CPU time required by
  258. <a href="https://golang.org/test/bench/go1/">our benchmark programs</a> by 20-30%
  259. on 32-bit ARM systems. For 64-bit x86 systems, which already used the SSA back end in
  260. Go 1.7, the gains are a more modest 0-10%. Other architectures will likely
  261. see improvements closer to the 32-bit ARM numbers.
  262. </p>
  263. <p>
  264. The temporary <code>-ssa=0</code> compiler flag introduced in Go 1.7
  265. to disable the new back end has been removed in Go 1.8.
  266. </p>
  267. <p>
  268. In addition to enabling the new compiler back end for all systems,
  269. Go 1.8 also introduces a new compiler front end. The new compiler
  270. front end should not be noticeable to users but is the foundation for
  271. future performance work.
  272. </p>
  273. <p>
  274. The compiler and linker have been optimized and run faster in this
  275. release than in Go 1.7, although they are still slower than we would
  276. like and will continue to be optimized in future releases.
  277. Compared to the previous release, Go 1.8 is
  278. <a href="https://dave.cheney.net/2016/11/19/go-1-8-toolchain-improvements">about 15% faster</a>.
  279. </p>
  280. <h3 id="cmd_cgo">Cgo</h3>
  281. <p> <!-- CL 31141 -->
  282. The Go tool now remembers the value of the <code>CGO_ENABLED</code> environment
  283. variable set during <code>make.bash</code> and applies it to all future compilations
  284. by default to fix issue <a href="https://golang.org/issue/12808">#12808</a>.
  285. When doing native compilation, it is rarely necessary to explicitly set
  286. the <code>CGO_ENABLED</code> environment variable as <code>make.bash</code>
  287. will detect the correct setting automatically. The main reason to explicitly
  288. set the <code>CGO_ENABLED</code> environment variable is when your environment
  289. supports cgo, but you explicitly do not want cgo support, in which case, set
  290. <code>CGO_ENABLED=0</code> during <code>make.bash</code> or <code>all.bash</code>.
  291. </p>
  292. <p> <!-- CL 29991 -->
  293. The environment variable <code>PKG_CONFIG</code> may now be used to
  294. set the program to run to handle <code>#cgo</code> <code>pkg-config</code>
  295. directives. The default is <code>pkg-config</code>, the program
  296. always used by earlier releases. This is intended to make it easier
  297. to cross-compile
  298. <a href="/cmd/cgo/">cgo</a> code.
  299. </p>
  300. <p> <!-- CL 32354 -->
  301. The <a href="/cmd/cgo/">cgo</a> tool now supports a <code>-srcdir</code>
  302. option, which is used by the <a href="/cmd/go/">go</a> command.
  303. </p>
  304. <p> <!-- CL 31768, 31811 -->
  305. If <a href="/cmd/cgo/">cgo</a> code calls <code>C.malloc</code>, and
  306. <code>malloc</code> returns <code>NULL</code>, the program will now
  307. crash with an out of memory error.
  308. <code>C.malloc</code> will never return <code>nil</code>.
  309. Unlike most C functions, <code>C.malloc</code> may not be used in a
  310. two-result form returning an errno value.
  311. </p>
  312. <p> <!-- CL 33237 -->
  313. If <a href="/cmd/cgo/">cgo</a> is used to call a C function passing a
  314. pointer to a C union, and if the C union can contain any pointer
  315. values, and if <a href="/cmd/cgo/#hdr-Passing_pointers">cgo pointer
  316. checking</a> is enabled (as it is by default), the union value is now
  317. checked for Go pointers.
  318. </p>
  319. <h3 id="gccgo">Gccgo</h3>
  320. <p>
  321. Due to the alignment of Go's semiannual release schedule with GCC's
  322. annual release schedule,
  323. GCC release 6 contains the Go 1.6.1 version of gccgo.
  324. We expect that the next release, GCC 7, will contain the Go 1.8
  325. version of gccgo.
  326. </p>
  327. <h3 id="gopath">Default GOPATH</h3>
  328. <p>
  329. The
  330. <a href="/cmd/go/#hdr-GOPATH_environment_variable"><code>GOPATH</code>
  331. environment variable</a> now has a default value if it
  332. is unset. It defaults to
  333. <code>$HOME/go</code> on Unix and
  334. <code>%USERPROFILE%/go</code> on Windows.
  335. </p>
  336. <h3 id="go_get">Go get</h3>
  337. <p> <!-- CL 34818 -->
  338. The “<code>go</code> <code>get</code>” command now always respects
  339. HTTP proxy environment variables, regardless of whether
  340. the <code style='white-space:nowrap'>-insecure</code> flag is used. In previous releases, the
  341. <code style='white-space:nowrap'>-insecure</code> flag had the side effect of not using proxies.
  342. </p>
  343. <h3 id="go_bug">Go bug</h3>
  344. <p>
  345. The new
  346. “<a href="/cmd/go/#hdr-Print_information_for_bug_reports"><code>go</code> <code>bug</code></a>”
  347. command starts a bug report on GitHub, prefilled
  348. with information about the current system.
  349. </p>
  350. <h3 id="cmd_doc">Go doc</h3>
  351. <p> <!-- CL 25419 -->
  352. The
  353. “<a href="/cmd/go/#hdr-Show_documentation_for_package_or_symbol"><code>go</code> <code>doc</code></a>”
  354. command now groups constants and variables with their type,
  355. following the behavior of
  356. <a href="/cmd/godoc/"><code>godoc</code></a>.
  357. </p>
  358. <p> <!-- CL 25420 -->
  359. In order to improve the readability of <code>doc</code>'s
  360. output, each summary of the first-level items is guaranteed to
  361. occupy a single line.
  362. </p>
  363. <p> <!-- CL 31852 -->
  364. Documentation for a specific method in an interface definition can
  365. now be requested, as in
  366. “<code>go</code> <code>doc</code> <code>net.Conn.SetDeadline</code>”.
  367. </p>
  368. <h3 id="plugin">Plugins</h3>
  369. <p>
  370. Go now provides early support for plugins with a “<code>plugin</code>”
  371. build mode for generating plugins written in Go, and a
  372. new <a href="/pkg/plugin/"><code>plugin</code></a> package for
  373. loading such plugins at run time. Plugin support is currently only
  374. available on Linux. Please report any issues.
  375. </p>
  376. <h2 id="runtime">Runtime</h2>
  377. <h3 id="liveness">Argument Liveness</h3>
  378. <p>
  379. <!-- Issue 15843 --> The garbage collector no longer considers
  380. arguments live throughout the entirety of a function. For more
  381. information, and for how to force a variable to remain live, see
  382. the <a href="/pkg/runtime/#KeepAlive"><code>runtime.KeepAlive</code></a>
  383. function added in Go 1.7.
  384. </p>
  385. <p>
  386. <i>Updating:</i>
  387. Code that sets a finalizer on an allocated object may need to add
  388. calls to <code>runtime.KeepAlive</code> in functions or methods
  389. using that object.
  390. Read the
  391. <a href="/pkg/runtime/#KeepAlive"><code>KeepAlive</code>
  392. documentation</a> and its example for more details.
  393. </p>
  394. <h3 id="mapiter">Concurrent Map Misuse</h3>
  395. <p>
  396. In Go 1.6, the runtime
  397. <a href="/doc/go1.6#runtime">added lightweight,
  398. best-effort detection of concurrent misuse of maps</a>. This release
  399. improves that detector with support for detecting programs that
  400. concurrently write to and iterate over a map.
  401. </p>
  402. <p>
  403. As always, if one goroutine is writing to a map, no other goroutine should be
  404. reading (which includes iterating) or writing the map concurrently.
  405. If the runtime detects this condition, it prints a diagnosis and crashes the program.
  406. The best way to find out more about the problem is to run the program
  407. under the
  408. <a href="https://blog.golang.org/race-detector">race detector</a>,
  409. which will more reliably identify the race
  410. and give more detail.
  411. </p>
  412. <h3 id="memstats">MemStats Documentation</h3>
  413. <p> <!-- CL 28972 -->
  414. The <a href="/pkg/runtime/#MemStats"><code>runtime.MemStats</code></a>
  415. type has been more thoroughly documented.
  416. </p>
  417. <h2 id="performance">Performance</h2>
  418. <p>
  419. As always, the changes are so general and varied that precise statements
  420. about performance are difficult to make.
  421. Most programs should run a bit faster,
  422. due to speedups in the garbage collector and
  423. optimizations in the standard library.
  424. </p>
  425. <p>
  426. There have been optimizations to implementations in the
  427. <a href="/pkg/bytes/"><code>bytes</code></a>,
  428. <a href="/pkg/crypto/aes/"><code>crypto/aes</code></a>,
  429. <a href="/pkg/crypto/cipher/"><code>crypto/cipher</code></a>,
  430. <a href="/pkg/crypto/elliptic/"><code>crypto/elliptic</code></a>,
  431. <a href="/pkg/crypto/sha256/"><code>crypto/sha256</code></a>,
  432. <a href="/pkg/crypto/sha512/"><code>crypto/sha512</code></a>,
  433. <a href="/pkg/encoding/asn1/"><code>encoding/asn1</code></a>,
  434. <a href="/pkg/encoding/csv/"><code>encoding/csv</code></a>,
  435. <a href="/pkg/encoding/hex/"><code>encoding/hex</code></a>,
  436. <a href="/pkg/encoding/json/"><code>encoding/json</code></a>,
  437. <a href="/pkg/hash/crc32/"><code>hash/crc32</code></a>,
  438. <a href="/pkg/image/color/"><code>image/color</code></a>,
  439. <a href="/pkg/image/draw/"><code>image/draw</code></a>,
  440. <a href="/pkg/math/"><code>math</code></a>,
  441. <a href="/pkg/math/big/"><code>math/big</code></a>,
  442. <a href="/pkg/reflect/"><code>reflect</code></a>,
  443. <a href="/pkg/regexp/"><code>regexp</code></a>,
  444. <a href="/pkg/runtime/"><code>runtime</code></a>,
  445. <a href="/pkg/strconv/"><code>strconv</code></a>,
  446. <a href="/pkg/strings/"><code>strings</code></a>,
  447. <a href="/pkg/syscall/"><code>syscall</code></a>,
  448. <a href="/pkg/text/template/"><code>text/template</code></a>, and
  449. <a href="/pkg/unicode/utf8/"><code>unicode/utf8</code></a>
  450. packages.
  451. </p>
  452. <h3 id="gc">Garbage Collector</h3>
  453. <p>
  454. Garbage collection pauses should be significantly shorter than they
  455. were in Go 1.7, usually under 100 microseconds and often as low as
  456. 10 microseconds.
  457. See the
  458. <a href="https://github.com/golang/proposal/blob/master/design/17503-eliminate-rescan.md"
  459. >document on eliminating stop-the-world stack re-scanning</a>
  460. for details. More work remains for Go 1.9.
  461. </p>
  462. <h3 id="defer">Defer</h3>
  463. <!-- CL 29656, CL 29656 -->
  464. <p>
  465. The overhead of <a href="/ref/spec/#Defer_statements">deferred
  466. function calls</a> has been reduced by about half.
  467. </p>
  468. <h3 id="cgoperf">Cgo</h3>
  469. <p>The overhead of calls from Go into C has been reduced by about half.</p>
  470. <h2 id="library">Standard library</h2>
  471. <h3 id="examples">Examples</h3>
  472. <p>
  473. Examples have been added to the documentation across many packages.
  474. </p>
  475. <h3 id="sort_slice">Sort</h3>
  476. <p>
  477. The <a href="/pkg/sort/">sort</a> package
  478. now includes a convenience function
  479. <a href="/pkg/sort/#Slice"><code>Slice</code></a> to sort a
  480. slice given a <em>less</em> function.
  481. In many cases this means that writing a new sorter type is not
  482. necessary.
  483. </p>
  484. <p>
  485. Also new are
  486. <a href="/pkg/sort/#SliceStable"><code>SliceStable</code></a> and
  487. <a href="/pkg/sort/#SliceIsSorted"><code>SliceIsSorted</code></a>.
  488. </p>
  489. <h3 id="h2push">HTTP/2 Push</h3>
  490. <p>
  491. The <a href="/pkg/net/http/">net/http</a> package now includes a
  492. mechanism to
  493. send HTTP/2 server pushes from a
  494. <a href="/pkg/net/http/#Handler"><code>Handler</code></a>.
  495. Similar to the existing <code>Flusher</code> and <code>Hijacker</code>
  496. interfaces, an HTTP/2
  497. <a href="/pkg/net/http/#ResponseWriter"><code>ResponseWriter</code></a>
  498. now implements the new
  499. <a href="/pkg/net/http/#Pusher"><code>Pusher</code></a> interface.
  500. </p>
  501. <h3 id="http_shutdown">HTTP Server Graceful Shutdown</h3>
  502. <p> <!-- CL 32329 -->
  503. The HTTP Server now has support for graceful shutdown using the new
  504. <a href="/pkg/net/http/#Server.Shutdown"><code>Server.Shutdown</code></a>
  505. method and abrupt shutdown using the new
  506. <a href="/pkg/net/http/#Server.Close"><code>Server.Close</code></a>
  507. method.
  508. </p>
  509. <h3 id="more_context">More Context Support</h3>
  510. <p>
  511. Continuing <a href="/doc/go1.7#context">Go 1.7's adoption</a>
  512. of <a href="/pkg/context/#Context"><code>context.Context</code></a>
  513. into the standard library, Go 1.8 adds more context support
  514. to existing packages:
  515. </p>
  516. <ul>
  517. <li>The new <a href="/pkg/net/http/#Server.Shutdown"><code>Server.Shutdown</code></a>
  518. takes a context argument.</li>
  519. <li>There have been <a href="#database_sql">significant additions</a> to the
  520. <a href="/pkg/database/sql/">database/sql</a> package with context support.</li>
  521. <li>All nine of the new <code>Lookup</code> methods on the new
  522. <a href="/pkg/net/#Resolver"><code>net.Resolver</code></a> now
  523. take a context.</li>
  524. </ul>
  525. <h3 id="mutex_prof">Mutex Contention Profiling</h3>
  526. <p>
  527. The runtime and tools now support profiling contended mutexes.
  528. </p>
  529. <p>
  530. Most users will want to use the new <code>-mutexprofile</code>
  531. flag with “<a href="/cmd/go/#hdr-Description_of_testing_flags"><code>go</code> <code>test</code></a>”,
  532. and then use <a href="/cmd/pprof/">pprof</a> on the resultant file.
  533. </p>
  534. <p>
  535. Lower-level support is also available via the new
  536. <a href="/pkg/runtime/#MutexProfile"><code>MutexProfile</code></a>
  537. and
  538. <a href="/pkg/runtime/#SetMutexProfileFraction"><code>SetMutexProfileFraction</code></a>.
  539. </p>
  540. <p>
  541. A known limitation for Go 1.8 is that the profile only reports contention for
  542. <a href="/pkg/sync/#Mutex"><code>sync.Mutex</code></a>,
  543. not
  544. <a href="/pkg/sync/#RWMutex"><code>sync.RWMutex</code></a>.
  545. </p>
  546. <h3 id="minor_library_changes">Minor changes to the library</h3>
  547. <p>
  548. As always, there are various minor changes and updates to the library,
  549. made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
  550. in mind. The following sections list the user visible changes and additions.
  551. Optimizations and minor bug fixes are not listed.
  552. </p>
  553. <dl id="archive_tar"><dt><a href="/pkg/archive/tar/">archive/tar</a></dt>
  554. <dd>
  555. <p> <!-- CL 28471, CL 31440, CL 31441, CL 31444, CL 28418, CL 31439 -->
  556. The tar implementation corrects many bugs in corner cases of the file format.
  557. The <a href="/pkg/archive/tar/#Reader"><code>Reader</code></a>
  558. is now able to process tar files in the PAX format with entries larger than 8GB.
  559. The <a href="/pkg/archive/tar/#Writer"><code>Writer</code></a>
  560. no longer produces invalid tar files in some situations involving long pathnames.
  561. </p>
  562. </dd>
  563. </dl>
  564. <dl id="compress_flate"><dt><a href="/pkg/compress/flate/">compress/flate</a></dt>
  565. <dd>
  566. <p> <!-- CL 31640, CL 31174, CL 32149 -->
  567. There have been some minor fixes to the encoder to improve the
  568. compression ratio in certain situations. As a result, the exact
  569. encoded output of <code>DEFLATE</code> may be different from Go 1.7. Since
  570. <code>DEFLATE</code> is the underlying compression of gzip, png, zlib, and zip,
  571. those formats may have changed outputs.
  572. </p>
  573. <p> <!-- CL 31174 -->
  574. The encoder, when operating in
  575. <a href="/pkg/compress/flate/#NoCompression"><code>NoCompression</code></a>
  576. mode, now produces a consistent output that is not dependent on
  577. the size of the slices passed to the
  578. <a href="/pkg/compress/flate/#Writer.Write"><code>Write</code></a>
  579. method.
  580. </p>
  581. <p> <!-- CL 28216 -->
  582. The decoder, upon encountering an error, now returns any
  583. buffered data it had uncompressed along with the error.
  584. </p>
  585. </dd>
  586. </dl>
  587. <dl id="compress_gzip"><dt><a href="/pkg/compress/gzip/">compress/gzip</a></dt>
  588. <dd>
  589. <p>
  590. The <a href="/pkg/compress/gzip/#Writer"><code>Writer</code></a>
  591. now encodes a zero <code>MTIME</code> field when
  592. the <a href="/pkg/compress/gzip/#Header"><code>Header.ModTime</code></a>
  593. field is the zero value.
  594. In previous releases of Go, the <code>Writer</code> would encode
  595. a nonsensical value.
  596. Similarly,
  597. the <a href="/pkg/compress/gzip/#Reader"><code>Reader</code></a>
  598. now reports a zero encoded <code>MTIME</code> field as a zero
  599. <code>Header.ModTime</code>.
  600. </p>
  601. </dd>
  602. </dl>
  603. <dl id="context"><dt><a href="/pkg/context/">context</a></dt>
  604. <dd>
  605. <p> <!-- CL 30370 -->
  606. The <a href="/pkg/context#DeadlineExceeded"><code>DeadlineExceeded</code></a>
  607. error now implements
  608. <a href="/pkg/net/#Error"><code>net.Error</code></a>
  609. and reports true for both the <code>Timeout</code> and
  610. <code>Temporary</code> methods.
  611. </p>
  612. </dd>
  613. </dl>
  614. <dl id="crypto_tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
  615. <dd>
  616. <p> <!-- CL 25159, CL 31318 -->
  617. The new method
  618. <a href="/pkg/crypto/tls/#Conn.CloseWrite"><code>Conn.CloseWrite</code></a>
  619. allows TLS connections to be half closed.
  620. </p>
  621. <p> <!-- CL 28075 -->
  622. The new method
  623. <a href="/pkg/crypto/tls/#Config.Clone"><code>Config.Clone</code></a>
  624. clones a TLS configuration.
  625. </p>
  626. <p>
  627. <!-- CL 30790 -->
  628. The new <a href="/pkg/crypto/tls/#Config.GetConfigForClient"><code>Config.GetConfigForClient</code></a>
  629. callback allows selecting a configuration for a client dynamically, based
  630. on the client's
  631. <a href="/pkg/crypto/tls/#ClientHelloInfo"><code>ClientHelloInfo</code></a>.
  632. <!-- CL 31391, CL 32119 -->
  633. The <a href="/pkg/crypto/tls/#ClientHelloInfo"><code>ClientHelloInfo</code></a>
  634. struct now has new
  635. fields <code>Conn</code>, <code>SignatureSchemes</code> (using
  636. the new
  637. type <a href="/kg/crypto/tls/#SignatureScheme"><code>SignatureScheme</code></a>),
  638. <code>SupportedProtos</code>, and <code>SupportedVersions</code>.
  639. </p>
  640. <p> <!-- CL 32115 -->
  641. The new <a href="/pkg/crypto/tls/#Config.GetClientCertificate"><code>Config.GetClientCertificate</code></a>
  642. callback allows selecting a client certificate based on the server's
  643. TLS <code>CertificateRequest</code> message, represented by the new
  644. <a href="/pkg/crypto/tls/#CertificateRequestInfo"><code>CertificateRequestInfo</code></a>.
  645. </p>
  646. <p> <!-- CL 27434 -->
  647. The new
  648. <a href="/pkg/crypto/tls/#Config.KeyLogWriter"><code>Config.KeyLogWriter</code></a>
  649. allows debugging TLS connections
  650. in <a href="https://www.wireshark.org/">WireShark</a> and
  651. similar tools.
  652. </p>
  653. <p> <!-- CL 32115 -->
  654. The new
  655. <a href="/pkg/crypto/tls/#Config.VerifyPeerCertificate"><code>Config.VerifyPeerCertificate</code></a>
  656. callback allows additional validation of a peer's presented certificate.
  657. </p>
  658. <p> <!-- CL 18130 -->
  659. The <code>crypto/tls</code> package now implements basic
  660. countermeasures against CBC padding oracles. There should be
  661. no explicit secret-dependent timings, but it does not attempt to
  662. normalize memory accesses to prevent cache timing leaks.
  663. </p>
  664. <p>
  665. The <code>crypto/tls</code> package now supports
  666. X25519 and <!-- CL 30824, CL 30825 -->
  667. ChaCha20-Poly1305. <!-- CL 30957, CL 30958 -->
  668. ChaCha20-Poly1305 is now prioritized unless <!-- CL 32871 -->
  669. hardware support for AES-GCM is present.
  670. </p>
  671. <p> <!-- CL 27315, CL 35290 -->
  672. AES-128-CBC cipher suites with SHA-256 are also
  673. now supported, but disabled by default.
  674. </p>
  675. </dd>
  676. </dl>
  677. <dl id="crypto_x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
  678. <dd>
  679. <p> <!-- CL 24743 -->
  680. PSS signatures are now supported.
  681. </p>
  682. <p> <!-- CL 32644 -->
  683. <a href="/pkg/crypto/x509/#UnknownAuthorityError"><code>UnknownAuthorityError</code></a>
  684. now has a <code>Cert</code> field, reporting the untrusted
  685. certificate.
  686. </p>
  687. <p>
  688. Certificate validation is more permissive in a few cases and
  689. stricter in a few other cases.
  690. <!--
  691. crypto/x509: allow a leaf certificate to be specified directly as root (CL 27393)
  692. crypto/x509: check that the issuer name matches the issuer's subject name (CL 23571)
  693. crypto/x509: don't accept a root that already appears in a chain. (CL 32121)
  694. crypto/x509: fix name constraints handling (CL 30155)
  695. crypto/x509: parse all names in an RDN (CL 30810)
  696. crypto/x509: recognise ISO OID for RSA+SHA1 (CL 27394)
  697. crypto/x509: require a NULL parameters for RSA public keys (CL 16166, CL 27312)
  698. crypto/x509: return error for missing SerialNumber (CL 27238)
  699. -->
  700. </p>
  701. <p><!-- CL 30375 -->
  702. Root certificates will now also be looked for
  703. at <code>/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem</code>
  704. on Linux, to support RHEL and CentOS.
  705. </p>
  706. </dd>
  707. </dl>
  708. <dl id="database_sql"><dt><a href="/pkg/database/sql/">database/sql</a></dt>
  709. <dd>
  710. <p>
  711. The package now supports <code>context.Context</code>. There are new methods
  712. ending in <code>Context</code> such as
  713. <a href="/pkg/database/sql/#DB.QueryContext"><code>DB.QueryContext</code></a> and
  714. <a href="/pkg/database/sql/#DB.PrepareContext"><code>DB.PrepareContext</code></a>
  715. that take context arguments. Using the new <code>Context</code> methods ensures that
  716. connections are closed and returned to the connection pool when the
  717. request is done; enables canceling in-progress queries
  718. should the driver support that; and allows the database
  719. pool to cancel waiting for the next available connection.
  720. </p>
  721. <p>
  722. The <a href="/pkg/database/sql#IsolationLevel"><code>IsolationLevel</code></a>
  723. can now be set when starting a transaction by setting the isolation level
  724. on <a href="/pkg/database/sql#TxOptions.Isolation"><code>TxOptions.Isolation</code></a> and passing
  725. it to <a href="/pkg/database/sql#DB.BeginTx"><code>DB.BeginTx</code></a>.
  726. An error will be returned if an isolation level is selected that the driver
  727. does not support. A read-only attribute may also be set on the transaction
  728. by setting <a href="/pkg/database/sql/#TxOptions.ReadOnly"><code>TxOptions.ReadOnly</code></a>
  729. to true.
  730. </p>
  731. <p>
  732. Queries now expose the SQL column type information for drivers that support it.
  733. Rows can return <a href="/pkg/database/sql#Rows.ColumnTypes"><code>ColumnTypes</code></a>
  734. which can include SQL type information, column type lengths, and the Go type.
  735. </p>
  736. <p>
  737. A <a href="/pkg/database/sql/#Rows"><code>Rows</code></a>
  738. can now represent multiple result sets. After
  739. <a href="/pkg/database/sql/#Rows.Next"><code>Rows.Next</code></a> returns false,
  740. <a href="/pkg/database/sql/#Rows.NextResultSet"><code>Rows.NextResultSet</code></a>
  741. may be called to advance to the next result set. The existing <code>Rows</code>
  742. should continue to be used after it advances to the next result set.
  743. </p>
  744. <p>
  745. <a href="/pkg/database/sql/#NamedArg"><code>NamedArg</code></a> may be used
  746. as query arguments. The new function <a href="/pkg/database/sql/#Named"><code>Named</code></a>
  747. helps create a <a href="/pkg/database/sql/#NamedArg"><code>NamedArg</code></a>
  748. more succinctly.
  749. <p>
  750. If a driver supports the new
  751. <a href="/pkg/database/sql/driver/#Pinger"><code>Pinger</code></a>
  752. interface, the
  753. <a href="/pkg/database/sql/#DB.Ping"><code>DB.Ping</code></a>
  754. and
  755. <a href="/pkg/database/sql/#DB.PingContext"><code>DB.PingContext</code></a>
  756. methods will use that interface to check whether a
  757. database connection is still valid.
  758. </p>
  759. <p>
  760. The new <code>Context</code> query methods work for all drivers, but
  761. <code>Context</code> cancelation is not responsive unless the driver has been
  762. updated to use them. The other features require driver support in
  763. <a href="/pkg/database/sql/driver"><code>database/sql/driver</code></a>.
  764. Driver authors should review the new interfaces. Users of existing
  765. driver should review the driver documentation to see what
  766. it supports and any system specific documentation on each feature.
  767. </p>
  768. </dd>
  769. </dl>
  770. <dl id="debug_pe"><dt><a href="/pkg/debug/pe/">debug/pe</a></dt>
  771. <dd>
  772. <p> <!-- CL 22720, CL 27212, CL 22181, CL 22332, CL 22336, Issue 15345 -->
  773. The package has been extended and is now used by
  774. <a href="/cmd/link/">the Go linker</a> to read <code>gcc</code>-generated object files.
  775. The new
  776. <a href="/pkg/debug/pe/#File.StringTable"><code>File.StringTable</code></a>
  777. and
  778. <a href="/pkg/debug/pe/#Section.Relocs"><code>Section.Relocs</code></a>
  779. fields provide access to the COFF string table and COFF relocations.
  780. The new
  781. <a href="/pkg/debug/pe/#File.COFFSymbols"><code>File.COFFSymbols</code></a>
  782. allows low-level access to the COFF symbol table.
  783. </p>
  784. </dd>
  785. </dl>
  786. <dl id="encoding_base64"><dt><a href="/pkg/encoding/base64/">encoding/base64</a></dt>
  787. <dd>
  788. <p> <!-- CL 24964 -->
  789. The new
  790. <a href="/pkg/encoding/base64/#Encoding.Strict"><code>Encoding.Strict</code></a>
  791. method returns an <code>Encoding</code> that causes the decoder
  792. to return an error when the trailing padding bits are not zero.
  793. </p>
  794. </dd>
  795. </dl>
  796. <dl id="encoding_binary"><dt><a href="/pkg/encoding/binary/">encoding/binary</a></dt>
  797. <dd>
  798. <p> <!-- CL 28514 -->
  799. <a href="/pkg/encoding/binary/#Read"><code>Read</code></a>
  800. and
  801. <a href="/pkg/encoding/binary/#Write"><code>Write</code></a>
  802. now support booleans.
  803. </p>
  804. </dd>
  805. </dl>
  806. <dl id="encoding_json"><dt><a href="/pkg/encoding/json/">encoding/json</a></dt>
  807. <dd>
  808. <p> <!-- CL 18692 -->
  809. <a href="/pkg/encoding/json/#UnmarshalTypeError"><code>UnmarshalTypeError</code></a>
  810. now includes the struct and field name.
  811. </p>
  812. <p> <!-- CL 31932 -->
  813. A nil <a href="/pkg/encoding/json/#Marshaler"><code>Marshaler</code></a>
  814. now marshals as a JSON <code>null</code> value.
  815. </p>
  816. <p> <!-- CL 21811 -->
  817. A <a href="/pkg/encoding/json/#RawMessage"><code>RawMessage</code></a> value now
  818. marshals the same as its pointer type.
  819. </p>
  820. <p> <!-- CL 30371 -->
  821. <a href="/pkg/encoding/json/#Marshal"><code>Marshal</code></a>
  822. encodes floating-point numbers using the same format as in ES6,
  823. preferring decimal (not exponential) notation for a wider range of values.
  824. In particular, all floating-point integers up to 2<sup>64</sup> format the
  825. same as the equivalent <code>int64</code> representation.
  826. </p>
  827. <p> <!-- CL 30944 -->
  828. In previous versions of Go, unmarshaling a JSON <code>null</code> into an
  829. <a href="/pkg/encoding/json/#Unmarshaler"><code>Unmarshaler</code></a>
  830. was considered a no-op; now the <code>Unmarshaler</code>'s
  831. <code>UnmarshalJSON</code> method is called with the JSON literal
  832. <code>null</code> and can define the semantics of that case.
  833. </p>
  834. </dd>
  835. </dl>
  836. <dl id="encoding_pem"><dt><a href="/pkg/encoding/pem/">encoding/pem</a></dt>
  837. <dd>
  838. <p> <!-- CL 27391 -->
  839. <a href="/pkg/encoding/pem/#Decode"><code>Decode</code></a>
  840. is now strict about the format of the ending line.
  841. </p>
  842. </dd>
  843. </dl>
  844. <dl id="encoding_xml"><dt><a href="/pkg/encoding/xml/">encoding/xml</a></dt>
  845. <dd>
  846. <p> <!-- CL 30946 -->
  847. <a href="/pkg/encoding/xml/#Unmarshal"><code>Unmarshal</code></a>
  848. now has wildcard support for collecting all attributes using
  849. the new <code>",any,attr"</code> struct tag.
  850. </p>
  851. </dd>
  852. </dl>
  853. <dl id="expvar"><dt><a href="/pkg/expvar/">expvar</a></dt>
  854. <dd>
  855. <p> <!-- CL 30917 -->
  856. The new methods
  857. <a href="/pkg/expvar/#Int.Value"><code>Int.Value</code></a>,
  858. <a href="/pkg/expvar/#String.Value"><code>String.Value</code></a>,
  859. <a href="/pkg/expvar/#Float.Value"><code>Float.Value</code></a>, and
  860. <a href="/pkg/expvar/#Func.Value"><code>Func.Value</code></a>
  861. report the current value of an exported variable.
  862. </p>
  863. <p> <!-- CL 24722 -->
  864. The new
  865. function <a href="/pkg/expvar/#Handler"><code>Handler</code></a>
  866. returns the package's HTTP handler, to enable installing it in
  867. non-standard locations.
  868. </p>
  869. </dd>
  870. </dl>
  871. <dl id="fmt"><dt><a href="/pkg/fmt/">fmt</a></dt>
  872. <dd>
  873. <p><!-- CL 30611 -->
  874. <a href="/pkg/fmt/#Scanf"><code>Scanf</code></a>,
  875. <a href="/pkg/fmt/#Fscanf"><code>Fscanf</code></a>, and
  876. <a href="/pkg/fmt/#Sscanf"><code>Sscanf</code></a> now
  877. handle spaces differently and more consistently than
  878. previous releases. See the
  879. <a href="/pkg/fmt/#hdr-Scanning">scanning documentation</a>
  880. for details.
  881. </p>
  882. </dd>
  883. </dl>
  884. <dl id="go_doc"><dt><a href="/pkg/go/doc/">go/doc</a></dt>
  885. <dd>
  886. <p><!-- CL 29870 -->
  887. The new <a href="/pkg/go/doc/#IsPredeclared"><code>IsPredeclared</code></a>
  888. function reports whether a string is a predeclared identifier.
  889. </p>
  890. </dd>
  891. </dl>
  892. <dl id="go_types"><dt><a href="/pkg/go/types/">go/types</a></dt>
  893. <dd>
  894. <p><!-- CL 30715 -->
  895. The new function
  896. <a href="/pkg/go/types/#Default"><code>Default</code></a>
  897. returns the default "typed" type for an "untyped" type.
  898. </p>
  899. <p><!-- CL 31939 -->
  900. The alignment of <code>complex64</code> now matches
  901. the <a href="/cmd/compile/">Go compiler</a>.
  902. </p>
  903. </dd>
  904. </dl>
  905. <dl id="html_template"><dt><a href="/pkg/html/template/">html/template</a></dt>
  906. <dd>
  907. <p><!-- CL 14336 -->
  908. The package now validates
  909. the <code>"type"</code> attribute on
  910. a <code>&lt;script&gt;</code> tag.
  911. </p>
  912. </dd>
  913. </dl>
  914. <dl id="image_png"><dt><a href="/pkg/image/png/">image/png</a></dt>
  915. <dd>
  916. <p> <!-- CL 32143, CL 32140 -->
  917. <a href="/pkg/image/png/#Decode"><code>Decode</code></a>
  918. (and <code>DecodeConfig</code>)
  919. now supports True Color and grayscale transparency.
  920. </p>
  921. <p> <!-- CL 29872 -->
  922. <a href="/pkg/image/png/#Encoder"><code>Encoder</code></a>
  923. is now faster and creates smaller output
  924. when encoding paletted images.
  925. </p>
  926. </dd>
  927. </dl>
  928. <dl id="math_big"><dt><a href="/pkg/math/big/">math/big</a></dt>
  929. <dd>
  930. <p><!-- CL 30706 -->
  931. The new method
  932. <a href="/pkg/math/big/#Int.Sqrt"><code>Int.Sqrt</code></a>
  933. calculates ⌊√x⌋.
  934. </p>
  935. <p>
  936. The new method
  937. <a href="/pkg/math/big/#Float.Scan"><code>Float.Scan</code></a>
  938. is a support routine for
  939. <a href="/pkg/fmt/#Scanner"><code>fmt.Scanner</code></a>.
  940. </p>
  941. <p>
  942. <a href="/pkg/math/big/#Int.ModInverse"><code>Int.ModInverse</code></a>
  943. now supports negative numbers.
  944. </p>
  945. </dd>
  946. </dl>
  947. <dl id="math_rand"><dt><a href="/pkg/math/rand/">math/rand</a></dt>
  948. <dd>
  949. <p><!-- CL 27253, CL 33456 -->
  950. The new <a href="/pkg/math/rand/#Rand.Uint64"><code>Rand.Uint64</code></a>
  951. method returns <code>uint64</code> values. The
  952. new <a href="/pkg/math/rand/#Source64"><code>Source64</code></a>
  953. interface describes sources capable of generating such values
  954. directly; otherwise the <code>Rand.Uint64</code> method
  955. constructs a <code>uint64</code> from two calls
  956. to <a href="/pkg/math/rand/#Source"><code>Source</code></a>'s
  957. <code>Int63</code> method.
  958. </p>
  959. </dd>
  960. </dl>
  961. <dl id="mime"><dt><a href="/pkg/mime/">mime</a></dt>
  962. <dd>
  963. <p> <!-- CL 32175 -->
  964. <a href="/pkg/mime/#ParseMediaType"><code>ParseMediaType</code></a>
  965. now preserves unnecessary backslash escapes as literals,
  966. in order to support MSIE.
  967. When MSIE sends a full file path (in “intranet mode”), it does not
  968. escape backslashes: “<code>C:\dev\go\foo.txt</code>”, not
  969. “<code>C:\\dev\\go\\foo.txt</code>”.
  970. If we see an unnecessary backslash escape, we now assume it is from MSIE
  971. and intended as a literal backslash.
  972. No known MIME generators emit unnecessary backslash escapes
  973. for simple token characters like numbers and letters.
  974. </p>
  975. </dd>
  976. </dl>
  977. <dl id="mime_quotedprintable"><dt><a href="/pkg/mime/quotedprintable/">mime/quotedprintable</a></dt>
  978. <dd>
  979. <p>
  980. The
  981. <a href="/pkg/mime/quotedprintable/#Reader"><code>Reader</code></a>'s
  982. parsing has been relaxed in two ways to accept
  983. more input seen in the wild.
  984. <!-- CL 32174 -->
  985. First, it accepts an equals sign (<code>=</code>) not followed
  986. by two hex digits as a literal equal sign.
  987. <!-- CL 27530 -->
  988. Second, it silently ignores a trailing equals sign at the end of
  989. an encoded input.
  990. </p>
  991. </dd>
  992. </dl>
  993. <dl id="net"><dt><a href="/pkg/net/">net</a></dt>
  994. <dd>
  995. <p><!-- CL 30164, CL 33473 -->
  996. The <a href="/pkg/net/#Conn"><code>Conn</code></a> documentation
  997. has been updated to clarify expectations of an interface
  998. implementation. Updates in the <code>net/http</code> packages
  999. depend on implementations obeying the documentation.
  1000. </p>
  1001. <p><i>Updating:</i> implementations of the <code>Conn</code> interface should verify
  1002. they implement the documented semantics. The
  1003. <a href="https://godoc.org/golang.org/x/net/nettest">golang.org/x/net/nettest</a>
  1004. package will exercise a <code>Conn</code> and validate it behaves properly.
  1005. </p>
  1006. <p><!-- CL 32099 -->
  1007. The new method
  1008. <a href="/pkg/net/#UnixListener.SetUnlinkOnClose"><code>UnixListener.SetUnlinkOnClose</code></a>
  1009. sets whether the underlying socket file should be removed from the file system when
  1010. the listener is closed.
  1011. </p>
  1012. <p><!-- CL 29951 -->
  1013. The new <a href="/pkg/net/#Buffers"><code>Buffers</code></a> type permits
  1014. writing to the network more efficiently from multiple discontiguous buffers
  1015. in memory. On certain machines, for certain types of connections,
  1016. this is optimized into an OS-specific batch write operation (such as <code>writev</code>).
  1017. </p>
  1018. <p><!-- CL 29440 -->
  1019. The new <a href="/pkg/net/#Resolver"><code>Resolver</code></a> looks up names and numbers
  1020. and supports <a href="/pkg/context/#Context"><code>context.Context</code></a>.
  1021. The <a href="/pkg/net/#Dialer"><code>Dialer</code></a> now has an optional
  1022. <a href="/pkg/net/#Dialer.Resolver"><code>Resolver</code> field</a>.
  1023. </p>
  1024. <p><!-- CL 29892 -->
  1025. <a href="/pkg/net/#Interfaces"><code>Interfaces</code></a> is now supported on Solaris.
  1026. </p>
  1027. <p><!-- CL 29233, CL 24901 -->
  1028. The Go DNS resolver now supports <code>resolv.conf</code>'s “<code>rotate</code>”
  1029. and “<code>option</code> <code>ndots:0</code>” options. The “<code>ndots</code>” option is
  1030. now respected in the same way as <code>libresolve</code>.
  1031. </p>
  1032. </dd>
  1033. </dl>
  1034. <dl id="net_http"><dt><a href="/pkg/net/http/">net/http</a></dt>
  1035. <dd>
  1036. <p>Server changes:</p>
  1037. <ul>
  1038. <li>The server now supports graceful shutdown support, <a href="#http_shutdown">mentioned above</a>.</li>
  1039. <li> <!-- CL 32024 -->
  1040. The <a href="/pkg/net/http/#Server"><code>Server</code></a>
  1041. adds configuration options
  1042. <code>ReadHeaderTimeout</code> and <code>IdleTimeout</code>
  1043. and documents <code>WriteTimeout</code>.
  1044. </li>
  1045. <li> <!-- CL 32014 -->
  1046. <a href="/pkg/net/http/#FileServer"><code>FileServer</code></a>
  1047. and
  1048. <a href="/pkg/net/http/#ServeContent"><code>ServeContent</code></a>
  1049. now support HTTP <code>If-Match</code> conditional requests,
  1050. in addition to the previous <code>If-None-Match</code>
  1051. support for ETags properly formatted according to RFC 7232, section 2.3.
  1052. </li>
  1053. </ul>
  1054. <p>
  1055. There are several additions to what a server's <code>Handler</code> can do:
  1056. </p>
  1057. <ul>
  1058. <li><!-- CL 31173 -->
  1059. The <a href="/pkg/context/#Context"><code>Context</code></a>
  1060. returned
  1061. by <a href="/pkg/net/http/#Request.Context"><code>Request.Context</code></a>
  1062. is canceled if the underlying <code>net.Conn</code>
  1063. closes. For instance, if the user closes their browser in the
  1064. middle of a slow request, the <code>Handler</code> can now
  1065. detect that the user is gone. This complements the
  1066. existing <a href="/pkg/net/http/#CloseNotifier"><code>CloseNotifier</code></a>
  1067. support. This functionality requires that the underlying
  1068. <a href="/pkg/net/#Conn"><code>net.Conn</code></a> implements
  1069. <a href="#net">recently clarified interface documentation</a>.
  1070. </li>
  1071. <li><!-- CL 32479 -->
  1072. To serve trailers produced after the header has already been written,
  1073. see the new
  1074. <a href="/pkg/net/http/#TrailerPrefix"><code>TrailerPrefix</code></a>
  1075. mechanism.
  1076. </li>
  1077. <li><!-- CL 33099 -->
  1078. A <code>Handler</code> can now abort a response by panicking
  1079. with the error
  1080. <a href="/pkg/net/http/#ErrAbortHandler"><code>ErrAbortHandler</code></a>.
  1081. </li>
  1082. <li><!-- CL 30812 -->
  1083. A <code>Write</code> of zero bytes to a
  1084. <a href="/pkg/net/http/#ResponseWriter"><code>ResponseWriter</code></a>
  1085. is now defined as a
  1086. way to test whether a <code>ResponseWriter</code> has been hijacked:
  1087. if so, the <code>Write</code> returns
  1088. <a href="/pkg/net/http/#ErrHijacked"><code>ErrHijacked</code></a>
  1089. without printing an error
  1090. to the server's error log.
  1091. </li>
  1092. </ul>
  1093. <p>Client &amp; Transport changes:</p>
  1094. <ul>
  1095. <li><!-- CL 28930, CL 31435 -->
  1096. The <a href="/pkg/net/http/#Client"><code>Client</code></a>
  1097. now copies most request headers on redirect. See
  1098. <a href="/pkg/net/http/#Client">the documentation</a>
  1099. on the <code>Client</code> type for details.
  1100. </li>
  1101. <li><!-- CL 29072 -->
  1102. The <a href="/pkg/net/http/#Transport"><code>Transport</code></a>
  1103. now supports international domain names. Consequently, so do
  1104. <a href="/pkg/net/http/#Get">Get</a> and other helpers.
  1105. </li>
  1106. <li><!-- CL 31733, CL 29852 -->
  1107. The <code>Client</code> now supports 301, 307, and 308 redirects.
  1108. For example, <code>Client.Post</code> now follows 301
  1109. redirects, converting them to <code>GET</code> requests
  1110. without bodies, like it did for 302 and 303 redirect responses
  1111. previously.
  1112. The <code>Client</code> now also follows 307 and 308
  1113. redirects, preserving the original request method and body, if
  1114. any. If the redirect requires resending the request body, the
  1115. request must have the new
  1116. <a href="/pkg/net/http/#Request"><code>Request.GetBody</code></a>
  1117. field defined.
  1118. <a href="/pkg/net/http/#NewRequest"><code>NewRequest</code></a>
  1119. sets <code>Request.GetBody</code> automatically for common
  1120. body types.
  1121. </li>
  1122. <li><!-- CL 32482 -->
  1123. The <code>Transport</code> now rejects requests for URLs with
  1124. ports containing non-digit characters.
  1125. </li>
  1126. <li><!-- CL 27117 -->
  1127. The <code>Transport</code> will now retry non-idempotent
  1128. requests if no bytes were written before a network failure
  1129. and the request has no body.
  1130. </li>
  1131. <li><!-- CL 32481 -->
  1132. The
  1133. new <a href="/pkg/net/http/#Transport"><code>Transport.ProxyConnectHeader</code></a>
  1134. allows configuration of header values to send to a proxy
  1135. during a <code>CONNECT</code> request.
  1136. </li>
  1137. <li> <!-- CL 28077 -->
  1138. The <a href="/pkg/net/http/#DefaultTransport"><code>DefaultTransport.Dialer</code></a>
  1139. now enables <code>DualStack</code> ("<a href="https://tools.ietf.org/html/rfc6555">Happy Eyeballs</a>") support,
  1140. allowing the use of IPv4 as a backup if it looks like IPv6 might be
  1141. failing.
  1142. </li>
  1143. <li> <!-- CL 31726 -->
  1144. The <a href="/pkg/net/http/#Transport"><code>Transport</code></a>
  1145. no longer reads a byte of a non-nil
  1146. <a href="/pkg/net/http/#Request.Body"><code>Request.Body</code></a>
  1147. when the
  1148. <a href="/pkg/net/http/#Request.ContentLength"><code>Request.ContentLength</code></a>
  1149. is zero to determine whether the <code>ContentLength</code>
  1150. is actually zero or just undefined.
  1151. To explicitly signal that a body has zero length,
  1152. either set it to <code>nil</code>, or set it to the new value
  1153. <a href="/pkg/net/http/#NoBody"><code>NoBody</code></a>.
  1154. The new <code>NoBody</code> value is intended for use by <code>Request</code>
  1155. constructor functions; it is used by
  1156. <a href="/pkg/net/http/#NewRequest"><code>NewRequest</code></a>.
  1157. </li>
  1158. </ul>
  1159. </dd>
  1160. </dl>
  1161. <dl id="net_http_httptrace"><dt><a href="/pkg/net/http/httptrace/">net/http/httptrace</a></dt>
  1162. <dd>
  1163. <p> <!-- CL 30359 -->
  1164. There is now support for tracing a client request's TLS handshakes with
  1165. the new
  1166. <a href="/pkg/net/http/httptrace/#ClientTrace.TLSHandshakeStart"><code>ClientTrace.TLSHandshakeStart</code></a>
  1167. and
  1168. <a href="/pkg/net/http/httptrace/#ClientTrace.TLSHandshakeDone"><code>ClientTrace.TLSHandshakeDone</code></a>.
  1169. </p>
  1170. </dd>
  1171. </dl>
  1172. <dl id="net_http_httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
  1173. <dd>
  1174. <p> <!-- CL 32356 -->
  1175. The <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a>
  1176. has a new optional hook,
  1177. <a href="/pkg/net/http/httputil/#ReverseProxy.ModifyResponse"><code>ModifyResponse</code></a>,
  1178. for modifying the response from the back end before proxying it to the client.
  1179. </p>
  1180. </dd>
  1181. </dl>
  1182. <dl id="net_mail"><dt><a href="/pkg/net/mail/">net/mail</a></dt>
  1183. <dd>
  1184. <p> <!-- CL 32176 -->
  1185. Empty quoted strings are once again allowed in the name part of
  1186. an address. That is, Go 1.4 and earlier accepted
  1187. <code>""</code> <code>&lt;gopher@example.com&gt;</code>,
  1188. but Go 1.5 introduced a bug that rejected this address.
  1189. The address is recognized again.
  1190. </p>
  1191. <p> <!-- CL 31581 -->
  1192. The
  1193. <a href="/pkg/net/mail/#Header.Date"><code>Header.Date</code></a>
  1194. method has always provided a way to parse
  1195. the <code>Date:</code> header.
  1196. A new function
  1197. <a href="/pkg/net/mail/#ParseDate"><code>ParseDate</code></a>
  1198. allows parsing dates found in other
  1199. header lines, such as the <code>Resent-Date:</code> header.
  1200. </p>
  1201. </dd>
  1202. </dl>
  1203. <dl id="net_smtp"><dt><a href="/pkg/net/smtp/">net/smtp</a></dt>
  1204. <dd>
  1205. <p> <!-- CL 33143 -->
  1206. If an implementation of the
  1207. <a href="/pkg/net/smtp/#Auth"><code>Auth.Start</code></a>
  1208. method returns an empty <code>toServer</code> value,
  1209. the package no longer sends
  1210. trailing whitespace in the SMTP <code>AUTH</code> command,
  1211. which some servers rejected.
  1212. </p>
  1213. </dd>
  1214. </dl>
  1215. <dl id="net_url"><dt><a href="/pkg/net/url/">net/url</a></dt>
  1216. <dd>
  1217. <p> <!-- CL 31322 -->
  1218. The new functions
  1219. <a href="/pkg/net/url/#PathEscape"><code>PathEscape</code></a>
  1220. and
  1221. <a href="/pkg/net/url/#PathUnescape"><code>PathUnescape</code></a>
  1222. are similar to the query escaping and unescaping functions but
  1223. for path elements.
  1224. </p>
  1225. <p> <!-- CL 28933 -->
  1226. The new methods
  1227. <a href="/pkg/net/url/#URL.Hostname"><code>URL.Hostname</code></a>
  1228. and
  1229. <a href="/pkg/net/url/#URL.Port"><code>URL.Port</code></a>
  1230. return the hostname and port fields of a URL,
  1231. correctly handling the case where the port may not be present.
  1232. </p>
  1233. <p> <!-- CL 28343 -->
  1234. The existing method
  1235. <a href="/pkg/net/url/#URL.ResolveReference"><code>URL.ResolveReference</code></a>
  1236. now properly handles paths with escaped bytes without losing
  1237. the escaping.
  1238. </p>
  1239. <p> <!-- CL 31467 -->
  1240. The <code>URL</code> type now implements
  1241. <a href="/pkg/encoding/#BinaryMarshaler"><code>encoding.BinaryMarshaler</code></a> and
  1242. <a href="/pkg/encoding/#BinaryUnmarshaler"><code>encoding.BinaryUnmarshaler</code></a>,
  1243. making it possible to process URLs in <a href="/pkg/encoding/gob/">gob data</a>.
  1244. </p>
  1245. <p> <!-- CL 29610, CL 31582 -->
  1246. Following RFC 3986,
  1247. <a href="/pkg/net/url/#Parse"><code>Parse</code></a>
  1248. now rejects URLs like <code>this_that:other/thing</code> instead of
  1249. interpreting them as relative paths (<code>this_that</code> is not a valid scheme).
  1250. To force interpretation as a relative path,
  1251. such URLs should be prefixed with “<code>./</code>”.
  1252. The <code>URL.String</code> method now inserts this prefix as needed.
  1253. </p>
  1254. </dd>
  1255. </dl>
  1256. <dl id="os"><dt><a href="/pkg/os/">os</a></dt>
  1257. <dd>
  1258. <p> <!-- CL 16551 -->
  1259. The new function
  1260. <a href="/pkg/os/#Executable"><code>Executable</code></a> returns
  1261. the path name of the running executable.
  1262. </p>
  1263. <p> <!-- CL 30614 -->
  1264. An attempt to call a method on
  1265. an <a href="/pkg/os/#File"><code>os.File</code></a> that has
  1266. already been closed will now return the new error
  1267. value <a href="/pkg/os/#ErrClosed"><code>os.ErrClosed</code></a>.
  1268. Previously it returned a system-specific error such
  1269. as <code>syscall.EBADF</code>.
  1270. </p>
  1271. <p> <!-- CL 31358 -->
  1272. On Unix systems, <a href="/pkg/os/#Rename"><code>os.Rename</code></a>
  1273. will now return an error when used to rename a directory to an
  1274. existing empty directory.
  1275. Previously it would fail when renaming to a non-empty directory
  1276. but succeed when renaming to an empty directory.
  1277. This makes the behavior on Unix correspond to that of other systems.
  1278. </p>
  1279. <p> <!-- CL 32451 -->
  1280. On Windows, long absolute paths are now transparently converted to
  1281. extended-length paths (paths that start with “<code>\\?\</code>”).
  1282. This permits the package to work with files whose path names are
  1283. longer than 260 characters.
  1284. </p>
  1285. <p> <!-- CL 29753 -->
  1286. On Windows, <a href="/pkg/os/#IsExist"><code>os.IsExist</code></a>
  1287. will now return <code>true</code> for the system
  1288. error <code>ERROR_DIR_NOT_EMPTY</code>.
  1289. This roughly corresponds to the existing handling of the Unix
  1290. error <code>ENOTEMPTY</code>.
  1291. </p>
  1292. <p> <!-- CL 32152 -->
  1293. On Plan 9, files that are not served by <code>#M</code> will now
  1294. have <a href="/pkg/os/#ModeDevice"><code>ModeDevice</code></a> set in
  1295. the value returned
  1296. by <a href="/pkg/os/#FileInfo"><code>FileInfo.Mode</code></a>.
  1297. </p>
  1298. </dd>
  1299. </dl>
  1300. <dl id="path_filepath"><dt><a href="/pkg/path/filepath/">path/filepath</a></dt>
  1301. <dd>
  1302. <p>
  1303. A number of bugs and corner cases on Windows were fixed:
  1304. <a href="/pkg/path/filepath/#Abs"><code>Abs</code></a> now calls <code>Clean</code> as documented,
  1305. <a href="/pkg/path/filepath/#Glob"><code>Glob</code></a> now matches
  1306. “<code>\\?\c:\*</code>”,
  1307. <a href="/pkg/path/filepath/#EvalSymlinks"><code>EvalSymlinks</code></a> now
  1308. correctly handles “<code>C:.</code>”, and
  1309. <a href="/pkg/path/filepath/#Clean"><code>Clean</code></a> now properly
  1310. handles a leading “<code>..</code>” in the path.
  1311. </p>
  1312. </dd>
  1313. </dl>
  1314. <dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
  1315. <dd>
  1316. <p> <!-- CL 30088 -->
  1317. The new function
  1318. <a href="/pkg/reflect/#Swapper"><code>Swapper</code></a> was
  1319. added to support <a href="#sortslice"><code>sort.Slice</code></a>.
  1320. </p>
  1321. </dd>
  1322. </dl>
  1323. <dl id="strconv"><dt><a href="/pkg/strconv/">strconv</a></dt>
  1324. <dd>
  1325. <p> <!-- CL 31210 -->
  1326. The <a href="/pkg/strconv/#Unquote"><code>Unquote</code></a>
  1327. function now strips carriage returns (<code>\r</code>) in
  1328. backquoted raw strings, following the
  1329. <a href="/ref/spec#String_literals">Go language semantics</a>.
  1330. </p>
  1331. </dd>
  1332. </dl>
  1333. <dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
  1334. <dd>
  1335. <p> <!-- CL 25050, CL 25022 -->
  1336. The <a href="/pkg/syscall/#Getpagesize"><code>Getpagesize</code></a>
  1337. now returns the system's size, rather than a constant value.
  1338. Previously it always returned 4KB.
  1339. </p>
  1340. <p> <!-- CL 31446 -->
  1341. The signature
  1342. of <a href="/pkg/syscall/#Utimes"><code>Utimes</code></a> has
  1343. changed on Solaris to match all the other Unix systems'
  1344. signature. Portable code should continue to use
  1345. <a href="/pkg/os/#Chtimes"><code>os.Chtimes</code></a> instead.
  1346. </p>
  1347. <p> <!-- CL 32319 -->
  1348. The <code>X__cmsg_data</code> field has been removed from
  1349. <a href="/pkg/syscall/#Cmsghdr"><code>Cmsghdr</code></a>.
  1350. </p>
  1351. </dd>
  1352. </dl>
  1353. <dl id="text_template"><dt><a href="/pkg/text/template/">text/template</a></dt>
  1354. <dd>
  1355. <p> <!-- CL 31462 -->
  1356. <a href="/pkg/text/template/#Template.Execute"><code>Template.Execute</code></a>
  1357. can now take a
  1358. <a href="/pkg/reflect/#Value"><code>reflect.Value</code></a> as its data
  1359. argument, and
  1360. <a href="/pkg/text/template/#FuncMap"><code>FuncMap</code></a>
  1361. functions can also accept and return <code>reflect.Value</code>.
  1362. </p>
  1363. </dd>
  1364. </dl>
  1365. <dl id="time"><dt><a href="/pkg/time/">time</a></dt>
  1366. <dd>
  1367. <p> <!-- CL 20118 --> The new function
  1368. <a href="/pkg/time/#Until"><code>Until</code></a> complements
  1369. the analogous <code>Since</code> function.
  1370. </p>
  1371. <p> <!-- CL 29338 -->
  1372. <a href="/pkg/time/#ParseDuration"><code>ParseDuration</code></a>
  1373. now accepts long fractional parts.
  1374. </p>
  1375. <p> <!-- CL 33429 -->
  1376. <a href="/pkg/time/#Parse"><code>Parse</code></a>
  1377. now rejects dates before the start of a month, such as June 0;
  1378. it already rejected dates beyond the end of the month, such as
  1379. June 31 and July 32.
  1380. </p>
  1381. <p> <!-- CL 33029 --> <!-- CL 34816 -->
  1382. The <code>tzdata</code> database has been updated to version
  1383. 2016j for systems that don't already have a local time zone
  1384. database.
  1385. </p>
  1386. <p>
  1387. </dd>
  1388. </dl>
  1389. <dl id="testing"><dt><a href="/pkg/testing/">testing</a></dt>
  1390. <dd>
  1391. <p><!-- CL 29970 -->
  1392. The new method
  1393. <a href="/pkg/testing/#T.Name"><code>T.Name</code></a>
  1394. (and <code>B.Name</code>) returns the name of the current
  1395. test or benchmark.
  1396. </p>
  1397. <p><!-- CL 32483 -->
  1398. The new function
  1399. <a href="/pkg/testing/#CoverMode"><code>CoverMode</code></a>
  1400. reports the test coverage mode.
  1401. </p>
  1402. <p><!-- CL 32615 -->
  1403. Tests and benchmarks are now marked as failed if the race
  1404. detector is enabled and a data race occurs during execution.
  1405. Previously, individual test cases would appear to pass,
  1406. and only the overall execution of the test binary would fail.
  1407. </p>
  1408. <p><!-- CL 32455 -->
  1409. The signature of the
  1410. <a href="/pkg/testing/#MainStart"><code>MainStart</code></a>
  1411. function has changed, as allowed by the documentation. It is an
  1412. internal detail and not part of the Go 1 compatibility promise.
  1413. If you're not calling <code>MainStart</code> directly but see
  1414. errors, that likely means you set the
  1415. normally-empty <code>GOROOT</code> environment variable and it
  1416. doesn't match the version of your <code>go</code> command's binary.
  1417. </p>
  1418. </dd>
  1419. </dl>
  1420. <dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt>
  1421. <dd>
  1422. <p><!-- CL 30935 -->
  1423. <a href="/pkg/unicode/#SimpleFold"><code>SimpleFold</code></a>
  1424. now returns its argument unchanged if the provided input was an invalid rune.
  1425. Previously, the implementation failed with an index bounds check panic.
  1426. </p>
  1427. </dd>
  1428. </dl>