aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2019-03-19 21:08:48 -0700
committerColin Cross <ccross@android.com>2019-03-20 06:17:34 +0000
commit1371fe4354dc21c9c95c38cc7b9c83867891994c (patch)
treefc4aae62222feb015c306e08c0b4920efd832b81 /doc
parent394b8054fe2c7c143d15dd3236159971402b5a21 (diff)
downloadlinux-x86-1371fe4354dc21c9c95c38cc7b9c83867891994c.tar.gz
From https://ci.android.com/builds/submitted/5389456/linux/latest/go.zip Also includes a cherry-pick of https://github.com/golang/go/commit/ff048033e4304898245d843e79ed1a0897006c6d Fixes: 126298064 Test: m blueprint_tools Change-Id: I581e084f909acc0b1e3f95be6452c86c86da1bac
Diffstat (limited to 'doc')
-rw-r--r--doc/asm.html1
-rw-r--r--doc/cmd.html8
-rw-r--r--doc/codewalk/codewalk.js2
-rw-r--r--doc/contrib.html16
-rw-r--r--doc/contribute.html17
-rw-r--r--doc/debugging_with_gdb.html12
-rw-r--r--doc/devel/release.html103
-rw-r--r--doc/diagnostics.html12
-rw-r--r--doc/docs.html4
-rw-r--r--doc/editors.html2
-rw-r--r--doc/effective_go.html31
-rw-r--r--doc/go1.11.html26
-rw-r--r--doc/go1.12.html945
-rw-r--r--doc/go1.3.html2
-rw-r--r--doc/go_faq.html26
-rw-r--r--doc/go_mem.html8
-rw-r--r--doc/go_spec.html82
-rw-r--r--doc/help.html5
-rw-r--r--doc/install-source.html29
-rw-r--r--doc/install.html38
-rw-r--r--doc/progs/eff_sequence.go9
-rw-r--r--doc/security.html2
22 files changed, 1268 insertions, 112 deletions
diff --git a/doc/asm.html b/doc/asm.html
index f2f8fad57..debb1e2fc 100644
--- a/doc/asm.html
+++ b/doc/asm.html
@@ -740,6 +740,7 @@ The ARM64 port is in an experimental state.
<p>
<code>R18</code> is the "platform register", reserved on the Apple platform.
+To prevent accidental misuse, the register is named <code>R18_PLATFORM</code>.
<code>R27</code> and <code>R28</code> are reserved by the compiler and linker.
<code>R29</code> is the frame pointer.
<code>R30</code> is the link register.
diff --git a/doc/cmd.html b/doc/cmd.html
index c590f4d3e..e30684793 100644
--- a/doc/cmd.html
+++ b/doc/cmd.html
@@ -18,10 +18,8 @@ underlying binary with arguments appropriate to package-level processing.
<p>
The programs can also be run as stand-alone binaries, with unmodified arguments,
-using the go <code>tool</code> subcommand, such as <code>go tool vet</code>.
-This style of invocation allows, for instance, checking a single source file
-rather than an entire package: <code>go tool vet myprogram.go</code> as
-compared to <code>go vet mypackage</code>.
+using the go <code>tool</code> subcommand, such as <code>go tool cgo</code>.
+For most commands this is mainly useful for debugging.
Some of the commands, such as <code>pprof</code>, are accessible only through
the go <code>tool</code> subcommand.
</p>
@@ -76,7 +74,7 @@ and rewrites them to use newer ones.</td>
</tr>
<tr>
-<td><a href="/cmd/go/">fmt</a></td>
+<td><a href="/cmd/gofmt/">fmt</a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>Fmt formats Go packages, it is also available as an independent <a href="/cmd/gofmt/">
gofmt</a> command with more general options.</td>
diff --git a/doc/codewalk/codewalk.js b/doc/codewalk/codewalk.js
index abc59373a..4f59a8fc8 100644
--- a/doc/codewalk/codewalk.js
+++ b/doc/codewalk/codewalk.js
@@ -276,7 +276,7 @@ CodewalkViewer.prototype.changeSelectedComment = function(target) {
}
// Force original file even if user hasn't changed comments since they may
- // have nagivated away from it within the iframe without us knowing.
+ // have navigated away from it within the iframe without us knowing.
this.navigateToCode(currentFile);
};
diff --git a/doc/contrib.html b/doc/contrib.html
index df53d480d..fc853a911 100644
--- a/doc/contrib.html
+++ b/doc/contrib.html
@@ -34,6 +34,8 @@ We encourage all Go users to subscribe to
<p>A <a href="/doc/devel/release.html">summary</a> of the changes between Go releases. Notes for the major releases:</p>
<ul>
+ <li><a href="/doc/go1.12">Go 1.12</a> <small>(February 2019)</small></li>
+ <li><a href="/doc/go1.11">Go 1.11</a> <small>(August 2018)</small></li>
<li><a href="/doc/go1.10">Go 1.10</a> <small>(February 2018)</small></li>
<li><a href="/doc/go1.9">Go 1.9</a> <small>(August 2017)</small></li>
<li><a href="/doc/go1.8">Go 1.8</a> <small>(February 2017)</small></li>
@@ -59,6 +61,15 @@ Go 1 matures.
<h3 id="source"><a href="https://golang.org/change">Source Code</a></h3>
<p>Check out the Go source code.</p>
+<h3 id="discuss"><a href="//groups.google.com/group/golang-nuts">Discussion Mailing List</a></h3>
+<p>
+A mailing list for general discussion of Go programming.
+</p>
+<p>
+Questions about using Go or announcements relevant to other Go users should be sent to
+<a href="//groups.google.com/group/golang-nuts">golang-nuts</a>.
+</p>
+
<h3 id="golang-dev"><a href="https://groups.google.com/group/golang-dev">Developer</a> and
<a href="https://groups.google.com/group/golang-codereviews">Code Review Mailing List</a></h3>
<p>The <a href="https://groups.google.com/group/golang-dev">golang-dev</a>
@@ -66,9 +77,6 @@ mailing list is for discussing code changes to the Go project.
The <a href="https://groups.google.com/group/golang-codereviews">golang-codereviews</a>
mailing list is for actual reviewing of the code changes (CLs).</p>
-<p>For general discussion of Go programming, see <a
-href="https://groups.google.com/group/golang-nuts">golang-nuts</a>.</p>
-
<h3 id="golang-checkins"><a href="https://groups.google.com/group/golang-checkins">Checkins Mailing List</a></h3>
<p>A mailing list that receives a message summarizing each checkin to the Go repository.</p>
@@ -116,7 +124,7 @@ To get started, read these <a href="/doc/contribute.html">contribution
guidelines</a> for information on design, testing, and our code review process.
</p>
<p>
-Check <a href="//golang.org/issue">the tracker</a> for
+Check <a href="//golang.org/issue">the tracker</a> for
open issues that interest you. Those labeled
<a href="https://github.com/golang/go/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22">help wanted</a>
are particularly in need of outside help.
diff --git a/doc/contribute.html b/doc/contribute.html
index 5dc8a0044..68b2387d3 100644
--- a/doc/contribute.html
+++ b/doc/contribute.html
@@ -393,8 +393,8 @@ Remember you can always visit Gerrit to see the fine-grained review.
<p>
It is not possible to fully sync Gerrit and GitHub, at least at the moment,
so we recommend learning Gerrit.
-It's different but powerful and familiarity
-with help you understand the flow.
+It's different but powerful and familiarity with it will help you understand
+the flow.
</p>
<h3>Overview</h3>
@@ -405,7 +405,7 @@ This is an overview of the overall process:
<ul>
<li>
-<b>Step 1:</b> Clone the Go source code from go.googlesource.com
+<b>Step 1:</b> Clone the Go source code from <code>go.googlesource.com</code>
and make sure it's stable by compiling and testing it once:
<pre>
$ git clone https://go.googlesource.com/go
@@ -469,12 +469,11 @@ In addition to a recent Go installation, you need to have a local copy of the so
checked out from the correct repository.
You can check out the Go source repo onto your local file system anywhere
you want as long as it's outside your <code>GOPATH</code>.
-Either clone from
-<code>go.googlesource.com</code> or from GitHub:
+Clone from <code>go.googlesource.com</code> (not GitHub):
</p>
<pre>
-$ git clone https://github.com/golang/go # or https://go.googlesource.com/go
+$ git clone https://go.googlesource.com/go
$ cd go
</pre>
@@ -697,7 +696,7 @@ Don't use HTML, Markdown, or any other markup language.
<p>
Add any relevant information, such as benchmark data if the change
affects performance.
-The <a href="https://godoc.org/golang.org/x/tools/cmd/benchcmp">benchcmp</a>
+The <a href="https://godoc.org/golang.org/x/perf/cmd/benchstat">benchstat</a>
tool is conventionally used to format
benchmark data for change descriptions.
</p>
@@ -923,13 +922,13 @@ New files that you contribute should use the standard copyright header:
</p>
<pre>
-// Copyright 2018 The Go Authors. All rights reserved.
+// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
</pre>
<p>
-(Use the current year if you're reading this in 2019 or beyond.)
+(Use the current year if you're reading this in 2020 or beyond.)
Files in the repository are copyrighted the year they are added.
Do not update the copyright year on files that you change.
</p>
diff --git a/doc/debugging_with_gdb.html b/doc/debugging_with_gdb.html
index f3b4e37a2..3899ac92d 100644
--- a/doc/debugging_with_gdb.html
+++ b/doc/debugging_with_gdb.html
@@ -179,7 +179,15 @@ from it.</li>
<code>"fmt.Print"</code> as an unstructured literal with a <code>"."</code>
that needs to be quoted. It objects even more strongly to method names of
the form <code>pkg.(*MyType).Meth</code>.
-<li>All global variables are lumped into package <code>"main"</code>.</li>
+<li>As of Go 1.11, debug information is compressed by default.
+Older versions of gdb, such as the one available by default on MacOS,
+do not understand the compression.
+You can generate uncompressed debug information by using <code>go
+build -ldflags=-compressdwarf=false</code>.
+(For convenience you can put the <code>-ldflags</code> option in
+the <a href="/cmd/go/#hdr-Environment_variables"><code>GOFLAGS</code>
+environment variable</a> so that you don't have to specify it each time.)
+</li>
</ol>
<h2 id="Tutorial">Tutorial</h2>
@@ -248,7 +256,7 @@ Use the <code>"l"</code> or <code>"list"</code> command to inspect source code.
</pre>
<p>
-List a specific part of the source parametrizing <code>"list"</code> with a
+List a specific part of the source parameterizing <code>"list"</code> with a
function name (it must be qualified with its package name).
</p>
diff --git a/doc/devel/release.html b/doc/devel/release.html
index e5d834e92..7a036db9a 100644
--- a/doc/devel/release.html
+++ b/doc/devel/release.html
@@ -23,6 +23,79 @@ in supported releases as needed by issuing minor revisions
(for example, Go 1.6.1, Go 1.6.2, and so on).
</p>
+<h2 id="go1.12">go1.12 (released 2019/02/25)</h2>
+
+<p>
+Go 1.12 is a major release of Go.
+Read the <a href="/doc/go1.12">Go 1.12 Release Notes</a> for more information.
+</p>
+
+<p>
+go1.12.1 (released 2019/03/14) includes fixes to cgo, the compiler, the go
+command, and the <code>fmt</code>, <code>net/smtp</code>, <code>os</code>,
+<code>path/filepath</code>, <code>sync</code>, and <code>text/template</code>
+packages. See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.12.1">Go
+1.12.1 milestone</a> on our issue tracker for details.
+</p>
+
+<h2 id="go1.11">go1.11 (released 2018/08/24)</h2>
+
+<p>
+Go 1.11 is a major release of Go.
+Read the <a href="/doc/go1.11">Go 1.11 Release Notes</a> for more information.
+</p>
+
+<h3 id="go1.11.minor">Minor revisions</h3>
+
+<p>
+go1.11.1 (released 2018/10/01) includes fixes to the compiler, documentation, go
+command, runtime, and the <code>crypto/x509</code>, <code>encoding/json</code>,
+<code>go/types</code>, <code>net</code>, <code>net/http</code>, and
+<code>reflect</code> packages.
+See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.1">Go
+1.11.1 milestone</a> on our issue tracker for details.
+</p>
+
+<p>
+go1.11.2 (released 2018/11/02) includes fixes to the compiler, linker,
+documentation, go command, and the <code>database/sql</code> and
+<code>go/types</code> packages.
+See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.2">Go
+1.11.2 milestone</a> on our issue tracker for details.
+</p>
+
+<p>
+go1.11.3 (released 2018/12/12) includes three security fixes to "go get" and
+the <code>crypto/x509</code> package.
+See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.3">Go
+1.11.3 milestone</a> on our issue tracker for details.
+</p>
+
+<p>
+go1.11.4 (released 2018/12/14) includes fixes to cgo, the compiler, linker,
+runtime, documentation, go command, and the <code>net/http</code> and
+<code>go/types</code> packages.
+It includes a fix to a bug introduced in Go 1.11.3 that broke <code>go</code>
+<code>get</code> for import path patterns containing "<code>...</code>".
+See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.4+label%3ACherryPickApproved">Go
+1.11.4 milestone</a> on our issue tracker for details.
+</p>
+
+<p>
+go1.11.5 (released 2019/01/23) includes a security fix to the
+<code>crypto/elliptic</code> package. See
+the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.5">Go
+1.11.5 milestone</a> on our issue tracker for details.
+</p>
+
+<p>
+go1.11.6 (released 2019/03/14) includes fixes to cgo, the compiler, linker,
+runtime, go command, and the <code>crypto/x509</code>, <code>encoding/json</code>,
+<code>net</code>, and <code>net/url</code> packages. See the
+<a href="https://github.com/golang/go/issues?q=milestone%3AGo1.11.6">Go
+1.11.6 milestone</a> on our issue tracker for details.
+</p>
+
<h2 id="go1.10">go1.10 (released 2018/02/16)</h2>
<p>
@@ -65,6 +138,36 @@ See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.10.4">Go
1.10.4 milestone</a> on our issue tracker for details.
</p>
+<p>
+go1.10.5 (released 2018/11/02) includes fixes to the go command, linker, runtime
+and the <code>database/sql</code> package.
+See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.10.5">Go
+1.10.5 milestone</a> on our issue tracker for details.
+</p>
+
+<p>
+go1.10.6 (released 2018/12/12) includes three security fixes to "go get" and
+the <code>crypto/x509</code> package.
+It contains the same fixes as Go 1.11.3 and was released at the same time.
+See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.10.6">Go
+1.10.6 milestone</a> on our issue tracker for details.
+</p>
+
+<p>
+go1.10.7 (released 2018/12/14) includes a fix to a bug introduced in Go 1.10.6
+that broke <code>go</code> <code>get</code> for import path patterns containing
+"<code>...</code>".
+See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.10.7+label%3ACherryPickApproved">
+Go 1.10.7 milestone</a> on our issue tracker for details.
+</p>
+
+<p>
+go1.10.8 (released 2019/01/23) includes a security fix to the
+<code>crypto/elliptic</code> package. See
+the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.10.8">Go
+1.10.8 milestone</a> on our issue tracker for details.
+</p>
+
<h2 id="go1.9">go1.9 (released 2017/08/24)</h2>
<p>
diff --git a/doc/diagnostics.html b/doc/diagnostics.html
index 0a7847744..478611c15 100644
--- a/doc/diagnostics.html
+++ b/doc/diagnostics.html
@@ -456,3 +456,15 @@ each collection, summarizing the amount of memory collected
and the length of the pause.</li>
<li>GODEBUG=schedtrace=X prints scheduling events every X milliseconds.</li>
</ul>
+
+<p>The GODEBUG environmental variable can be used to disable use of
+instruction set extensions in the standard library and runtime.</p>
+
+<ul>
+<li>GODEBUG=cpu.all=off disables the use of all optional
+instruction set extensions.</li>
+<li>GODEBUG=cpu.<em>extension</em>=off disables use of instructions from the
+specified instruction set extension.<br>
+<em>extension</em> is the lower case name for the instruction set extension
+such as <em>sse41</em> or <em>avx</em>.</li>
+</ul>
diff --git a/doc/docs.html b/doc/docs.html
index 955eb3044..8f79d3a77 100644
--- a/doc/docs.html
+++ b/doc/docs.html
@@ -50,10 +50,10 @@ learned. You can {{if not $.GoogleCN}}<a href="//tour.golang.org/">take the tour
online</a> or{{end}} install it locally with:
</p>
<pre>
-$ go get golang.org/x/tour/gotour
+$ go get golang.org/x/tour
</pre>
<p>
-This will place the <code>gotour</code> binary in your workspace's <code>bin</code> directory.
+This will place the <code>tour</code> binary in your workspace's <code>bin</code> directory.
</p>
<h3 id="code"><a href="code.html">How to write Go code</a></h3>
diff --git a/doc/editors.html b/doc/editors.html
index 6f787864c..4ff35a58f 100644
--- a/doc/editors.html
+++ b/doc/editors.html
@@ -28,7 +28,7 @@ or as a plugin for IntelliJ IDEA Ultimate</li>
</ul>
<p>
-Note that these are only a few top solutions; a more comphensive
+Note that these are only a few top solutions; a more comprehensive
community-maintained list of
<a href="https://github.com/golang/go/wiki/IDEsAndTextEditorPlugins">IDEs and text editor plugins</a>
is available at the Wiki.
diff --git a/doc/effective_go.html b/doc/effective_go.html
index 89c1d0878..34131868a 100644
--- a/doc/effective_go.html
+++ b/doc/effective_go.html
@@ -246,14 +246,16 @@ func Compile(str string) (*Regexp, error) {
<p>
If every doc comment begins with the name of the item it describes,
-the output of <code>godoc</code> can usefully be run through <code>grep</code>.
+you can use the <a href="/cmd/go/#hdr-Show_documentation_for_package_or_symbol">doc</a>
+subcommand of the <a href="/cmd/go/">go</a> tool
+and run the output through <code>grep</code>.
Imagine you couldn't remember the name "Compile" but were looking for
the parsing function for regular expressions, so you ran
the command,
</p>
<pre>
-$ godoc regexp | grep -i parse
+$ go doc -all regexp | grep -i parse
</pre>
<p>
@@ -264,10 +266,10 @@ which recalls the word you're looking for.
</p>
<pre>
-$ godoc regexp | grep parse
+$ go doc -all regexp | grep -i parse
Compile parses a regular expression and returns, if successful, a Regexp
+ MustCompile is like Compile but panics if the expression cannot be parsed.
parsed. It simplifies safe initialization of global variables holding
- cannot be parsed. It simplifies safe initialization of global variables
$
</pre>
@@ -1402,11 +1404,11 @@ the moment, the following snippet would also read the first 32 bytes of the buff
var err error
for i := 0; i &lt; 32; i++ {
nbytes, e := f.Read(buf[i:i+1]) // Read one byte.
+ n += nbytes
if nbytes == 0 || e != nil {
err = e
break
}
- n += nbytes
}
</pre>
<p>
@@ -1708,7 +1710,7 @@ prints
&amp;{7 -2.35 abc def}
&amp;{a:7 b:-2.35 c:abc def}
&amp;main.T{a:7, b:-2.35, c:"abc\tdef"}
-map[string] int{"CST":-21600, "PST":-28800, "EST":-18000, "UTC":0, "MST":-25200}
+map[string]int{"CST":-21600, "PST":-28800, "EST":-18000, "UTC":0, "MST":-25200}
</pre>
<p>
(Note the ampersands.)
@@ -1731,7 +1733,7 @@ fmt.Printf(&quot;%T\n&quot;, timeZone)
prints
</p>
<pre>
-map[string] int
+map[string]int
</pre>
<p>
If you want to control the default format for a custom type, all that's required is to define
@@ -2104,12 +2106,14 @@ In this contrived example <code>Sequence</code> satisfies both.
<p>
The <code>String</code> method of <code>Sequence</code> is recreating the
-work that <code>Sprint</code> already does for slices. We can share the
-effort if we convert the <code>Sequence</code> to a plain
+work that <code>Sprint</code> already does for slices.
+(It also has complexity O(N²), which is poor.) We can share the
+effort (and also speed it up) if we convert the <code>Sequence</code> to a plain
<code>[]int</code> before calling <code>Sprint</code>.
</p>
<pre>
func (s Sequence) String() string {
+ s = s.Copy()
sort.Sort(s)
return fmt.Sprint([]int(s))
}
@@ -2136,6 +2140,7 @@ type Sequence []int
// Method for printing - sorts the elements before printing
func (s Sequence) String() string {
+ s = s.Copy()
sort.IntSlice(s).Sort()
return fmt.Sprint([]int(s))
}
@@ -2762,7 +2767,7 @@ type Job struct {
}
</pre>
<p>
-The <code>Job</code> type now has the <code>Log</code>, <code>Logf</code>
+The <code>Job</code> type now has the <code>Print</code>, <code>Printf</code>, <code>Println</code>
and other
methods of <code>*log.Logger</code>. We could have given the <code>Logger</code>
a field name, of course, but it's not necessary to do so. And now, once
@@ -2770,7 +2775,7 @@ initialized, we can
log to the <code>Job</code>:
</p>
<pre>
-job.Log("starting now...")
+job.Println("starting now...")
</pre>
<p>
The <code>Logger</code> is a regular field of the <code>Job</code> struct,
@@ -2797,8 +2802,8 @@ we would write <code>job.Logger</code>,
which would be useful if we wanted to refine the methods of <code>Logger</code>.
</p>
<pre>
-func (job *Job) Logf(format string, args ...interface{}) {
- job.Logger.Logf("%q: %s", job.Command, fmt.Sprintf(format, args...))
+func (job *Job) Printf(format string, args ...interface{}) {
+ job.Logger.Printf("%q: %s", job.Command, fmt.Sprintf(format, args...))
}
</pre>
<p>
diff --git a/doc/go1.11.html b/doc/go1.11.html
index 469e111fb..1d85be9fe 100644
--- a/doc/go1.11.html
+++ b/doc/go1.11.html
@@ -348,6 +348,20 @@ updating. See the <a href="go1.10.html#cgo">Go 1.10 release notes</a> for
details. <!-- CL 126275, CL 127156, CL 122217, CL 122575, CL 123177 -->
</p>
+<h3 id="go_command">Go command</h3>
+
+<p><!-- CL 126656 -->
+ The environment variable <code>GOFLAGS</code> may now be used
+ to set default flags for the <code>go</code> command.
+ This is useful in certain situations.
+ Linking can be noticeably slower on underpowered systems due to DWARF,
+ and users may want to set <code>-ldflags=-w</code> by default.
+ For modules, some users and CI systems will want vendoring always,
+ so they should set <code>-mod=vendor</code> by default.
+ For more information, see the <a href="/cmd/go/#hdr-Environment_variables"><code>go</code>
+ command documentation</a>.
+</p>
+
<h3 id="godoc">Godoc</h3>
<p>
@@ -386,6 +400,16 @@ details. <!-- CL 126275, CL 127156, CL 122217, CL 122575, CL 123177 -->
information.
</p>
+<h3 id="run">Run</h3>
+
+<p>
+ <!-- CL 109341 -->
+ The <a href="/cmd/go/"><code>go</code>&nbsp;<code>run</code></a>
+ command now allows a single import path, a directory name or a
+ pattern matching a single package.
+ This allows <code>go</code>&nbsp;<code>run</code>&nbsp;<code>pkg</code> or <code>go</code>&nbsp;<code>run</code>&nbsp;<code>dir</code>, most importantly <code>go</code>&nbsp;<code>run</code>&nbsp;<code>.</code>
+</p>
+
<h2 id="runtime">Runtime</h2>
<p><!-- CL 85887 -->
@@ -396,7 +420,7 @@ details. <!-- CL 126275, CL 127156, CL 122217, CL 122575, CL 123177 -->
</p>
<p><!-- CL 108679, CL 106156 -->
- On macOS and iOS, the runtime now uses <code>libSystem.so</code> instead of
+ On macOS and iOS, the runtime now uses <code>libSystem.dylib</code> instead of
calling the kernel directly. This should make Go binaries more
compatible with future versions of macOS and iOS.
The <a href="/pkg/syscall">syscall</a> package still makes direct
diff --git a/doc/go1.12.html b/doc/go1.12.html
new file mode 100644
index 000000000..2945eb1c4
--- /dev/null
+++ b/doc/go1.12.html
@@ -0,0 +1,945 @@
+<!--{
+ "Title": "Go 1.12 Release Notes",
+ "Path": "/doc/go1.12",
+ "Template": true
+}-->
+
+<!--
+NOTE: In this document and others in this directory, the convention is to
+set fixed-width phrases with non-fixed-width spaces, as in
+<code>hello</code> <code>world</code>.
+Do not send CLs removing the interior tags from such phrases.
+-->
+
+<style>
+ ul li { margin: 0.5em 0; }
+</style>
+
+<h2 id="introduction">Introduction to Go 1.12</h2>
+
+<p>
+ The latest Go release, version 1.12, arrives six months after <a href="go1.11">Go 1.11</a>.
+ Most of its changes are in the implementation of the toolchain, runtime, and libraries.
+ As always, the release maintains the Go 1 <a href="/doc/go1compat">promise of compatibility</a>.
+ We expect almost all Go programs to continue to compile and run as before.
+</p>
+
+<h2 id="language">Changes to the language</h2>
+
+<p>
+ There are no changes to the language specification.
+</p>
+
+<h2 id="ports">Ports</h2>
+
+<p><!-- CL 138675 -->
+ The race detector is now supported on <code>linux/arm64</code>.
+</p>
+
+<p id="freebsd">
+ Go 1.12 is the last release that is supported on FreeBSD 10.x, which has
+ already reached end-of-life. Go 1.13 will require FreeBSD 11.2+ or FreeBSD
+ 12.0+.
+ FreeBSD 12.0+ requires a kernel with the COMPAT_FREEBSD11 option set (this is the default).
+</p>
+
+<p><!-- CL 146898 -->
+ cgo is now supported on <code>linux/ppc64</code>.
+</p>
+
+<p id="hurd"><!-- CL 146023 -->
+ <code>hurd</code> is now a recognized value for <code>GOOS</code>, reserved
+ for the GNU/Hurd system for use with <code>gccgo</code>.
+</p>
+
+<h3 id="windows">Windows</h3>
+
+<p>
+ Go's new <code>windows/arm</code> port supports running Go on Windows 10
+ IoT Core on 32-bit ARM chips such as the Raspberry Pi 3.
+</p>
+
+<h3 id="aix">AIX</h3>
+
+<p>
+ Go now supports AIX 7.2 and later on POWER8 architectures (<code>aix/ppc64</code>). External linking, cgo, pprof and the race detector aren't yet supported.
+</p>
+
+<h3 id="darwin">Darwin</h3>
+
+<p>
+ Go 1.12 is the last release that will run on macOS 10.10 Yosemite.
+ Go 1.13 will require macOS 10.11 El Capitan or later.
+</p>
+
+<p><!-- CL 141639 -->
+ <code>libSystem</code> is now used when making syscalls on Darwin,
+ ensuring forward-compatibility with future versions of macOS and iOS.
+ <!-- CL 153338 -->
+ The switch to <code>libSystem</code> triggered additional App Store
+ checks for private API usage. Since it is considered private,
+ <code>syscall.Getdirentries</code> now always fails with
+ <code>ENOSYS</code> on iOS.
+</p>
+
+<h2 id="tools">Tools</h2>
+
+<h3 id="vet"><code>go tool vet</code> no longer supported</h3>
+
+<p>
+ The <code>go vet</code> command has been rewritten to serve as the
+ base for a range of different source code analysis tools. See
+ the <a href="https://godoc.org/golang.org/x/tools/go/analysis">golang.org/x/tools/go/analysis</a>
+ package for details. A side-effect is that <code>go tool vet</code>
+ is no longer supported. External tools that use <code>go tool
+ vet</code> must be changed to use <code>go
+ vet</code>. Using <code>go vet</code> instead of <code>go tool
+ vet</code> should work with all supported versions of Go.
+</p>
+
+<p>
+ As part of this change, the experimental <code>-shadow</code> option
+ is no longer available with <code>go vet</code>. Checking for
+ variable shadowing may now be done using
+<pre>
+go get -u golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
+go vet -vettool=$(which shadow)
+</pre>
+</p>
+
+<h3 id="tour">Tour</h3>
+
+<p> <!-- CL 152657 -->
+The Go tour is no longer included in the main binary distribution. To
+run the tour locally, instead of running <code>go</code> <code>tool</code> <code>tour</code>,
+manually install it:
+<pre>
+go get -u golang.org/x/tour
+tour
+</pre>
+</p>
+
+<h3 id="gocache">Build cache requirement</h3>
+
+<p>
+ The <a href="/cmd/go/#hdr-Build_and_test_caching">build cache</a> is now
+ required as a step toward eliminating
+ <code>$GOPATH/pkg</code>. Setting the environment variable
+ <code>GOCACHE=off</code> will cause <code>go</code> commands that write to the
+ cache to fail.
+</p>
+
+<h3 id="binary-only">Binary-only packages</h3>
+
+<p>
+ Go 1.12 is the last release that will support binary-only packages.
+</p>
+
+<h3 id="cgo">Cgo</h3>
+
+<p>
+ Go 1.12 will translate the C type <code>EGLDisplay</code> to the Go type <code>uintptr</code>.
+ This change is similar to how Go 1.10 and newer treats Darwin's CoreFoundation
+ and Java's JNI types. See the
+ <a href="/cmd/cgo/#hdr-Special_cases">cgo documentation</a>
+ for more information.
+</p>
+
+<p><!-- CL 152657 -->
+ Mangled C names are no longer accepted in packages that use Cgo. Use the Cgo
+ names instead. For example, use the documented cgo name <code>C.char</code>
+ rather than the mangled name <code>_Ctype_char</code> that cgo generates.
+</p>
+
+<h3 id="modules">Modules</h3>
+
+<p><!-- CL 148517 -->
+ When <code>GO111MODULE</code> is set to <code>on</code>, the <code>go</code>
+ command now supports module-aware operations outside of a module directory,
+ provided that those operations do not need to resolve import paths relative to
+ the current directory or explicitly edit the <code>go.mod</code> file.
+ Commands such as <code>go</code> <code>get</code>,
+ <code>go</code> <code>list</code>, and
+ <code>go</code> <code>mod</code> <code>download</code> behave as if in a
+ module with initially-empty requirements.
+ In this mode, <code>go</code> <code>env</code> <code>GOMOD</code> reports
+ the system's null device (<code>/dev/null</code> or <code>NUL</code>).
+</p>
+
+<p><!-- CL 146382 -->
+ <code>go</code> commands that download and extract modules are now safe to
+ invoke concurrently.
+ The module cache (<code>GOPATH/pkg/mod</code>) must reside in a filesystem that
+ supports file locking.
+</p>
+
+<p><!-- CL 147282, 147281 -->
+ The <code>go</code> directive in a <code>go.mod</code> file now indicates the
+ version of the language used by the files within that module.
+ It will be set to the current release
+ (<code>go</code> <code>1.12</code>) if no existing version is
+ present.
+ If the <code>go</code> directive for a module specifies a
+ version <em>newer</em> than the toolchain in use, the <code>go</code> command
+ will attempt to build the packages regardless, and will note the mismatch only if
+ that build fails.
+</p>
+
+<p><!-- CL 147282, 147281 -->
+ This changed use of the <code>go</code> directive means that if you
+ use Go 1.12 to build a module, thus recording <code>go 1.12</code>
+ in the <code>go.mod</code> file, you will get an error when
+ attempting to build the same module with Go 1.11 through Go 1.11.3.
+ Go 1.11.4 or later will work fine, as will releases older than Go 1.11.
+ If you must use Go 1.11 through 1.11.3, you can avoid the problem by
+ setting the language version to 1.11, using the Go 1.12 go tool,
+ via <code>go mod edit -go=1.11</code>.
+</p>
+
+<p><!-- CL 152739 -->
+ When an import cannot be resolved using the active modules,
+ the <code>go</code> command will now try to use the modules mentioned in the
+ main module's <code>replace</code> directives before consulting the module
+ cache and the usual network sources.
+ If a matching replacement is found but the <code>replace</code> directive does
+ not specify a version, the <code>go</code> command uses a pseudo-version
+ derived from the zero <code>time.Time</code> (such
+ as <code>v0.0.0-00010101000000-000000000000</code>).
+</p>
+
+<h3 id="compiler">Compiler toolchain</h3>
+
+<p><!-- CL 134155, 134156 -->
+ The compiler's live variable analysis has improved. This may mean that
+ finalizers will be executed sooner in this release than in previous
+ releases. If that is a problem, consider the appropriate addition of a
+ <a href="/pkg/runtime/#KeepAlive"><code>runtime.KeepAlive</code></a> call.
+</p>
+
+<p><!-- CL 147361 -->
+ More functions are now eligible for inlining by default, including
+ functions that do nothing but call another function.
+ This extra inlining makes it additionally important to use
+ <a href="/pkg/runtime/#CallersFrames"><code>runtime.CallersFrames</code></a>
+ instead of iterating over the result of
+ <a href="/pkg/runtime/#Callers"><code>runtime.Callers</code></a> directly.
+<pre>
+// Old code which no longer works correctly (it will miss inlined call frames).
+var pcs [10]uintptr
+n := runtime.Callers(1, pcs[:])
+for _, pc := range pcs[:n] {
+ f := runtime.FuncForPC(pc)
+ if f != nil {
+ fmt.Println(f.Name())
+ }
+}
+</pre>
+<pre>
+// New code which will work correctly.
+var pcs [10]uintptr
+n := runtime.Callers(1, pcs[:])
+frames := runtime.CallersFrames(pcs[:n])
+for {
+ frame, more := frames.Next()
+ fmt.Println(frame.Function)
+ if !more {
+ break
+ }
+}
+</pre>
+</p>
+
+<p><!-- CL 153477 -->
+ Wrappers generated by the compiler to implement method expressions
+ are no longer reported
+ by <a href="/pkg/runtime/#CallersFrames"><code>runtime.CallersFrames</code></a>
+ and <a href="/pkg/runtime/#Stack"><code>runtime.Stack</code></a>. They
+ are also not printed in panic stack traces.
+
+ This change aligns the <code>gc</code> toolchain to match
+ the <code>gccgo</code> toolchain, which already elided such wrappers
+ from stack traces.
+
+ Clients of these APIs might need to adjust for the missing
+ frames. For code that must interoperate between 1.11 and 1.12
+ releases, you can replace the method expression <code>x.M</code>
+ with the function literal <code>func (...) { x.M(...) } </code>.
+</p>
+
+<p><!-- CL 144340 -->
+ The compiler now accepts a <code>-lang</code> flag to set the Go language
+ version to use. For example, <code>-lang=go1.8</code> causes the compiler to
+ emit an error if the program uses type aliases, which were added in Go 1.9.
+ Language changes made before Go 1.12 are not consistently enforced.
+</p>
+
+<p><!-- CL 147160 -->
+ The compiler toolchain now uses different conventions to call Go
+ functions and assembly functions. This should be invisible to users,
+ except for calls that simultaneously cross between Go and
+ assembly <em>and</em> cross a package boundary. If linking results
+ in an error like "relocation target not defined for ABIInternal (but
+ is defined for ABI0)", please refer to the
+ <a href="https://github.com/golang/proposal/blob/master/design/27539-internal-abi.md#compatibility">compatibility section</a>
+ of the ABI design document.
+</p>
+
+<p><!-- CL 145179 -->
+ There have been many improvements to the DWARF debug information
+ produced by the compiler, including improvements to argument
+ printing and variable location information.
+</p>
+
+<p><!-- CL 61511 -->
+ Go programs now also maintain stack frame pointers on <code>linux/arm64</code>
+ for the benefit of profiling tools like <code>perf</code>. The frame pointer
+ maintenance has a small run-time overhead that varies but averages around 3%.
+ To build a toolchain that does not use frame pointers, set
+ <code>GOEXPERIMENT=noframepointer</code> when running <code>make.bash</code>.
+</p>
+
+<p><!-- CL 142717 -->
+ The obsolete "safe" compiler mode (enabled by the <code>-u</code> gcflag) has been removed.
+</p>
+
+<h3 id="godoc"><code>godoc</code> and <code>go</code> <code>doc</code></h3>
+
+<p>
+ In Go 1.12, <code>godoc</code> no longer has a command-line interface and
+ is only a web server. Users should use <code>go</code> <code>doc</code>
+ for command-line help output instead. Go 1.12 is the last release that will
+ include the <code>godoc</code> webserver; in Go 1.13 it will be available
+ via <code>go</code> <code>get</code>.
+</p>
+
+<p><!-- CL 141977 -->
+ <code>go</code> <code>doc</code> now supports the <code>-all</code> flag,
+ which will cause it to print all exported APIs and their documentation,
+ as the <code>godoc</code> command line used to do.
+</p>
+
+<p><!-- CL 140959 -->
+ <code>go</code> <code>doc</code> also now includes the <code>-src</code> flag,
+ which will show the target's source code.
+</p>
+
+<h3 id="trace">Trace</h3>
+
+<p><!-- CL 60790 -->
+ The trace tool now supports plotting mutator utilization curves,
+ including cross-references to the execution trace. These are useful
+ for analyzing the impact of the garbage collector on application
+ latency and throughput.
+</p>
+
+<h3 id="assembler">Assembler</h3>
+
+<p><!-- CL 147218 -->
+ On <code>arm64</code>, the platform register was renamed from
+ <code>R18</code> to <code>R18_PLATFORM</code> to prevent accidental
+ use, as the OS could choose to reserve this register.
+</p>
+
+<h2 id="runtime">Runtime</h2>
+
+<p><!-- CL 138959 -->
+ Go 1.12 significantly improves the performance of sweeping when a
+ large fraction of the heap remains live. This reduces allocation
+ latency immediately following a garbage collection.
+</p>
+
+<p><!-- CL 139719 -->
+ The Go runtime now releases memory back to the operating system more
+ aggressively, particularly in response to large allocations that
+ can't reuse existing heap space.
+</p>
+
+<p><!-- CL 146342, CL 146340, CL 146345, CL 146339, CL 146343, CL 146337, CL 146341, CL 146338 -->
+ The Go runtime's timer and deadline code is faster and scales better
+ with higher numbers of CPUs. In particular, this improves the
+ performance of manipulating network connection deadlines.
+</p>
+
+<p><!-- CL 135395 -->
+ On Linux, the runtime now uses <code>MADV_FREE</code> to release unused
+ memory. This is more efficient but may result in higher reported
+ RSS. The kernel will reclaim the unused data when it is needed.
+ To revert to the Go 1.11 behavior (<code>MADV_DONTNEED</code>), set the
+ environment variable <code>GODEBUG=madvdontneed=1</code>.
+</p>
+
+<p><!-- CL 149578 -->
+ Adding cpu.<em>extension</em>=off to the
+ <a href="/doc/diagnostics.html#godebug">GODEBUG</a> environment
+ variable now disables the use of optional CPU instruction
+ set extensions in the standard library and runtime. This is not
+ yet supported on Windows.
+</p>
+
+<p><!-- CL 158337 -->
+ Go 1.12 improves the accuracy of memory profiles by fixing
+ overcounting of large heap allocations.
+</p>
+
+<p><!-- CL 159717 -->
+ Tracebacks, <code>runtime.Caller</code>,
+ and <code>runtime.Callers</code> no longer include
+ compiler-generated initialization functions. Doing a traceback
+ during the initialization of a global variable will now show a
+ function named <code>PKG.init.ializers</code>.
+</p>
+
+<h2 id="library">Core library</h2>
+
+<h3 id="tls_1_3">TLS 1.3</h3>
+
+<p>
+ Go 1.12 adds opt-in support for TLS 1.3 in the <code>crypto/tls</code> package as
+ specified by <a href="https://www.rfc-editor.org/info/rfc8446">RFC 8446</a>. It can
+ be enabled by adding the value <code>tls13=1</code> to the <code>GODEBUG</code>
+ environment variable. It will be enabled by default in Go 1.13.
+</p>
+
+<p>
+ To negotiate TLS 1.3, make sure you do not set an explicit <code>MaxVersion</code> in
+ <a href="/pkg/crypto/tls/#Config"><code>Config</code></a> and run your program with
+ the environment variable <code>GODEBUG=tls13=1</code> set.
+</p>
+
+<p>
+ All TLS 1.2 features except <code>TLSUnique</code> in
+ <a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a>
+ and renegotiation are available in TLS 1.3 and provide equivalent or
+ better security and performance. Note that even though TLS 1.3 is backwards
+ compatible with previous versions, certain legacy systems might not work
+ correctly when attempting to negotiate it. RSA certificate keys too small
+ to be secure (including 512-bit keys) will not work with TLS 1.3.
+</p>
+
+<p>
+ TLS 1.3 cipher suites are not configurable. All supported cipher suites are
+ safe, and if <code>PreferServerCipherSuites</code> is set in
+ <a href="/pkg/crypto/tls/#Config"><code>Config</code></a> the preference order
+ is based on the available hardware.
+</p>
+
+<p>
+ Early data (also called "0-RTT mode") is not currently supported as a
+ client or server. Additionally, a Go 1.12 server does not support skipping
+ unexpected early data if a client sends it. Since TLS 1.3 0-RTT mode
+ involves clients keeping state regarding which servers support 0-RTT,
+ a Go 1.12 server cannot be part of a load-balancing pool where some other
+ servers do support 0-RTT. If switching a domain from a server that supported
+ 0-RTT to a Go 1.12 server, 0-RTT would have to be disabled for at least the
+ lifetime of the issued session tickets before the switch to ensure
+ uninterrupted operation.
+</p>
+
+<p>
+ In TLS 1.3 the client is the last one to speak in the handshake, so if it causes
+ an error to occur on the server, it will be returned on the client by the first
+ <a href="/pkg/crypto/tls/#Conn.Read"><code>Read</code></a>, not by
+ <a href="/pkg/crypto/tls/#Conn.Handshake"><code>Handshake</code></a>. For
+ example, that will be the case if the server rejects the client certificate.
+ Similarly, session tickets are now post-handshake messages, so are only
+ received by the client upon its first
+ <a href="/pkg/crypto/tls/#Conn.Read"><code>Read</code></a>.
+</p>
+
+<h3 id="minor_library_changes">Minor changes to the library</h3>
+
+<p>
+ As always, there are various minor changes and updates to the library,
+ made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
+ in mind.
+</p>
+
+<!-- TODO: CL 115677: https://golang.org/cl/115677: cmd/vet: check embedded field tags too -->
+
+<dl id="bufio"><dt><a href="/pkg/bufio/">bufio</a></dt>
+ <dd>
+ <p><!-- CL 149297 -->
+ <code>Reader</code>'s <a href="/pkg/bufio/#Reader.UnreadRune"><code>UnreadRune</code></a> and
+ <a href="/pkg/bufio/#Reader.UnreadByte"><code>UnreadByte</code></a> methods will now return an error
+ if they are called after <a href="/pkg/bufio/#Reader.Peek"><code>Peek</code></a>.
+ </p>
+
+</dl><!-- bufio -->
+
+<dl id="bytes"><dt><a href="/pkg/bytes/">bytes</a></dt>
+ <dd>
+ <p><!-- CL 137855 -->
+ The new function <a href="/pkg/bytes/#ReplaceAll"><code>ReplaceAll</code></a> returns a copy of
+ a byte slice with all non-overlapping instances of a value replaced by another.
+ </p>
+
+ <p><!-- CL 145098 -->
+ A pointer to a zero-value <a href="/pkg/bytes/#Reader"><code>Reader</code></a> is now
+ functionally equivalent to <a href="/pkg/bytes/#NewReader"><code>NewReader</code></a><code>(nil)</code>.
+ Prior to Go 1.12, the former could not be used as a substitute for the latter in all cases.
+ </p>
+
+</dl><!-- bytes -->
+
+<dl id="crypto/rand"><dt><a href="/pkg/crypto/rand/">crypto/rand</a></dt>
+ <dd>
+ <p><!-- CL 139419 -->
+ A warning will now be printed to standard error the first time
+ <code>Reader.Read</code> is blocked for more than 60 seconds waiting
+ to read entropy from the kernel.
+ </p>
+
+ <p><!-- CL 120055 -->
+ On FreeBSD, <code>Reader</code> now uses the <code>getrandom</code>
+ system call if available, <code>/dev/urandom</code> otherwise.
+ </p>
+
+</dl><!-- crypto/rand -->
+
+<dl id="crypto/rc4"><dt><a href="/pkg/crypto/rc4/">crypto/rc4</a></dt>
+ <dd>
+ <p><!-- CL 130397 -->
+ This release removes the assembly implementations, leaving only
+ the pure Go version. The Go compiler generates code that is
+ either slightly better or slightly worse, depending on the exact
+ CPU. RC4 is insecure and should only be used for compatibility
+ with legacy systems.
+ </p>
+
+</dl><!-- crypto/rc4 -->
+
+<dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
+ <dd>
+ <p><!-- CL 143177 -->
+ If a client sends an initial message that does not look like TLS, the server
+ will no longer reply with an alert, and it will expose the underlying
+ <code>net.Conn</code> in the new field <code>Conn</code> of
+ <a href="/pkg/crypto/tls/#RecordHeaderError"><code>RecordHeaderError</code></a>.
+ </p>
+
+</dl><!-- crypto/tls -->
+
+<dl id="database/sql"><dt><a href="/pkg/database/sql/">database/sql</a></dt>
+ <dd>
+ <p><!-- CL 145738 -->
+ A query cursor can now be obtained by passing a
+ <a href="/pkg/database/sql/#Rows"><code>*Rows</code></a>
+ value to the <a href="/pkg/database/sql/#Row.Scan"><code>Row.Scan</code></a> method.
+ </p>
+
+</dl><!-- database/sql -->
+
+<dl id="expvar"><dt><a href="/pkg/expvar/">expvar</a></dt>
+ <dd>
+ <p><!-- CL 139537 -->
+ The new <a href="/pkg/expvar/#Map.Delete"><code>Delete</code></a> method allows
+ for deletion of key/value pairs from a <a href="/pkg/expvar/#Map"><code>Map</code></a>.
+ </p>
+
+</dl><!-- expvar -->
+
+<dl id="fmt"><dt><a href="/pkg/fmt/">fmt</a></dt>
+ <dd>
+ <p><!-- CL 142737 -->
+ Maps are now printed in key-sorted order to ease testing. The ordering rules are:
+ <ul>
+ <li>When applicable, nil compares low
+ <li>ints, floats, and strings order by <
+ <li>NaN compares less than non-NaN floats
+ <li>bool compares false before true
+ <li>Complex compares real, then imaginary
+ <li>Pointers compare by machine address
+ <li>Channel values compare by machine address
+ <li>Structs compare each field in turn
+ <li>Arrays compare each element in turn
+ <li>Interface values compare first by <code>reflect.Type</code> describing the concrete type
+ and then by concrete value as described in the previous rules.
+ </ul>
+ </p>
+
+ <p><!-- CL 129777 -->
+ When printing maps, non-reflexive key values like <code>NaN</code> were previously
+ displayed as <code>&lt;nil&gt;</code>. As of this release, the correct values are printed.
+ </p>
+
+</dl><!-- fmt -->
+
+<dl id="go/doc"><dt><a href="/pkg/go/doc/">go/doc</a></dt>
+ <dd>
+ <p><!-- CL 140958 -->
+ To address some outstanding issues in <a href="/cmd/doc/"><code>cmd/doc</code></a>,
+ this package has a new <a href="/pkg/go/doc/#Mode"><code>Mode</code></a> bit,
+ <code>PreserveAST</code>, which controls whether AST data is cleared.
+ </p>
+
+</dl><!-- go/doc -->
+
+<dl id="go/token"><dt><a href="/pkg/go/token/">go/token</a></dt>
+ <dd>
+ <p><!-- CL 134075 -->
+ The <a href="/pkg/go/token#File"><code>File</code></a> type has a new
+ <a href="/pkg/go/token#File.LineStart"><code>LineStart</code></a> field,
+ which returns the position of the start of a given line. This is especially useful
+ in programs that occasionally handle non-Go files, such as assembly, but wish to use
+ the <code>token.Pos</code> mechanism to identify file positions.
+ </p>
+
+</dl><!-- go/token -->
+
+<dl id="image"><dt><a href="/pkg/image/">image</a></dt>
+ <dd>
+ <p><!-- CL 118755 -->
+ The <a href="/pkg/image/#RegisterFormat"><code>RegisterFormat</code></a> function is now safe for concurrent use.
+ </p>
+
+</dl><!-- image -->
+
+<dl id="image/png"><dt><a href="/pkg/image/png/">image/png</a></dt>
+ <dd>
+ <p><!-- CL 134235 -->
+ Paletted images with fewer than 16 colors now encode to smaller outputs.
+ </p>
+
+</dl><!-- image/png -->
+
+<dl id="io"><dt><a href="/pkg/io/">io</a></dt>
+ <dd>
+ <p><!-- CL 139457 -->
+ The new <a href="/pkg/io#StringWriter"><code>StringWriter</code></a> interface wraps the
+ <a href="/pkg/io/#WriteString"><code>WriteString</code></a> function.
+ </p>
+
+</dl><!-- io -->
+
+<dl id="math"><dt><a href="/pkg/math/">math</a></dt>
+ <dd>
+ <p><!-- CL 153059 -->
+ The functions
+ <a href="/pkg/math/#Sin"><code>Sin</code></a>,
+ <a href="/pkg/math/#Cos"><code>Cos</code></a>,
+ <a href="/pkg/math/#Tan"><code>Tan</code></a>,
+ and <a href="/pkg/math/#Sincos"><code>Sincos</code></a> now
+ apply Payne-Hanek range reduction to huge arguments. This
+ produces more accurate answers, but they will not be bit-for-bit
+ identical with the results in earlier releases.
+ </p>
+</dl><!-- math -->
+
+<dl id="math/bits"><dt><a href="/pkg/math/bits/">math/bits</a></dt>
+ <dd>
+ <p><!-- CL 123157 -->
+ New extended precision operations <a href="/pkg/math/bits/#Add"><code>Add</code></a>, <a href="/pkg/math/bits/#Sub"><code>Sub</code></a>, <a href="/pkg/math/bits/#Mul"><code>Mul</code></a>, and <a href="/pkg/math/bits/#Div"><code>Div</code></a> are available in <code>uint</code>, <code>uint32</code>, and <code>uint64</code> versions.
+ </p>
+
+</dl><!-- math/bits -->
+
+<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
+ <dd>
+ <p><!-- CL 146659 -->
+ The
+ <a href="/pkg/net/#Dialer.DualStack"><code>Dialer.DualStack</code></a> setting is now ignored and deprecated;
+ RFC 6555 Fast Fallback ("Happy Eyeballs") is now enabled by default. To disable, set
+ <a href="/pkg/net/#Dialer.FallbackDelay"><code>Dialer.FallbackDelay</code></a> to a negative value.
+ </p>
+
+ <p><!-- CL 107196 -->
+ Similarly, TCP keep-alives are now enabled by default if
+ <a href="/pkg/net/#Dialer.KeepAlive"><code>Dialer.KeepAlive</code></a> is zero.
+ To disable, set it to a negative value.
+ </p>
+
+ <p><!-- CL 113997 -->
+ On Linux, the <a href="http://man7.org/linux/man-pages/man2/splice.2.html"><code>splice</code> system call</a> is now used when copying from a
+ <a href="/pkg/net/#UnixConn"><code>UnixConn</code></a> to a
+ <a href="/pkg/net/#TCPConn"><code>TCPConn</code></a>.
+ </p>
+</dl><!-- net -->
+
+<dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
+ <dd>
+ <p><!-- CL 143177 -->
+ The HTTP server now rejects misdirected HTTP requests to HTTPS servers with a plaintext "400 Bad Request" response.
+ </p>
+
+ <p><!-- CL 130115 -->
+ The new <a href="/pkg/net/http/#Client.CloseIdleConnections"><code>Client.CloseIdleConnections</code></a>
+ method calls the <code>Client</code>'s underlying <code>Transport</code>'s <code>CloseIdleConnections</code>
+ if it has one.
+ </p>
+
+ <p><!-- CL 145398 -->
+ The <a href="/pkg/net/http/#Transport"><code>Transport</code></a> no longer rejects HTTP responses which declare
+ HTTP Trailers but don't use chunked encoding. Instead, the declared trailers are now just ignored.
+ </p>
+
+ <p><!-- CL 152080 --> <!-- CL 151857 -->
+ The <a href="/pkg/net/http/#Transport"><code>Transport</code></a> no longer handles <code>MAX_CONCURRENT_STREAMS</code> values
+ advertised from HTTP/2 servers as strictly as it did during Go 1.10 and Go 1.11. The default behavior is now back
+ to how it was in Go 1.9: each connection to a server can have up to <code>MAX_CONCURRENT_STREAMS</code> requests
+ active and then new TCP connections are created as needed. In Go 1.10 and Go 1.11 the <code>http2</code> package
+ would block and wait for requests to finish instead of creating new connections.
+ To get the stricter behavior back, import the
+ <a href="https://godoc.org/golang.org/x/net/http2"><code>golang.org/x/net/http2</code></a> package
+ directly and set
+ <a href="https://godoc.org/golang.org/x/net/http2#Transport.StrictMaxConcurrentStreams"><code>Transport.StrictMaxConcurrentStreams</code></a> to
+ <code>true</code>.
+ </p>
+
+</dl><!-- net/http -->
+
+<dl id="net/url"><dt><a href="/pkg/net/url/">net/url</a></dt>
+ <dd>
+ <p><!-- CL 159157, CL 160178 -->
+ <a href="/pkg/net/url/#Parse"><code>Parse</code></a>,
+ <a href="/pkg/net/url/#ParseRequestURI"><code>ParseRequestURI</code></a>,
+ and
+ <a href="/pkg/net/url/#URL.Parse"><code>URL.Parse</code></a>
+ now return an
+ error for URLs containing ASCII control characters, which includes NULL,
+ tab, and newlines.
+ </p>
+
+</dl><!-- net/url -->
+
+<dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
+ <dd>
+ <p><!-- CL 146437 -->
+ The <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a> now automatically
+ proxies WebSocket requests.
+ </p>
+
+</dl><!-- net/http/httputil -->
+
+<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
+ <dd>
+ <p><!-- CL 125443 -->
+ The new <a href="/pkg/os/#ProcessState.ExitCode"><code>ProcessState.ExitCode</code></a> method
+ returns the process's exit code.
+ </p>
+
+ <p><!-- CL 135075 -->
+ <code>ModeCharDevice</code> has been added to the <code>ModeType</code> bitmask, allowing for
+ <code>ModeDevice | ModeCharDevice</code> to be recovered when masking a
+ <a href="/pkg/os/#FileMode"><code>FileMode</code></a> with <code>ModeType</code>.
+ </p>
+
+ <p><!-- CL 139418 -->
+ The new function <a href="/pkg/os/#UserHomeDir"><code>UserHomeDir</code></a> returns the
+ current user's home directory.
+ </p>
+
+ <p><!-- CL 146020 -->
+ <a href="/pkg/os/#RemoveAll"><code>RemoveAll</code></a> now supports paths longer than 4096 characters
+ on most Unix systems.
+ </p>
+
+ <p><!-- CL 130676 -->
+ <a href="/pkg/os/#File.Sync"><code>File.Sync</code></a> now uses <code>F_FULLFSYNC</code> on macOS
+ to correctly flush the file contents to permanent storage.
+ This may cause the method to run more slowly than in previous releases.
+ </p>
+
+ <p><!--CL 155517 -->
+ <a href="/pkg/os/#File"><code>File</code></a> now supports
+ a <a href="/pkg/os/#File.SyscallConn"><code>SyscallConn</code></a>
+ method returning
+ a <a href="/pkg/syscall/#RawConn"><code>syscall.RawConn</code></a>
+ interface value. This may be used to invoke system-specific
+ operations on the underlying file descriptor.
+ </p>
+
+</dl><!-- os -->
+
+<dl id="path/filepath"><dt><a href="/pkg/path/filepath/">path/filepath</a></dt>
+ <dd>
+ <p><!-- CL 145220 -->
+ The <a href="/pkg/path/filepath/#IsAbs"><code>IsAbs</code></a> function now returns true when passed
+ a reserved filename on Windows such as <code>NUL</code>.
+ <a href="https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#naming-conventions">List of reserved names.</a>
+ </p>
+
+</dl><!-- path/filepath -->
+
+<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
+ <dd>
+ <p><!-- CL 33572 -->
+ A new <a href="/pkg/reflect#MapIter"><code>MapIter</code></a> type is
+ an iterator for ranging over a map. This type is exposed through the
+ <a href="/pkg/reflect#Value"><code>Value</code></a> type's new
+ <a href="/pkg/reflect#Value.MapRange"><code>MapRange</code></a> method.
+ This follows the same iteration semantics as a range statement, with <code>Next</code>
+ to advance the iterator, and <code>Key</code>/<code>Value</code> to access each entry.
+ </p>
+
+</dl><!-- reflect -->
+
+<dl id="regexp"><dt><a href="/pkg/regexp/">regexp</a></dt>
+ <dd>
+ <p><!-- CL 139784 -->
+ <a href="/pkg/regexp/#Regexp.Copy"><code>Copy</code></a> is no longer necessary
+ to avoid lock contention, so it has been given a partial deprecation comment.
+ <a href="/pkg/regexp/#Regexp.Copy"><code>Copy</code></a>
+ may still be appropriate if the reason for its use is to make two copies with
+ different <a href="/pkg/regexp/#Regexp.Longest"><code>Longest</code></a> settings.
+ </p>
+
+</dl><!-- regexp -->
+
+<dl id="runtime/debug"><dt><a href="/pkg/runtime/debug/">runtime/debug</a></dt>
+ <dd>
+ <p><!-- CL 144220 -->
+ A new <a href="/pkg/runtime/debug/#BuildInfo"><code>BuildInfo</code></a> type
+ exposes the build information read from the running binary, available only in
+ binaries built with module support. This includes the main package path, main
+ module information, and the module dependencies. This type is given though the
+ <a href="/pkg/runtime/debug/#ReadBuildInfo"><code>ReadBuildInfo</code></a> function
+ on <a href="/pkg/runtime/debug/#BuildInfo"><code>BuildInfo</code></a>.
+ </p>
+
+</dl><!-- runtime/debug -->
+
+<dl id="strings"><dt><a href="/pkg/strings/">strings</a></dt>
+ <dd>
+ <p><!-- CL 137855 -->
+ The new function <a href="/pkg/strings/#ReplaceAll"><code>ReplaceAll</code></a> returns a copy of
+ a string with all non-overlapping instances of a value replaced by another.
+ </p>
+
+ <p><!-- CL 145098 -->
+ A pointer to a zero-value <a href="/pkg/strings/#Reader"><code>Reader</code></a> is now
+ functionally equivalent to <a href="/pkg/strings/#NewReader"><code>NewReader</code></a><code>(nil)</code>.
+ Prior to Go 1.12, the former could not be used as a substitute for the latter in all cases.
+ </p>
+
+ <p><!-- CL 122835 -->
+ The new <a href="/pkg/strings/#Builder.Cap"><code>Builder.Cap</code></a> method returns the capacity of the builder's underlying byte slice.
+ </p>
+
+ <p><!-- CL 131495 -->
+ The character mapping functions <a href="/pkg/strings/#Map"><code>Map</code></a>,
+ <a href="/pkg/strings/#Title"><code>Title</code></a>,
+ <a href="/pkg/strings/#ToLower"><code>ToLower</code></a>,
+ <a href="/pkg/strings/#ToLowerSpecial"><code>ToLowerSpecial</code></a>,
+ <a href="/pkg/strings/#ToTitle"><code>ToTitle</code></a>,
+ <a href="/pkg/strings/#ToTitleSpecial"><code>ToTitleSpecial</code></a>,
+ <a href="/pkg/strings/#ToUpper"><code>ToUpper</code></a>, and
+ <a href="/pkg/strings/#ToUpperSpecial"><code>ToUpperSpecial</code></a>
+ now always guarantee to return valid UTF-8. In earlier releases, if the input was invalid UTF-8 but no character replacements
+ needed to be applied, these routines incorrectly returned the invalid UTF-8 unmodified.
+ </p>
+
+</dl><!-- strings -->
+
+<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
+ <dd>
+ <p><!-- CL 138595 -->
+ 64-bit inodes are now supported on FreeBSD 12. Some types have been adjusted accordingly.
+ </p>
+
+ <p><!-- CL 125456 -->
+ The Unix socket
+ (<a href="https://blogs.msdn.microsoft.com/commandline/2017/12/19/af_unix-comes-to-windows/"><code>AF_UNIX</code></a>)
+ address family is now supported for compatible versions of Windows.
+ </p>
+
+ <p><!-- CL 147117 -->
+ The new function <a href="/pkg/syscall/?GOOS=windows&GOARCH=amd64#Syscall18"><code>Syscall18</code></a>
+ has been introduced for Windows, allowing for calls with up to 18 arguments.
+ </p>
+
+</dl><!-- syscall -->
+
+<dl id="syscall/js"><dt><a href="/pkg/syscall/js/">syscall/js</a></dt>
+ <dd>
+ <p><!-- CL 153559 -->
+ <p>
+ The <code>Callback</code> type and <code>NewCallback</code> function have been renamed;
+ they are now called
+ <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#Func"><code>Func</code></a> and
+ <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#FuncOf"><code>FuncOf</code></a>, respectively.
+ This is a breaking change, but WebAssembly support is still experimental
+ and not yet subject to the
+ <a href="/doc/go1compat">Go 1 compatibility promise</a>. Any code using the
+ old names will need to be updated.
+ </p>
+
+ <p><!-- CL 141644 -->
+ If a type implements the new
+ <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#Wrapper"><code>Wrapper</code></a>
+ interface,
+ <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#ValueOf"><code>ValueOf</code></a>
+ will use it to return the JavaScript value for that type.
+ </p>
+
+ <p><!-- CL 143137 -->
+ The meaning of the zero
+ <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#Value"><code>Value</code></a>
+ has changed. It now represents the JavaScript <code>undefined</code> value
+ instead of the number zero.
+ This is a breaking change, but WebAssembly support is still experimental
+ and not yet subject to the
+ <a href="/doc/go1compat">Go 1 compatibility promise</a>. Any code relying on
+ the zero <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#Value"><code>Value</code></a>
+ to mean the number zero will need to be updated.
+ </p>
+
+ <p><!-- CL 144384 -->
+ The new
+ <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#Value.Truthy"><code>Value.Truthy</code></a>
+ method reports the
+ <a href="https://developer.mozilla.org/en-US/docs/Glossary/Truthy">JavaScript "truthiness"</a>
+ of a given value.
+ </p>
+
+</dl><!-- syscall/js -->
+
+<dl id="testing"><dt><a href="/pkg/testing/">testing</a></dt>
+ <dd>
+ <p><!-- CL 139258 -->
+ The <a href="/cmd/go/#hdr-Testing_flags"><code>-benchtime</code></a> flag now supports setting an explicit iteration count instead of a time when the value ends with an "<code>x</code>". For example, <code>-benchtime=100x</code> runs the benchmark 100 times.
+ </p>
+
+</dl><!-- testing -->
+
+<dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt>
+ <dd>
+ <p><!-- CL 142217 -->
+ When executing a template, long context values are no longer truncated in errors.
+ </p>
+ <p>
+ <code>executing "tmpl" at <.very.deep.context.v...>: map has no entry for key "notpresent"</code>
+ </p>
+ <p>
+ is now
+ </p>
+ <p>
+ <code>executing "tmpl" at <.very.deep.context.value.notpresent>: map has no entry for key "notpresent"</code>
+ </p>
+
+ <dd>
+ <p><!-- CL 143097 -->
+ If a user-defined function called by a template panics, the
+ panic is now caught and returned as an error by
+ the <code>Execute</code> or <code>ExecuteTemplate</code> method.
+ </p>
+</dl><!-- text/template -->
+
+<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
+ <dd>
+ <p><!-- CL 151299 -->
+ The time zone database in <code>$GOROOT/lib/time/zoneinfo.zip</code>
+ has been updated to version 2018i. Note that this ZIP file is
+ only used if a time zone database is not provided by the operating
+ system.
+ </p>
+
+</dl><!-- time -->
+
+<dl id="unsafe"><dt><a href="/pkg/unsafe/">unsafe</a></dt>
+ <dd>
+ <p><!-- CL 146058 -->
+ It is invalid to convert a nil <code>unsafe.Pointer</code> to <code>uintptr</code> and back with arithmetic.
+ (This was already invalid, but will now cause the compiler to misbehave.)
+ </p>
+
+</dl><!-- unsafe -->
diff --git a/doc/go1.3.html b/doc/go1.3.html
index 18c638a1b..feed6480c 100644
--- a/doc/go1.3.html
+++ b/doc/go1.3.html
@@ -525,7 +525,7 @@ client.
The <a href="/pkg/net/http/"><code>net/http</code></a> package's
<a href="/pkg/net/http/#Request.ParseMultipartForm"><code>Request.ParseMultipartForm</code></a>
method will now return an error if the body's <code>Content-Type</code>
-is not <code>mutipart/form-data</code>.
+is not <code>multipart/form-data</code>.
Prior to Go 1.3 it would silently fail and return <code>nil</code>.
Code that relies on the previous behavior should be updated.
</li>
diff --git a/doc/go_faq.html b/doc/go_faq.html
index b1c15295d..305878f23 100644
--- a/doc/go_faq.html
+++ b/doc/go_faq.html
@@ -108,6 +108,26 @@ by Renée at Gophercon in 2016.
He has unique features; he's the <em>Go gopher</em>, not just any old gopher.
</p>
+<h3 id="go_or_golang">
+Is the language called Go or Golang?</h3>
+
+<p>
+The language is called Go.
+The "golang" moniker arose because the web site is
+<a href="https://golang.org">golang.org</a>, not
+go.org, which was not available to us.
+Many use the golang name, though, and it is handy as
+a label.
+For instance, the Twitter tag for the language is "#golang".
+The language's name is just plain Go, regardless.
+</p>
+
+<p>
+A side note: Although the
+<a href="https://blog.golang.org/go-brand">official logo</a>
+has two capital letters, the language name is written Go, not GO.
+</p>
+
<h3 id="creating_a_new_language">
Why did you create a new language?</h3>
@@ -784,7 +804,7 @@ type Fooer interface {
<p>
A type must then implement the <code>ImplementsFooer</code> method to be a
<code>Fooer</code>, clearly documenting the fact and announcing it in
-<a href="/cmd/godoc/">godoc</a>'s output.
+<a href="/cmd/go/#hdr-Show_documentation_for_package_or_symbol">go doc</a>'s output.
</p>
<pre>
@@ -1749,7 +1769,7 @@ while that of the corresponding pointer
type <code>*T</code> consists of all methods with receiver <code>*T</code> or
<code>T</code>.
That means the method set of <code>*T</code>
-includes that of <code>T</code>),
+includes that of <code>T</code>,
but not the reverse.
</p>
@@ -2438,7 +2458,7 @@ in networked servers.
Work continues to refine the algorithm, reduce overhead and
latency further, and to explore new approaches.
The 2018
-<a href="https://talks.golang.org/2018/ismmkeynote">ISMM keynote</a>
+<a href="https://blog.golang.org/ismmkeynote">ISMM keynote</a>
by Rick Hudson of the Go team
describes the progress so far and suggests some future approaches.
</p>
diff --git a/doc/go_mem.html b/doc/go_mem.html
index 143f3b2ff..d355bebae 100644
--- a/doc/go_mem.html
+++ b/doc/go_mem.html
@@ -418,8 +418,12 @@ func twoprint() {
</pre>
<p>
-calling <code>twoprint</code> causes <code>"hello, world"</code> to be printed twice.
-The first call to <code>doprint</code> runs <code>setup</code> once.
+calling <code>twoprint</code> will call <code>setup</code> exactly
+once.
+The <code>setup</code> function will complete before either call
+of <code>print</code>.
+The result will be that <code>"hello, world"</code> will be printed
+twice.
</p>
<h2>Incorrect synchronization</h2>
diff --git a/doc/go_spec.html b/doc/go_spec.html
index f70ff7a02..dcc81ed62 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
- "Subtitle": "Version of May 9, 2018",
+ "Subtitle": "Version of November 16, 2018",
"Path": "/ref/spec"
}-->
@@ -811,7 +811,7 @@ To avoid portability issues all numeric types are <a href="#Type_definitions">de
types</a> and thus distinct except
<code>byte</code>, which is an <a href="#Alias_declarations">alias</a> for <code>uint8</code>, and
<code>rune</code>, which is an alias for <code>int32</code>.
-Conversions
+Explicit conversions
are required when different numeric types are mixed in an expression
or assignment. For instance, <code>int32</code> and <code>int</code>
are not the same type even though they may have the same size on a
@@ -823,6 +823,7 @@ particular architecture.
<p>
A <i>string type</i> represents the set of string values.
A string value is a (possibly empty) sequence of bytes.
+The number of bytes is called the length of the string and is never negative.
Strings are immutable: once created,
it is impossible to change the contents of a string.
The predeclared string type is <code>string</code>;
@@ -830,7 +831,7 @@ it is a <a href="#Type_definitions">defined type</a>.
</p>
<p>
-The length of a string <code>s</code> (its size in bytes) can be discovered using
+The length of a string <code>s</code> can be discovered using
the built-in function <a href="#Length_and_capacity"><code>len</code></a>.
The length is a compile-time constant if the string is a constant.
A string's bytes can be accessed by integer <a href="#Index_expressions">indices</a>
@@ -846,8 +847,7 @@ string, <code>&amp;s[i]</code> is invalid.
<p>
An array is a numbered sequence of elements of a single
type, called the element type.
-The number of elements is called the length and is never
-negative.
+The number of elements is called the length of the array and is never negative.
</p>
<pre class="ebnf">
@@ -883,6 +883,7 @@ multi-dimensional types.
A slice is a descriptor for a contiguous segment of an <i>underlying array</i> and
provides access to a numbered sequence of elements from that array.
A slice type denotes the set of all slices of arrays of its element type.
+The number of elements is called the length of the slice and is never negative.
The value of an uninitialized slice is <code>nil</code>.
</p>
@@ -891,8 +892,7 @@ SliceType = "[" "]" ElementType .
</pre>
<p>
-Like arrays, slices are indexable and have a length. The length of a
-slice <code>s</code> can be discovered by the built-in function
+The length of a slice <code>s</code> can be discovered by the built-in function
<a href="#Length_and_capacity"><code>len</code></a>; unlike with arrays it may change during
execution. The elements can be addressed by integer <a href="#Index_expressions">indices</a>
0 through <code>len(s)-1</code>. The slice index of a
@@ -1349,7 +1349,8 @@ The optional <code>&lt;-</code> operator specifies the channel <i>direction</i>,
<i>send</i> or <i>receive</i>. If no direction is given, the channel is
<i>bidirectional</i>.
A channel may be constrained only to send or only to receive by
-<a href="#Conversions">conversion</a> or <a href="#Assignments">assignment</a>.
+<a href="#Assignments">assignment</a> or
+explicit <a href="#Conversions">conversion</a>.
</p>
<pre>
@@ -2069,9 +2070,9 @@ Otherwise, each variable is initialized to its <a href="#The_zero_value">zero va
If a type is present, each variable is given that type.
Otherwise, each variable is given the type of the corresponding
initialization value in the assignment.
-If that value is an untyped constant, it is first
+If that value is an untyped constant, it is first implicitly
<a href="#Conversions">converted</a> to its <a href="#Constants">default type</a>;
-if it is an untyped boolean value, it is first converted to type <code>bool</code>.
+if it is an untyped boolean value, it is first implicitly converted to type <code>bool</code>.
The predeclared value <code>nil</code> cannot be used to initialize a variable
with no explicit type.
</p>
@@ -2112,8 +2113,8 @@ with initializer expressions but no types:
i, j := 0, 10
f := func() int { return 7 }
ch := make(chan int)
-r, w := os.Pipe(fd) // os.Pipe() returns two values
-_, y, _ := coord(p) // coord() returns three values; only interested in y coordinate
+r, w, _ := os.Pipe() // os.Pipe() returns a connected pair of Files and an error, if any
+_, y, _ := coord(p) // coord() returns three values; only interested in y coordinate
</pre>
<p>
@@ -2202,11 +2203,11 @@ Receiver = Parameters .
<p>
The receiver is specified via an extra parameter section preceding the method
name. That parameter section must declare a single non-variadic parameter, the receiver.
-Its type must be of the form <code>T</code> or <code>*T</code> (possibly using
-parentheses) where <code>T</code> is a type name. The type denoted by <code>T</code> is called
-the receiver <i>base type</i>; it must not be a pointer or interface type and
-it must be <a href="#Type_definitions">defined</a> in the same package as the method.
-The method is said to be <i>bound</i> to the base type and the method name
+Its type must be a <a href="#Type_definitions">defined</a> type <code>T</code> or a
+pointer to a defined type <code>T</code>. <code>T</code> is called the receiver
+<i>base type</i>. A receiver base type cannot be a pointer or interface type and
+it must be defined in the same package as the method.
+The method is said to be <i>bound</i> to its receiver base type and the method name
is visible only within <a href="#Selectors">selectors</a> for type <code>T</code>
or <code>*T</code>.
</p>
@@ -2226,7 +2227,7 @@ the non-blank method and field names must be distinct.
</p>
<p>
-Given type <code>Point</code>, the declarations
+Given defined type <code>Point</code>, the declarations
</p>
<pre>
@@ -3260,7 +3261,7 @@ var v, ok T1 = x.(T)
yields an additional untyped boolean value. The value of <code>ok</code> is <code>true</code>
if the assertion holds. Otherwise it is <code>false</code> and the value of <code>v</code> is
the <a href="#The_zero_value">zero value</a> for type <code>T</code>.
-No run-time panic occurs in this case.
+No <a href="#Run_time_panics">run-time panic</a> occurs in this case.
</p>
@@ -3433,7 +3434,7 @@ For operations involving constants only, see the section on
<p>
Except for shift operations, if one operand is an untyped <a href="#Constants">constant</a>
-and the other operand is not, the constant is <a href="#Conversions">converted</a>
+and the other operand is not, the constant is implicitly <a href="#Conversions">converted</a>
to the type of the other operand.
</p>
@@ -3442,7 +3443,7 @@ The right operand in a shift expression must have unsigned integer type
or be an untyped constant <a href="#Representability">representable</a> by a
value of type <code>uint</code>.
If the left operand of a non-constant shift expression is an untyped constant,
-it is first converted to the type it would assume if the shift expression were
+it is first implicitly converted to the type it would assume if the shift expression were
replaced by its left operand alone.
</p>
@@ -3624,7 +3625,7 @@ For signed integers, the operations <code>+</code>,
<code>-</code>, <code>*</code>, <code>/</code>, and <code>&lt;&lt;</code> may legally
overflow and the resulting value exists and is deterministically defined
by the signed integer representation, the operation, and its operands.
-No exception is raised as a result of overflow.
+Overflow does not cause a <a href="#Run_time_panics">run-time panic</a>.
A compiler may not optimize code under the assumption that overflow does
not occur. For instance, it may not assume that <code>x &lt; x + 1</code> is always true.
</p>
@@ -3645,7 +3646,7 @@ occurs is implementation-specific.
An implementation may combine multiple floating-point operations into a single
fused operation, possibly across statements, and produce a result that differs
from the value obtained by executing and rounding the instructions individually.
-A floating-point type <a href="#Conversions">conversion</a> explicitly rounds to
+An explicit floating-point type <a href="#Conversions">conversion</a> rounds to
the precision of the target type, preventing fusion that would discard that rounding.
</p>
@@ -3907,7 +3908,14 @@ channel is closed and empty.
<h3 id="Conversions">Conversions</h3>
<p>
-Conversions are expressions of the form <code>T(x)</code>
+A conversion changes the <a href="#Types">type</a> of an expression
+to the type specified by the conversion.
+A conversion may appear literally in the source, or it may be <i>implied</i>
+by the context in which an expression appears.
+</p>
+
+<p>
+An <i>explicit</i> conversion is an expression of the form <code>T(x)</code>
where <code>T</code> is a type and <code>x</code> is an expression
that can be converted to type <code>T</code>.
</p>
@@ -3938,7 +3946,7 @@ func() int(x) // x is converted to func() int (unambiguous)
A <a href="#Constants">constant</a> value <code>x</code> can be converted to
type <code>T</code> if <code>x</code> is <a href="#Representability">representable</a>
by a value of <code>T</code>.
-As a special case, an integer constant <code>x</code> can be converted to a
+As a special case, an integer constant <code>x</code> can be explicitly converted to a
<a href="#String_types">string type</a> using the
<a href="#Conversions_to_and_from_a_string_type">same rule</a>
as for non-constant <code>x</code>.
@@ -4672,13 +4680,13 @@ to the type of the operand to which it is assigned, with the following special c
<li>
If an untyped constant
is assigned to a variable of interface type or the blank identifier,
- the constant is first <a href="#Conversions">converted</a> to its
+ the constant is first implicitly <a href="#Conversions">converted</a> to its
<a href="#Constants">default type</a>.
</li>
<li>
If an untyped boolean value is assigned to a variable of interface type or
- the blank identifier, it is first converted to type <code>bool</code>.
+ the blank identifier, it is first implicitly converted to type <code>bool</code>.
</li>
</ol>
@@ -4764,14 +4772,14 @@ ExprSwitchCase = "case" ExpressionList | "default" .
</pre>
<p>
-If the switch expression evaluates to an untyped constant, it is first
+If the switch expression evaluates to an untyped constant, it is first implicitly
<a href="#Conversions">converted</a> to its <a href="#Constants">default type</a>;
-if it is an untyped boolean value, it is first converted to type <code>bool</code>.
+if it is an untyped boolean value, it is first implicitly converted to type <code>bool</code>.
The predeclared untyped value <code>nil</code> cannot be used as a switch expression.
</p>
<p>
-If a case expression is untyped, it is first <a href="#Conversions">converted</a>
+If a case expression is untyped, it is first implicitly <a href="#Conversions">converted</a>
to the type of the switch expression.
For each (possibly converted) case expression <code>x</code> and the value <code>t</code>
of the switch expression, <code>x == t</code> must be a valid <a href="#Comparison_operators">comparison</a>.
@@ -5546,7 +5554,10 @@ executes, the function value and parameters to the call are
and saved anew but the actual function is not invoked.
Instead, deferred functions are invoked immediately before
the surrounding function returns, in the reverse order
-they were deferred.
+they were deferred. That is, if the surrounding function
+returns through an explicit <a href="#Return_statements">return statement</a>,
+deferred functions are executed <i>after</i> any result parameters are set
+by that return statement but <i>before</i> the function returns to its caller.
If a deferred function value evaluates
to <code>nil</code>, execution <a href="#Handling_panics">panics</a>
when the function is invoked, not when the "defer" statement is executed.
@@ -5572,12 +5583,13 @@ for i := 0; i &lt;= 3; i++ {
defer fmt.Print(i)
}
-// f returns 1
+// f returns 42
func f() (result int) {
defer func() {
- result++
+ // result is accessed after it was set to 6 by the return statement
+ result *= 7
}()
- return 0
+ return 6
}
</pre>
@@ -5877,7 +5889,7 @@ floating-point type and the return type is the complex type
with the corresponding floating-point constituents:
<code>complex64</code> for <code>float32</code> arguments, and
<code>complex128</code> for <code>float64</code> arguments.
-If one of the arguments evaluates to an untyped constant, it is first
+If one of the arguments evaluates to an untyped constant, it is first implicitly
<a href="#Conversions">converted</a> to the type of the other argument.
If both arguments evaluate to untyped constants, they must be non-complex
numbers or their imaginary parts must be zero, and the return value of
diff --git a/doc/help.html b/doc/help.html
index f66819687..f11e28690 100644
--- a/doc/help.html
+++ b/doc/help.html
@@ -27,6 +27,11 @@ The <a href="https://forum.golangbridge.org/">Go Forum</a> is a discussion
forum for Go programmers.
</p>
+<h3 id="discord"><a href="https://discord.gg/64C346U">Gophers Discord</a></h3>
+<p>
+Get live support and talk with other gophers on the Go Discord.
+</p>
+
<h3 id="slack"><a href="https://blog.gopheracademy.com/gophers-slack-community/">Gopher Slack</a></h3>
<p>Get live support from other users in the Go slack channel.</p>
diff --git a/doc/install-source.html b/doc/install-source.html
index f6d9473d9..bbe7cdfd0 100644
--- a/doc/install-source.html
+++ b/doc/install-source.html
@@ -349,15 +349,7 @@ provides <b>essential setup instructions</b> for using the Go tools.
<p>
The source code for several Go tools (including <a href="/cmd/godoc/">godoc</a>)
is kept in <a href="https://golang.org/x/tools">the go.tools repository</a>.
-To install all of them, run the <code>go</code> <code>get</code> command:
-</p>
-
-<pre>
-$ go get golang.org/x/tools/cmd/...
-</pre>
-
-<p>
-Or if you just want to install a specific command (<code>godoc</code> in this case):
+To install one of the tools (<code>godoc</code> in this case):
</p>
<pre>
@@ -374,16 +366,6 @@ You must also have a workspace (<code>GOPATH</code>) set up;
see <a href="/doc/code.html">How to Write Go Code</a> for the details.
</p>
-<p>
-<b>Note</b>: The <code>go</code> command will install the <code>godoc</code>
-binary to <code>$GOROOT/bin</code> (or <code>$GOBIN</code>) and the
-<code>cover</code> and <code>vet</code> binaries to
-<code>$GOROOT/pkg/tool/$GOOS_$GOARCH</code>.
-You can access the latter commands with
-"<code>go</code> <code>tool</code> <code>cover</code>" and
-"<code>go</code> <code>tool</code> <code>vet</code>".
-</p>
-
<h2 id="community">Community resources</h2>
<p>
@@ -639,14 +621,10 @@ contains further details regarding Go's ARM support.
</p>
</li>
-<li><code>$GOMIPS</code> (for <code>mips</code> and <code>mipsle</code> only)
+<li><code>$GOMIPS</code> (for <code>mips</code> and <code>mipsle</code> only) <br> <code>$GOMIPS64</code> (for <code>mips64</code> and <code>mips64le</code> only)
<p>
-This sets whether to use floating point instructions.
+ These variables set whether to use floating point instructions. Set to "<code>hardfloat</code>" to use floating point instructions; this is the default. Set to "<code>softfloat</code>" to use soft floating point.
</p>
-<ul>
- <li><code>GOMIPS=hardfloat</code>: use floating point instructions (the default)</li>
- <li><code>GOMIPS=softfloat</code>: use soft floating point</li>
-</ul>
</li>
</ul>
@@ -670,7 +648,6 @@ something like this:
</p>
<pre>
-export GOROOT=$HOME/go1.X
export GOARCH=amd64
export GOOS=linux
</pre>
diff --git a/doc/install.html b/doc/install.html
index 2e0c7f859..a41c60ba6 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -172,11 +172,6 @@ command prompts for the change to take effect.
</p>
<p>
-If you chose a directory other than <code>c:\Go</code>,
-you must set the <code>GOROOT</code> environment variable to your chosen path.
-</p>
-
-<p>
Add the <code>bin</code> subdirectory of your Go root (for example, <code>c:\Go\bin</code>) to your <code>PATH</code> environment variable.
</p>
@@ -271,6 +266,39 @@ which describes some essential concepts about using the Go tools.
</p>
+<h2 id="extra_versions">Installing extra Go versions</h2>
+
+<p>
+It may be useful to have multiple Go versions installed on the same machine, for
+example, to ensure that a package's tests pass on multiple Go versions.
+Once you have one Go version installed, you can install another (such as 1.10.7)
+as follows:
+</p>
+
+<pre>
+$ go get golang.org/dl/go1.10.7
+$ go1.10.7 download
+</pre>
+
+<p>
+The newly downloaded version can be used like <code>go</code>:
+</p>
+
+<pre>
+$ go1.10.7 version
+go version go1.10.7 linux/amd64
+</pre>
+
+<p>
+All Go versions available via this method are listed on
+<a href="https://godoc.org/golang.org/dl#pkg-subdirectories">the download page</a>.
+You can find where each of these extra Go versions is installed by looking
+at its <code>GOROOT</code>; for example, <code>go1.10.7 env GOROOT</code>.
+To uninstall a downloaded version, just remove its <code>GOROOT</code> directory
+and the <code>goX.Y.Z</code> binary.
+</p>
+
+
<h2 id="uninstall">Uninstalling Go</h2>
<p>
diff --git a/doc/progs/eff_sequence.go b/doc/progs/eff_sequence.go
index 11c885abf..ab1826b6e 100644
--- a/doc/progs/eff_sequence.go
+++ b/doc/progs/eff_sequence.go
@@ -28,11 +28,18 @@ func (s Sequence) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
+// Copy returns a copy of the Sequence.
+func (s Sequence) Copy() Sequence {
+ copy := make(Sequence, 0, len(s))
+ return append(copy, s...)
+}
+
// Method for printing - sorts the elements before printing.
func (s Sequence) String() string {
+ s = s.Copy() // Make a copy; don't overwrite argument.
sort.Sort(s)
str := "["
- for i, elem := range s {
+ for i, elem := range s { // Loop is O(N²); will fix that in next example.
if i > 0 {
str += " "
}
diff --git a/doc/security.html b/doc/security.html
index c305ae03c..b33496322 100644
--- a/doc/security.html
+++ b/doc/security.html
@@ -70,7 +70,7 @@ This person coordinates the fix and release process.</li>
<li>Code is audited to find any potential similar problems.</li>
<li>If it is determined, in consultation with the submitter, that a CVE-ID is
required, the primary handler obtains one via email to
-<a href="http://oss-security.openwall.org/wiki/mailing-lists/distros">oss-distros</a>.</li>
+<a href="https://oss-security.openwall.org/wiki/mailing-lists/distros">oss-distros</a>.</li>
<li>Fixes are prepared for the two most recent major releases and the head/master
revision. These fixes are not yet committed to the public repository.</li>
<li>A notification is sent to the