Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into regexp_examples_l…
Browse files Browse the repository at this point in the history
…ongest_findsubmatchindex_findallindex
  • Loading branch information
psampaz committed Aug 13, 2019
2 parents 48a0e0b + 61bb56a commit 7daee12
Show file tree
Hide file tree
Showing 41 changed files with 535 additions and 336 deletions.
2 changes: 2 additions & 0 deletions api/go1.13.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ pkg debug/dwarf, method (*UnsupportedType) String() string
pkg debug/dwarf, type UnsupportedType struct
pkg debug/dwarf, type UnsupportedType struct, embedded CommonType
pkg debug/dwarf, type UnsupportedType struct, Tag Tag
pkg debug/elf, type Symbol struct, Library string
pkg debug/elf, type Symbol struct, Version string
pkg encoding/csv, method (*ParseError) Unwrap() error
pkg encoding/json, method (*MarshalerError) Unwrap() error
pkg errors, func As(error, interface{}) bool
Expand Down
7 changes: 5 additions & 2 deletions doc/articles/race_detector.html
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,11 @@ <h3 id="Primitive_unprotected_variable">Primitive unprotected variable</h3>
<h2 id="Supported_Systems">Supported Systems</h2>

<p>
The race detector runs on <code>darwin/amd64</code>, <code>freebsd/amd64</code>,
<code>linux/amd64</code>, and <code>windows/amd64</code>.
The race detector runs on
<code>linux/amd64</code>, <code>linux/ppc64le</code>,
<code>linux/arm64</code>, <code>freebsd/amd64</code>,
<code>netbsd/amd64</code>, <code>darwin/amd64</code>,
and <code>windows/amd64</code>.
</p>

<h2 id="Runtime_Overheads">Runtime Overhead</h2>
Expand Down
16 changes: 13 additions & 3 deletions doc/asm.html
Original file line number Diff line number Diff line change
Expand Up @@ -590,27 +590,37 @@ <h3 id="x86">32-bit Intel 386</h3>
<p>
The runtime pointer to the <code>g</code> structure is maintained
through the value of an otherwise unused (as far as Go is concerned) register in the MMU.
A OS-dependent macro <code>get_tls</code> is defined for the assembler if the source includes
a special header, <code>go_asm.h</code>:
An OS-dependent macro <code>get_tls</code> is defined for the assembler if the source is
in the <code>runtime</code> package and includes a special header, <code>go_tls.h</code>:
</p>

<pre>
#include "go_asm.h"
#include "go_tls.h"
</pre>

<p>
Within the runtime, the <code>get_tls</code> macro loads its argument register
with a pointer to the <code>g</code> pointer, and the <code>g</code> struct
contains the <code>m</code> pointer.
There's another special header containing the offsets for each
element of <code>g</code>, called <code>go_asm.h</code>.
The sequence to load <code>g</code> and <code>m</code> using <code>CX</code> looks like this:
</p>

<pre>
#include "go_tls.h"
#include "go_asm.h"
...
get_tls(CX)
MOVL g(CX), AX // Move g into AX.
MOVL g_m(AX), BX // Move g.m into BX.
</pre>

<p>
Note: The code above works only in the <code>runtime</code> package, while <code>go_tls.h</code> also
applies to <a href="#arm">arm</a>, <a href="#amd64">amd64</a> and amd64p32, and <code>go_asm.h</code> applies to all architectures.
</p>

<p>
Addressing modes:
</p>
Expand Down
52 changes: 51 additions & 1 deletion doc/go1.13.html
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,37 @@ <h3 id="crypto/ed25519"><a href="/pkg/crypto/ed25519/">crypto/ed25519</a></h3>
<code>crypto/ed25519</code> when used with Go 1.13+.
</p>

<h3 id="error_wrapping">Error wrapping</h3>

<p><!-- CL 163558, 176998 -->
Go 1.13 contains support for error wrapping, as first proposed in
the <a href="https://go.googlesource.com/proposal/+/master/design/29934-error-values.md">
Error Values proposal</a> and discussed on <a href="https://golang.org/issue/29934">the
associated issue</a>.
</p>
<p>
An error <code>e</code> can <em>wrap</em> another error <code>w</code> by providing
an <code>Unwrap</code> method that returns <code>w</code>. Both <code>e</code>
and <code>w</code> are available to programs, allowing <code>e</code> to provide
additional context to <code>w</code> or to reinterpret it while still allowing
programs to make decisions based on <code>w</code>.
</p>
<p>
To support wrapping, <a href="#fmt"><code>fmt.Errorf</code></a> now has a <code>%w</code>
verb for creating wrapped errors, and three new functions in
the <a href="#errors"><code>errors</code></a> package (
<a href="/pkg/errors#Unwrap"><code>errors.Unwrap</code></a>,
<a href="/pkg/errors#Is"><code>errors.Is</code></a> and
<a href="/pkg/errors#As"><code>errors.As</code></a>) simplify unwrapping
and inspecting wrapped errors.
</p>
<p>
For more information, read the <a href="/pkg/errors/"><code>errors</code> package
documentation</a>, or see
the <a href="https://golang.org/wiki/ErrorValueFAQ">Error Value FAQ</a>.
There will soon be a blog post as well.
</p>

<h3 id="minor_library_changes">Minor changes to the library</h3>

<p>
Expand Down Expand Up @@ -612,7 +643,8 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
<dd>
<!-- CL 163558 -->
<p>
The new function <a href="/pkg/errors/#As"><code>As</code></a> finds the first error in a given error’s chain
The new function <a href="/pkg/errors/#As"><code>As</code></a> finds the first
error in a given error’s chain (sequence of wrapped errors)
that matches a given target’s type, and if so, sets the target to that error value.
</p>
<p>
Expand Down Expand Up @@ -860,6 +892,14 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>

<dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
<dd>
<p><!-- CL 148958, CL 148959, CL 152697, CL 152698 -->
The fast paths of <a href="/pkg/sync/#Mutex.Lock"><code>Mutex.Lock</code></a>, <a href="/pkg/sync/#Mutex.Unlock"><code>Mutex.Unlock</code></a>,
<a href="/pkg/sync/#RWMutex.Lock"><code>RWMutex.Lock</code></a>, <a href="/pkg/sync/#Mutex.RUnlock"><code>RWMutex.RUnlock</code></a>, and
<a href="/pkg/sync/#Once.Do"><code>Once.Do</code></a> are now inlined in their callers.
For the uncontended cases on amd64, these changes make <a href="/pkg/sync/#Once.Do"><code>Once.Do</code></a> twice as fast, and the
<a href="/pkg/sync/#Mutex"><code>Mutex</code></a>/<a href="/pkg/sync/#RWMutex"><code>RWMutex</code></a> methods up to 10% faster.
</p>

<p><!-- CL 166960 -->
Large <a href="/pkg/sync/#Pool"><code>Pool</code></a> no longer increase stop-the-world pause times.
</p>
Expand Down Expand Up @@ -960,3 +1000,13 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>

</dl><!-- time -->

<dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt>
<dd>
<p>
The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated
support throughout the system has been upgraded from Unicode 10.0 to
<a href="http://www.unicode.org/versions/Unicode11.0.0/">Unicode 11.0</a>,
which adds 684 new characters, including seven new scripts, and 66 new emoji.
</p>

</dl><!-- unicode -->
68 changes: 64 additions & 4 deletions doc/install-source.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h2 id="introduction">Introduction</h2>
</p>

<p>
The Go compilers support eight instruction sets.
The Go compilers support nine instruction sets.
There are important differences in the quality of the compilers for the different
architectures.
</p>
Expand Down Expand Up @@ -87,6 +87,12 @@ <h2 id="introduction">Introduction</h2>
<dd>
Supports Linux binaries. New in 1.7 and not as well exercised as other ports.
</dd>
<dt>
<code>wasm</code> (WebAssembly)
</dt>
<dd>
Targets the WebAssembly platform. New in 1.11 and not as well exercised as other ports.
</dd>
</dl>

<p>
Expand Down Expand Up @@ -134,12 +140,16 @@ <h2 id="go14">Install Go compiler binaries</h2>
the <code>go</code> command binary for the bootstrap toolchain.
</p>

<h3 id="bootstrapFromBinaryRelease">Bootstrap toolchain from binary release</h3>

<p>
To use a binary release as a bootstrap toolchain, see
<a href="/dl/">the downloads page</a> or use any other
packaged Go distribution.
</p>

<h3 id="bootstrapFromSource">Bootstrap toolchain from source</h3>

<p>
To build a bootstrap toolchain from source, use
either the git branch <code>release-branch.go1.4</code> or
Expand All @@ -153,6 +163,17 @@ <h2 id="go14">Install Go compiler binaries</h2>
on Windows, <code>make.bat</code>).
</p>

<p>
Once the Go 1.4 source has been unpacked into your GOROOT_BOOTSTRAP directory,
you must keep this git clone instance checked out to branch
<code>release-branch.go1.4</code>. Specifically, do not attempt to reuse
this git clone in the later step named "Fetch the repository." The go1.4
bootstrap toolchain <b>must be able</b> to properly traverse the go1.4 sources
that it assumes are present under this repository root.
</p>

<h3 id="bootstrapFromCrosscompiledSource">Bootstrap toolchain from cross-compiled source</h3>

<p>
To cross-compile a bootstrap toolchain from source, which is
necessary on systems Go 1.4 did not target (for
Expand All @@ -175,6 +196,8 @@ <h2 id="go14">Install Go compiler binaries</h2>
and used as <code>GOROOT_BOOTSTRAP</code> to bootstrap a local build.
</p>

<h3 id="bootstrapFromGccgo">Bootstrap toolchain using gccgo</h3>

<p>
To use gccgo as the bootstrap toolchain, you need to arrange
for <code>$GOROOT_BOOTSTRAP/bin/go</code> to be the go tool that comes
Expand Down Expand Up @@ -240,6 +263,11 @@ <h2 id="fetch">Fetch the repository</h2>
the default location of <code>$GOPATH</code>.
See <a href="#gopath"><code>GOPATH</code></a> below.</p>

Reminder: If you opted to also compile the bootstrap binaries from source (in an
earlier section), you still need to <code>git clone</code> again at this point
(to checkout the latest <code>&lt;tag&gt;</code>), because you must keep your
go1.4 repository distinct.

<h2 id="head">(Optional) Switch to the master branch</h2>

<p>If you intend to modify the go source code, and
Expand Down Expand Up @@ -493,25 +521,45 @@ <h2 id="environment">Optional environment variables</h2>

<p>
Choices for <code>$GOOS</code> are
<code>darwin</code> (macOS 10.10 and above and iOS), <code>dragonfly</code>, <code>freebsd</code>,
<code>android</code>, <code>darwin</code> (macOS 10.11 and above and iOS),
<code>dragonfly</code>, <code>freebsd</code>, <code>illumos</code>, <code>js</code>,
<code>linux</code>, <code>netbsd</code>, <code>openbsd</code>,
<code>plan9</code>, <code>solaris</code> and <code>windows</code>.
</p>

<p>
Choices for <code>$GOARCH</code> are
<code>amd64</code> (64-bit x86, the most mature port),
<code>386</code> (32-bit x86), <code>arm</code> (32-bit ARM), <code>arm64</code> (64-bit ARM),
<code>ppc64le</code> (PowerPC 64-bit, little-endian), <code>ppc64</code> (PowerPC 64-bit, big-endian),
<code>mips64le</code> (MIPS 64-bit, little-endian), <code>mips64</code> (MIPS 64-bit, big-endian),
<code>mipsle</code> (MIPS 32-bit, little-endian), <code>mips</code> (MIPS 32-bit, big-endian), and
<code>s390x</code> (IBM System z 64-bit, big-endian).
<code>mipsle</code> (MIPS 32-bit, little-endian), <code>mips</code> (MIPS 32-bit, big-endian),
<code>s390x</code> (IBM System z 64-bit, big-endian), and
<code>wasm</code> (WebAssembly 32-bit).
</p>

<p>
The valid combinations of <code>$GOOS</code> and <code>$GOARCH</code> are:
<table cellpadding="0">
<tr>
<th width="50"></th><th align="left" width="100"><code>$GOOS</code></th> <th align="left" width="100"><code>$GOARCH</code></th>
</tr>
<tr>
<td></td><td><code>aix</code></td> <td><code>ppc64</code></td>
</tr>
<tr>
<td></td><td><code>android</code></td> <td><code>386</code></td>
</tr>
<tr>
<td></td><td><code>android</code></td> <td><code>amd64</code></td>
</tr>
<tr>
<td></td><td><code>android</code></td> <td><code>arm</code></td>
</tr>
<tr>
<td></td><td><code>android</code></td> <td><code>arm64</code></td>
</tr>
<tr>
<td></td><td><code>darwin</code></td> <td><code>386</code></td>
</tr>
<tr>
Expand All @@ -536,6 +584,12 @@ <h2 id="environment">Optional environment variables</h2>
<td></td><td><code>freebsd</code></td> <td><code>arm</code></td>
</tr>
<tr>
<td></td><td><code>illumos</code></td> <td><code>amd64</code></td>
</tr>
<tr>
<td></td><td><code>js</code></td> <td><code>wasm</code></td>
</tr>
<tr>
<td></td><td><code>linux</code></td> <td><code>386</code></td>
</tr>
<tr>
Expand Down Expand Up @@ -587,12 +641,18 @@ <h2 id="environment">Optional environment variables</h2>
<td></td><td><code>openbsd</code></td> <td><code>arm</code></td>
</tr>
<tr>
<td></td><td><code>openbsd</code></td> <td><code>arm64</code></td>
</tr>
<tr>
<td></td><td><code>plan9</code></td> <td><code>386</code></td>
</tr>
<tr>
<td></td><td><code>plan9</code></td> <td><code>amd64</code></td>
</tr>
<tr>
<td></td><td><code>plan9</code></td> <td><code>arm</code></td>
</tr>
<tr>
<td></td><td><code>solaris</code></td> <td><code>amd64</code></td>
</tr>
<tr>
Expand Down
2 changes: 2 additions & 0 deletions src/cmd/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045/go.mod h1:cYlCBUl1MsqxdiKgm
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c h1:Vj5n4GlwjmQteupaxJ9+0FNOmBrHfq7vN4btdGoDZgI=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82 h1:vsphBvatvfbhlb4PO1BYSr9dzugGxJ/SQHoNufZJq1w=
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190611154301-25a4f137592f h1:6awn5JC4pwVI5HiBqs7MDtRxnwV9PpO5iSA9v6P09pA=
golang.org/x/tools v0.0.0-20190611154301-25a4f137592f/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
2 changes: 1 addition & 1 deletion src/cmd/go/internal/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func runList(cmd *base.Command, args []string) {
if !*listE {
for _, m := range mods {
if m.Error != nil {
base.Errorf("go list -m %s: %v", m.Path, m.Error.Err)
base.Errorf("go list -m: %v", m.Error.Err)
}
}
base.ExitIfErrors()
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/internal/load/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ func loadPackageData(path, parentPath, parentDir, parentRoot string, parentIsStd
}
} else if r.err != nil {
data.p = new(build.Package)
data.err = fmt.Errorf("unknown import path %q: %v", r.path, r.err)
data.err = r.err
} else if cfg.ModulesEnabled && path != "unsafe" {
data.p = new(build.Package)
data.err = fmt.Errorf("unknown import path %q: internal error: module loader did not resolve import", r.path)
Expand Down
20 changes: 15 additions & 5 deletions src/cmd/go/internal/modcmd/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,19 @@ func runDownload(cmd *base.Command, args []string) {
if info.Replace != nil {
info = info.Replace
}
if info.Version == "" {
if info.Version == "" && info.Error == nil {
// main module
continue
}
m := &moduleJSON{
Path: info.Path,
Version: info.Version,
}
mods = append(mods, m)
if info.Error != nil {
m.Error = info.Error.Err
continue
}
work.Add(m)
}

Expand All @@ -110,12 +115,17 @@ func runDownload(cmd *base.Command, args []string) {
// downloading the modules.
var latestArgs []string
for _, m := range mods {
if m.Error != "" {
continue
}
latestArgs = append(latestArgs, m.Path+"@latest")
}

for _, info := range modload.ListModules(latestArgs, listU, listVersions) {
if info.Version != "" {
latest[info.Path] = info.Version
if len(latestArgs) > 0 {
for _, info := range modload.ListModules(latestArgs, listU, listVersions) {
if info.Version != "" {
latest[info.Path] = info.Version
}
}
}
}
Expand Down Expand Up @@ -169,7 +179,7 @@ func runDownload(cmd *base.Command, args []string) {
} else {
for _, m := range mods {
if m.Error != "" {
base.Errorf("%s@%s: %s\n", m.Path, m.Version, m.Error)
base.Errorf("%s", m.Error)
}
}
base.ExitIfErrors()
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/internal/modfetch/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func lookup(proxy, path string) (r Repo, err error) {

var (
errModVendor = errors.New("module lookup disabled by -mod=vendor")
errProxyOff = errors.New("module lookup disabled by GOPROXY=off")
errProxyOff = notExistError("module lookup disabled by GOPROXY=off")
errNoproxy error = notExistError("disabled by GOPRIVATE/GONOPROXY")
errUseProxy error = notExistError("path does not match GOPRIVATE/GONOPROXY")
)
Expand Down

0 comments on commit 7daee12

Please sign in to comment.