Skip to content

Commit 268bc39

Browse files
committed
doc: more go1.8.html tweaks and new context additions section
TBR=See https://golang.org/cl/33244 Updates #17929 Change-Id: Id5d5472cf1e41472d8d0f82ee133c7387257ba2b Reviewed-on: https://go-review.googlesource.com/33664 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 11f8676 commit 268bc39

File tree

1 file changed

+89
-51
lines changed

1 file changed

+89
-51
lines changed

doc/go1.8.html

+89-51
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@ <h2 id="introduction">DRAFT RELEASE NOTES - Introduction to Go 1.8</h2>
3535
<a href="#compiler">updates the compiler back end</a> to generate more efficient code,
3636
<a href="#gc">reduces GC pauses</a> by eliminating stop-the-world stack rescanning,
3737
<a href="#h2push">adds HTTP/2 Push support</a>,
38-
<a href="#httpshutdown">adds HTTP graceful shutdown</a>,
38+
<a href="#http_shutdown">adds HTTP graceful shutdown</a>,
39+
<a href="#more_context">more context support</a>,
3940
and <a href="#sort">simplifies sorting slices</a>.
4041
</p>
4142

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

4445
<p>
4546
When explicitly converting structs, tags are now ignored for structural type identity.
46-
See <a href="/ref/spec#Conversions">language specification</a> for details.
47+
See the <a href="/ref/spec#Conversions">language specification</a> for details.
4748
</p>
4849

4950
<p> <!-- CL 17711 -->
@@ -74,7 +75,7 @@ <h2 id="ports">Ports</h2>
7475

7576
<p>
7677
Go 1.8 now only supports OS X 10.8 or later. This is likely the last
77-
Go release to continue supporting 10.8. Compiling Go or running
78+
Go release to support 10.8. Compiling Go or running
7879
binaries on older OS X versions is untested.
7980
</p>
8081

@@ -229,7 +230,7 @@ <h3 id="compiler">Compiler Toolchain</h3>
229230
<p>
230231
In addition to enabling the new compiler back end for all systems,
231232
Go 1.8 also introduces a new compiler front end. The new compiler
232-
front end should not be noticeable to users is the foundation for
233+
front end should not be noticeable to users but is the foundation for
233234
future performance work.
234235
</p>
235236

@@ -252,14 +253,15 @@ <h3 id="gccgo">Gccgo</h3>
252253
<h3 id="cmd_go">Go command</h3>
253254

254255
<p>
255-
The <a href="/cmd/go/"><code>go</code></a> command's basic operation
256-
is unchanged, but there are a number of changes worth noting.
256+
The <a href="/cmd/go/"><code>go</code> command</a>'s basic operation
257+
is unchanged, but there is one addition worth noting.
257258
</p>
258259

259260
<p>
260-
A new
261+
The new
261262
<a href="/cmd/go/#hdr-Print_information_for_bug_reports"><code>go</code>
262-
<code>bug</code></a>” command helps users file bug reports.
263+
<code>bug</code></a>” starts a bug report on GitHub, prefilled
264+
with information about the current system.
263265
</p>
264266

265267
<h3 id="cmd_doc">Go doc</h3>
@@ -274,14 +276,15 @@ <h3 id="cmd_doc">Go doc</h3>
274276
</p>
275277

276278
<p> <!-- CL 25420 -->
277-
In order to improve the readability of the <code>doc</code>'s
279+
In order to improve the readability of <code>doc</code>'s
278280
output, each summary of the first-level items is guaranteed to
279281
occupy a single line.
280282
</p>
281283

282284
<p> <!-- CL 31852 -->
283-
Documentation for interface methods is now only shown when requested
284-
explicitly.
285+
Documentation for a specific method in an interface definition can
286+
now be requested, as in
287+
<code>go</code> <code>doc</code> <code>net.Conn.SetDeadline</code>”.
285288
</p>
286289

287290
<h3 id="plugin">Plugins</h3>
@@ -307,10 +310,14 @@ <h3 id="liveness">Argument Liveness</h3>
307310
</p>
308311

309312
<p>
310-
<i>Updating:</i> Users of finalizers should see the example
311-
in the <a href="/pkg/runtime/#KeepAlive"><code>KeepAlive</code> documentation</a>
312-
to see where a call to <code>KeepAlive</code> might be needed.
313-
</p>
313+
<i>Updating:</i>
314+
Code that sets a finalizer on an allocated object may need to add
315+
calls to <code>runtime.KeepAlive</code> in functions or methods
316+
using that object.
317+
Read the
318+
<a href="/pkg/runtime/#KeepAlive"><code>KeepAlive</code>
319+
documentation</a> and its example for more details.
320+
</p>
314321

315322
<h3 id="memstats">MemStats Documentation</h3>
316323

@@ -344,8 +351,8 @@ <h3 id="gc">Garbage Collector</h3>
344351

345352
<p>
346353
Garbage collection pauses should be significantly shorter than they
347-
were in Go 1.7, often as low as 10 microseconds and usually under 100
348-
microseconds.
354+
were in Go 1.7, usually under 100 microseconds and often as low as
355+
10 microseconds.
349356
See the
350357
<a href="https://github.com/golang/proposal/blob/master/design/17503-eliminate-rescan.md"
351358
>document on eliminating stop-the-world stack re-scanning</a>
@@ -357,7 +364,7 @@ <h3 id="defer">Defer</h3>
357364
<!-- CL 29656, CL 29656 -->
358365
<p>
359366
The overhead of <a href="/ref/spec/#Defer_statements">deferred
360-
function calls</a> has been reduced by half.
367+
function calls</a> has been reduced by about half.
361368
</p>
362369

363370
<h3 id="cgoperf">Cgo</h3>
@@ -409,11 +416,33 @@ <h3 id="http_shutdown">HTTP Server Graceful Shutdown</h3>
409416
<p> <!-- CL 32329 -->
410417
The HTTP Server now has support for graceful shutdown using the new
411418
<a href="/pkg/net/http/#Server.Shutdown"><code>Server.Shutdown</code></a>
412-
method. The related and more abrupt
419+
method and abrupt shutdown using the new
413420
<a href="/pkg/net/http/#Server.Close"><code>Server.Close</code></a>
414-
is also new.
421+
method.
422+
</p>
423+
424+
<h3 id="more_context">More Context Support</h3>
425+
426+
<p>
427+
Continuing <a href="/doc/go1.7#context">Go 1.7's adoption</a>
428+
of <a href="/pkg/context/#Context"><code>context.Context</code></a>
429+
into the standard library, Go 1.8 adds more context support
430+
to existing packages:
415431
</p>
416432

433+
<ul>
434+
<li>The new <a href="/pkg/net/http/#Server.Shutdown"><code>Server.Shutdown</code></a>
435+
takes a context argument.</li>
436+
<li>There have been <a href="#database_sql">significant additions</a> to the
437+
<a href="/pkg/database/sql/">database/sql</a> package with context support.</li>
438+
<li>The new <a href="/pkg/testing/#T.Context"><code>T.Context</code></a>
439+
method in the <a href="/pkg/testing/">testing</a> package now returns a context for
440+
the active test or benchmark.</li>
441+
<li>All nine of the new <code>Lookup</code> methods on the new
442+
<a href="/pkg/net/#Resolver"><code>net.Resolver</code></a> now
443+
take a context.</li>
444+
</ul>
445+
417446
<h3 id="minor_library_changes">Minor changes to the library</h3>
418447

419448
<p>
@@ -493,8 +522,8 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
493522

494523
Similarly,
495524
the <a href="/pkg/compress/gzip/#Reader"><code>Reader</code></a>
496-
now updates the <code>Header.ModTime</code> field only if the
497-
encoded <code>MTIME</code> field is non-zero.
525+
now reports a zero encoded <code>MTIME</code> field as a zero
526+
<code>Header.ModTime</code>.
498527
</p>
499528

500529
</dd>
@@ -519,12 +548,11 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
519548
ending in <code>Context</code> such as
520549
<a href="/pkg/database/sql/#DB.QueryContext"><code>DB.QueryContext</code></a> and
521550
<a href="/pkg/database/sql/#DB.PrepareContext"><code>DB.PrepareContext</code></a>
522-
that support <code>Context</code>. By using the new <code>Context</code> methods it ensures
551+
that take context arguments. Using the new <code>Context</code> methods ensures that
523552
connections are closed and returned to the connection pool when the
524-
request is done. It also enables canceling in-progress queries
525-
should the driver support it. Finally, using the <code>Context</code>
526-
methods allows the database pool to cancel waiting for the next
527-
available connection.
553+
request is done; enables canceling in-progress queries
554+
should the driver support that; and allows the database
555+
pool to cancel waiting for the next available connection.
528556
</p>
529557
<p>
530558
The <a href="/pkg/database/sql#IsolationLevel"><code>IsolationLevel</code></a>
@@ -541,8 +569,9 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
541569
which can include SQL type information, column type lengths, and the Go type.
542570
</p>
543571
<p>
544-
Multiple result sets are now supported on Rows. After
545-
<a href="/pkg/database/sql/#Rows.Next"><code>Rows.Next</code></a> returns false
572+
A <a href="/pkg/database/sql/#Rows"><code>Rows</code></a>
573+
can now represent multiple result sets. After
574+
<a href="/pkg/database/sql/#Rows.Next"><code>Rows.Next</code></a> returns false,
546575
<a href="/pkg/database/sql/#Rows.NextResultSet"><code>Rows.NextResultSet</code></a>
547576
may be called to advance to the next result set. The existing <code>Rows</code>
548577
should be continued to be used after it advances to the next result set.
@@ -553,11 +582,14 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
553582
helps create a <a href="/pkg/database/sql/#NamedParam"><code>NamedParam</code></a>
554583
more succinctly.
555584
<p>
556-
Drivers that support the new <a href="/pkg/database/sql/driver/#Pinger"><code>Pinger</code></a>
557-
interface can now check if the server is still alive when the the
585+
If a driver supports the new
586+
<a href="/pkg/database/sql/driver/#Pinger"><code>Pinger</code></a>
587+
interface, the <code>DB</code>'s
558588
<a href="/pkg/database/sql/#DB.Ping"><code>DB.Ping</code></a>
559-
or <a href="/pkg/database/sql/#DB.PingContext"><code>DB.PingContext</code></a>
560-
is called.
589+
and
590+
<a href="/pkg/database/sql/#DB.PingContext"><code>DB.PingContext</code></a>
591+
methods will use that interface to check whether a
592+
database connection is still valid.
561593
</p>
562594
<p>
563595
The new <code>Context</code> query methods work for all drivers, but
@@ -619,8 +651,8 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
619651
</p>
620652

621653
<p> <!-- CL 31932 -->
622-
A <code>nil</code> <a href="/pkg/encoding/json/#Marshaler"><code>Marshaler</code></a>
623-
now marshals as a JSON "<code>null</code>" value.
654+
A nil <a href="/pkg/encoding/json/#Marshaler"><code>Marshaler</code></a>
655+
now marshals as a JSON <code>null</code> value.
624656
</p>
625657

626658
<p> <!-- CL 21811 -->
@@ -629,17 +661,20 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
629661
</p>
630662

631663
<p> <!-- CL 30371 -->
632-
Marshal encodes floating-point numbers using the same format as in ES6,
664+
<a href="/pkg/encoding/json/#Marshal"><code>Marshal</code></a>
665+
encodes floating-point numbers using the same format as in ES6,
633666
preferring decimal (not exponential) notation for a wider range of values.
634667
In particular, all floating-point integers up to 2<sup>64</sup> format the
635668
same as the equivalent <code>int64</code> representation.
636669
</p>
637670

638671
<p> <!-- CL 30944 -->
639-
Implementations
672+
673+
In previous versions of Go, unmarshaling a JSON <code>null</code> into an
640674
of <a href="/pkg/encoding/json/#Unmarshaler"><code>Unmarshaler</code></a>
641-
are now called with the literal "<code>null</code>" and can
642-
decide how to handle it.
675+
was considered a no-op; now the <code>Unmarshaler</code>'s
676+
<code>UnmarshalJSON</code> method is called with the JSON literal
677+
<code>null</code> and can define the semantics of that case.
643678
</p>
644679

645680
</dd>
@@ -695,12 +730,13 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
695730

696731
<p><!-- CL 27253, CL 33456 -->
697732
The new <a href="/pkg/math/rand/#Rand.Uint64"><code>Rand.Uint64</code></a>
698-
method returns <code>uint64</code> values. The
699-
new <a href="/pkg/math/rand/#Rand.Source64"><code>Rand.Source64</code></a>
733+
method returns <code>uint64</code> values. The
734+
new <a href="/pkg/math/rand/#Source64"><code>Source64</code></a>
700735
interface describes sources capable of generating such values
701736
directly; otherwise the <code>Rand.Uint64</code> method
702737
constructs a <code>uint64</code> from two calls
703-
to <code>Rand.Source</code>'s <code>Int63</code> method.
738+
to <a href="/pkg/math/rand/#Source"><code>Source</code></a>'s
739+
<code>Int63</code> method.
704740
</p>
705741

706742
</dd>
@@ -713,13 +749,15 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
713749
The
714750
<a href="/pkg/mime/quotedprintable/#Reader"><code>Reader</code></a>'s
715751
parsing has been relaxed in two ways to accept
716-
more input seen in the wild. First, it now accepts
717-
a <code>=</code> sign even if it's not followed by two hex
718-
digits. <!-- CL 32174 -->
752+
more input seen in the wild.
753+
754+
<!-- CL 32174 -->
755+
First, it accepts an equals sign (<code>=</code>) not followed
756+
by two hex digits as a literal equal sign.
719757

720-
Second, it accepts a trailing soft line-break at the end of a
721-
message. <!-- CL 27530 --> That is, the final byte of the
722-
message may be a <code>=</code> sign and it will now be ignored.
758+
<!-- CL 27530 -->
759+
Second, it silently ignores a trailing equals sign at the end of
760+
an encoded input.
723761
</p>
724762

725763
</dd>
@@ -926,8 +964,8 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
926964
<a href="/pkg/net/url/#URL.Hostname"><code>URL.Hostname</code></a>
927965
and
928966
<a href="/pkg/net/url/#URL.Port"><code>URL.Port</code></a>
929-
are accessors to the hostname and port fields of a URL
930-
and deal with the case where the port may or may not be present.
967+
return the hostname and port fields of a URL,
968+
correctly handling the case where the port may not be present.
931969
</p>
932970

933971
<p> <!-- CL 28343 --> The existing method
@@ -961,7 +999,7 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
961999
<p>
9621000
The new function
9631001
<a href="/pkg/os/#Executable"><code>Executable</code></a> returns
964-
the running executable path name.
1002+
the path name of the running executable.
9651003
</p>
9661004
</dd>
9671005
</dl>

0 commit comments

Comments
 (0)