]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
5 years ago[release-branch.go1.11-security] go1.11.3 go1.11.3
Dmitri Shuralyov [Thu, 13 Dec 2018 17:07:14 +0000 (12:07 -0500)]
[release-branch.go1.11-security] go1.11.3

Change-Id: I0933c8d2f635e987db1a36030ef330f77b5ef8a8
Reviewed-on: https://team-review.git.corp.google.com/c/377323
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 years ago[release-branch.go1.11-security] cmd/go: set user and email in test-local git repos
Bryan C. Mills [Thu, 13 Dec 2018 14:23:25 +0000 (09:23 -0500)]
[release-branch.go1.11-security] cmd/go: set user and email in test-local git repos

Some of the builders cannot infer user and email from the builder hostname.

Change-Id: I6f343ae41ca7d984797e595867c8210b404b782f
Reviewed-on: https://team-review.git.corp.google.com/c/376740
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 years ago[release-branch.go1.11-security] doc: document Go 1.11.3 and Go 1.10.6
Dmitri Shuralyov [Wed, 12 Dec 2018 18:35:19 +0000 (13:35 -0500)]
[release-branch.go1.11-security] doc: document Go 1.11.3 and Go 1.10.6

Change-Id: I3fe44887a84586d73be01df78a9cbb002c1fc9c5
Reviewed-on: https://team-review.git.corp.google.com/c/376466
Reviewed-by: Filippo Valsorda <valsorda@google.com>
5 years ago[release-branch.go1.11-security] cmd/go/internal/get: relax pathOK check to allow...
Bryan C. Mills [Tue, 4 Dec 2018 22:00:19 +0000 (17:00 -0500)]
[release-branch.go1.11-security] cmd/go/internal/get: relax pathOK check to allow any letter

This fixes a regression of #18660 with the new path checks.

Change-Id: I2dd9adab999e7f810e0e746ad8b75ea9622f56e7
Reviewed-on: https://team-review.git.corp.google.com/c/372706
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 years ago[release-branch.go1.11-security] cmd/go/internal/get: use a strings.Replacer in expand
Bryan C. Mills [Tue, 4 Dec 2018 20:42:32 +0000 (15:42 -0500)]
[release-branch.go1.11-security] cmd/go/internal/get: use a strings.Replacer in expand

This should be a no-op, but produces deterministic (and more correct)
behavior if we have accidentally failed to sanitize one of the inputs.

Change-Id: I1271d0ffd01a691ec8c84906c4e02d9e2be19c72
Reviewed-on: https://team-review.git.corp.google.com/c/372705
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 years ago[release-branch.go1.11-security] cmd/go/internal/get: reject Windows shortnames as...
Bryan C. Mills [Tue, 4 Dec 2018 19:37:39 +0000 (14:37 -0500)]
[release-branch.go1.11-security] cmd/go/internal/get: reject Windows shortnames as path components

Change-Id: Ia32d8ec1fc0c4e242f50d8871c0ef3ce315f3c65
Reviewed-on: https://team-review.git.corp.google.com/c/370572
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 years ago[release-branch.go1.11-security] cmd/go: reject 'get' of paths containing leading...
Bryan C. Mills [Fri, 30 Nov 2018 19:04:35 +0000 (14:04 -0500)]
[release-branch.go1.11-security] cmd/go: reject 'get' of paths containing leading dots or unsupported characters

On some platforms, directories beginning with dot are treated as
hidden files, and filenames containing unusual characters can be
confusing for users to manipulate (and delete).

Change-Id: Ia1f5a65b9cff4eeb51cc4dba3ff7c7afabc343f2
Reviewed-on: https://team-review.git.corp.google.com/c/368442
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 years ago[release-branch.go1.11-security] crypto/x509: limit number of signature checks for...
Filippo Valsorda [Wed, 5 Dec 2018 03:23:22 +0000 (22:23 -0500)]
[release-branch.go1.11-security] crypto/x509: limit number of signature checks for each verification

That number grows quadratically with the number of intermediate
certificates in certain pathological cases (for example if they all have
the same Subject) leading to a CPU DoS. Set a fixed budget that should
fit all real world chains, given we only look at intermediates provided
by the peer.

The algorithm can be improved, but that's left for follow-up CLs:

    * the cache logic should be reviewed for correctness, as it seems to
      override the entire chain with the cached one
    * the equality check should compare Subject and public key, not the
      whole certificate
    * certificates with the right SKID but the wrong Subject should not
      be considered, and in particular should not take priority over
      certificates with the right Subject

Change-Id: Ib257c12cd5563df7723f9c81231d82b882854213
Reviewed-on: https://team-review.git.corp.google.com/c/370475
Reviewed-by: Andrew Bonventre <andybons@google.com>
(cherry picked from commit 09d57361bc99cbbfb9755ee30ddcb42ff5a9d7d6)
Reviewed-on: https://team-review.git.corp.google.com/c/372858
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 years ago[release-branch.go1.11] go1.11.2 go1.11.2
Andrew Bonventre [Fri, 2 Nov 2018 19:56:16 +0000 (15:56 -0400)]
[release-branch.go1.11] go1.11.2

Change-Id: Idd3527ba8f2329876cbca646aacd97739b9828f7
Reviewed-on: https://go-review.googlesource.com/c/147217
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.11] doc: document Go 1.11.2
Andrew Bonventre [Fri, 2 Nov 2018 19:28:32 +0000 (15:28 -0400)]
[release-branch.go1.11] doc: document Go 1.11.2

Change-Id: Iaff03911f1807d462f1966590626bd486807f53d
Reviewed-on: https://go-review.googlesource.com/c/147178
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit c5d78f512ae6e3867266cfd1cf4cf2194388cbfb)
Reviewed-on: https://go-review.googlesource.com/c/147182
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[release-branch.go1.11] doc: document Go 1.10.5
Andrew Bonventre [Fri, 2 Nov 2018 19:31:37 +0000 (15:31 -0400)]
[release-branch.go1.11] doc: document Go 1.10.5

Change-Id: I11adca150ab795607b832fb354a3e065655e1020
Reviewed-on: https://go-review.googlesource.com/c/147179
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 2764d5ee7b23ae1caf2a4cd4506116a1b9efbf66)
Reviewed-on: https://go-review.googlesource.com/c/147181
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[release-branch.go1.11] go/types: use correct receiver types for embedded interface...
Robert Griesemer [Thu, 11 Oct 2018 00:19:29 +0000 (17:19 -0700)]
[release-branch.go1.11] go/types: use correct receiver types for embedded interface methods

Interface methods don't declare a receiver (it's implicit), but after
type-checking the respective *types.Func objects are marked as methods
by having a receiver. For interface methods, the receiver base type used
to be the interface that declared the method in the first place, even if
the method also appeared in other interfaces via embedding. A change in
the computation of method sets for interfaces for Go1.10 changed that
inadvertently, with the consequence that sometimes a method's receiver
type ended up being an interface into which the method was embedded.
The exact behavior also depended on file type-checking order, and because
files are sometimes sorted by name, the behavior depended on file names.

This didn't matter for type-checking (the typechecker doesn't need the
receiver), but it matters for clients, and for printing of methods.

This change fixes interface method receivers at the end of type-checking
when we have all relevant information.

Fixes #28249
Updates #28005

Change-Id: I96c120fb0e517d7f8a14b8530f0273674569d5ea
Reviewed-on: https://go-review.googlesource.com/c/141358
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-on: https://go-review.googlesource.com/c/146660
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years ago[release-branch.go1.11] database/sql: correctly report MaxIdleClosed stat
Daniel Theophanes [Sun, 30 Sep 2018 05:10:43 +0000 (22:10 -0700)]
[release-branch.go1.11] database/sql: correctly report MaxIdleClosed stat

Previously the MaxIdleClosed counter was incremented when added
to the free connection list, rather then when it wasn't added
to the free connection list. Flip this logic to correct.

Fixes #28325

Change-Id: I405302c14fb985369dab48fbe845e5651afc4ccf
Reviewed-on: https://go-review.googlesource.com/c/138578
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 7db509e682891f3bc501c7b23e32e02c64893557)
Reviewed-on: https://go-review.googlesource.com/c/146697
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
5 years ago[release-branch.go1.11] cmd/trace: don't drop sweep slice details
Hana Kim [Mon, 17 Sep 2018 18:46:50 +0000 (14:46 -0400)]
[release-branch.go1.11] cmd/trace: don't drop sweep slice details

For sweep events, we used to modify the ViewerEvent returned from
ctx.emitSlice later in order to embed more details about the sweep
operation. The trick no longer works after the change
https://golang.org/cl/92375 and caused a regression.

ctx.emit method encodes the ViewerEvent, so any modification to the
ViewerEvent object after ctx.emit returns will not be reflected.

Refactor ctx.emitSlice, so ctx.makeSlice can be used when producing
slices for SWEEP. ctx.emit* methods are meant to truely emit
ViewerEvents.

Fixes #27717
Updates #27711

Change-Id: I0b733ebbbfd4facd8714db0535809ec3cab0833d
Reviewed-on: https://go-review.googlesource.com/135775
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit e57f24ab39ff6e0ea50c84518e7f91b3a40cf547)
Reviewed-on: https://go-review.googlesource.com/c/146698
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years ago[release-branch.go1.11] cmd/go/internal/modcmd: remove non-existent -dir flag
Agniva De Sarker [Tue, 28 Aug 2018 07:40:31 +0000 (13:10 +0530)]
[release-branch.go1.11] cmd/go/internal/modcmd: remove non-existent -dir flag

Updates #27243
Fixes #27498

Change-Id: If9230244938dabd03b9afaa6600310df8f97fe92
Reviewed-on: https://go-review.googlesource.com/131775
Reviewed-by: Bryan C. Mills <bcmills@google.com>
(cherry picked from commit 55ef446026748bea0e9bd5aa35132a07297ff734)
Reviewed-on: https://go-review.googlesource.com/c/146717
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.11] internal/poll: advance file position in windows sendfile
Alex Brainman [Tue, 30 Oct 2018 08:40:57 +0000 (19:40 +1100)]
[release-branch.go1.11] internal/poll: advance file position in windows sendfile

Some versions of Windows (Windows 10 1803) do not set file
position after TransmitFile completes. So just use Seek
to set file position before returning from sendfile.

Fixes #27411

Change-Id: I7a49be10304b5db19dda707b13ac93d338aeb190
Reviewed-on: https://go-review.googlesource.com/131976
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/145779
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>

5 years ago[release-branch.go1.11] cmd/go, cmd/link: silence bogus Apple Xcode warning
Russ Cox [Wed, 24 Oct 2018 16:01:13 +0000 (12:01 -0400)]
[release-branch.go1.11] cmd/go, cmd/link: silence bogus Apple Xcode warning

Certain installations of Xcode are affected by a bug that causes
them to print an inconsequential link-time warning that looks like:

ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.

This has nothing to do with Go, and we've sent this repro case
to Apple:

$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version
version: 10.0.0.0.1.1535735448
$ clang --version
Apple LLVM version 10.0.0 (clang-1000.10.44.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ cat > issue.c
int main() { return 0; }
^D
$ clang issue.c -framework CoreFoundation
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
$

Even if Apple does release a fixed Xcode, many people are seeing
this useless warning, and we might as well make it go away.

Fixes #26073.

Change-Id: Ifc17ba7da1f6b59e233c11ebdab7241cb6656324
Reviewed-on: https://go-review.googlesource.com/c/144112
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
(cherry picked from commit 66bb8ddb956c5ee55b471a019fac2c6817c08ef5)
Reviewed-on: https://go-review.googlesource.com/c/145458
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[release-branch.go1.11] cmd/go: ensure git attributes are set
Jason Keene [Thu, 13 Sep 2018 02:35:58 +0000 (20:35 -0600)]
[release-branch.go1.11] cmd/go: ensure git attributes are set

This change disables the export-subst and export-ignore attributes when
creating zip files for modules. This is done to prevent the ziphash for
a given repo/revision from differing based on variables such as git
version or size of repo. The full rational for this change is detailed
here:

    https://github.com/golang/go/issues/27153#issuecomment-420763082

Fixes #28094

Change-Id: Ib33f525d91d2581fa0b5d26e70d29620c7e685e9
Reviewed-on: https://go-review.googlesource.com/c/135175
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-on: https://go-review.googlesource.com/c/141098
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[release-branch.go1.11] doc: update docs.html with new tour import path
Andrew Bonventre [Fri, 12 Oct 2018 19:39:30 +0000 (15:39 -0400)]
[release-branch.go1.11] doc: update docs.html with new tour import path

As of golang.org/cl/141857 the import path has changed from
golang.org/x/tour/gotour to golang.org/x/tour

Change-Id: Ib54ab2e50188ef66c8a5c45136babfa49ad6934a
Reviewed-on: https://go-review.googlesource.com/c/141917
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 035f9e8102d3b46877b7462fcd365324272d1d0e)
Reviewed-on: https://go-review.googlesource.com/c/143617

5 years ago[release-branch.go1.11] cmd/go: don't mention -mod=release
Mark Rushakoff [Thu, 30 Aug 2018 02:15:39 +0000 (02:15 +0000)]
[release-branch.go1.11] cmd/go: don't mention -mod=release

The -mod=release flag is not supported, so this appears to be a
documentation mistake.

Updates #27354.
Fixes #27398.

Change-Id: I895e8d5b4918adcb1f605361773173f312fa7b65
GitHub-Last-Rev: 42bfe0c11e38c90e76887771654ea81af98d50ec
GitHub-Pull-Request: golang/go#27358
Reviewed-on: https://go-review.googlesource.com/132116
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
(cherry picked from commit 014901c5bab2f99af3b1019d5776fa5da6f5bef7)
Reviewed-on: https://go-review.googlesource.com/c/139421
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.11] cmd/compile: fix type of OffPtr in some optimization rules
Cherry Zhang [Wed, 3 Oct 2018 02:04:45 +0000 (22:04 -0400)]
[release-branch.go1.11] cmd/compile: fix type of OffPtr in some optimization rules

In some optimization rules the type of generated OffPtr was
incorrectly set to the type of the pointee, instead of the
pointer. When the OffPtr value is spilled, this may generate
a spill of the wrong type, e.g. a floating point spill of an
integer (pointer) value. On Wasm, this leads to invalid
bytecode.

Fixes #27961.

Change-Id: I5d464847eb900ed90794105c0013a1a7330756cc
Reviewed-on: https://go-review.googlesource.com/c/139257
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
(cherry picked from commit c96e3bcc97a965b3e2947cc1d8d831b8d39c1d73)
Reviewed-on: https://go-review.googlesource.com/c/139104
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years ago[release-branch.go1.11] cmd/compile: don't crash reporting misuse of shadowed built...
taylorza [Sun, 2 Sep 2018 22:09:29 +0000 (18:09 -0400)]
[release-branch.go1.11] cmd/compile: don't crash reporting misuse of shadowed built-in function

The existing implementation causes a compiler panic if a function parameter shadows a built-in function, and then calling that shadowed name.

Updates #27356
Fixes #27399

Change-Id: I1ffb6dc01e63c7f499e5f6f75f77ce2318f35bcd
Reviewed-on: https://go-review.googlesource.com/132876
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit 4a095b87d30f1f6f7ae01e966f1af5ee63b15c1c)
Reviewed-on: https://go-review.googlesource.com/c/139103
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years ago[release-branch.go1.11] misc/wasm: add mention of polyfill for Edge support
Richard Musiol [Tue, 2 Oct 2018 17:11:14 +0000 (19:11 +0200)]
[release-branch.go1.11] misc/wasm: add mention of polyfill for Edge support

Edge supports WebAssembly but not TextEncoder or TextDecoder.
This change adds a comment pointing to a polyfill that could
be used. The polyfill is not added by default, because we want to
let the user decide if/how to include the polyfill.

Fixes #27295

Change-Id: I375f58f2168665f549997b368428c398dfbbca1c
Reviewed-on: https://go-review.googlesource.com/139037
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit cfb603b0b5fb9c1e72be665b2d65743ddf18c779)
Reviewed-on: https://go-review.googlesource.com/139057
Reviewed-by: Richard Musiol <neelance@gmail.com>
5 years ago[release-branch.go1.11] go1.11.1 go1.11.1
Katie Hockman [Mon, 1 Oct 2018 20:40:42 +0000 (16:40 -0400)]
[release-branch.go1.11] go1.11.1

Change-Id: I3cf3e57b11ad02b497276bae1864fc5ade8144b9
Reviewed-on: https://go-review.googlesource.com/138860
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years ago[release-branch.go1.11] doc: document Go 1.11.1
Katie Hockman [Mon, 1 Oct 2018 20:08:49 +0000 (16:08 -0400)]
[release-branch.go1.11] doc: document Go 1.11.1

Updates #27953

Change-Id: I2f1a55e15dc5737a5a06bd894c46b2c4705f338c
Reviewed-on: https://go-review.googlesource.com/138858
Reviewed-by: Filippo Valsorda <filippo@golang.org>
(cherry picked from commit f99fc3a119dbb98fa9dddcb2e31a6c51925fde77)
Reviewed-on: https://go-review.googlesource.com/138859
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years ago[release-branch.go1.11] encoding/json: fix UnmarshalTypeError without field and struc...
Taesu Pyo [Tue, 28 Aug 2018 15:56:10 +0000 (15:56 +0000)]
[release-branch.go1.11] encoding/json: fix UnmarshalTypeError without field and struct values

Updates #26444
Updates #27275
Fixes #27318

Change-Id: I9e8cbff79f7643ca8964c572c1a98172b6831730
GitHub-Last-Rev: 7eea2158b67ccab34b45a21e8f4289c36de02d93
GitHub-Pull-Request: golang/go#26719
Reviewed-on: https://go-review.googlesource.com/126897
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/138178
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

5 years ago[release-branch.go1.11] net: concatenate multiple TXT strings in single TXT record
Matthew Waters [Mon, 24 Sep 2018 10:08:54 +0000 (06:08 -0400)]
[release-branch.go1.11] net: concatenate multiple TXT strings in single TXT record

When go resolver was changed to use dnsmessage.Parser, LookupTXT
returned two strings in one record as two different records. This change
reverts back to concatenating multiple strings in a single
TXT record.

Updates #27763
Fixes #27886

Change-Id: Ice226fcb2be4be58853de34ed35b4627acb429ea
Reviewed-on: https://go-review.googlesource.com/136955
Reviewed-by: Ian Gudger <igudger@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Gudger <igudger@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit 7b3b160323b56b357832549fbab7a60d27688ec1)
Reviewed-on: https://go-review.googlesource.com/138177
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
5 years ago[release-branch.go1.11] reflect: fix s390x reflect method calls
Keith Randall [Sun, 30 Sep 2018 16:04:17 +0000 (09:04 -0700)]
[release-branch.go1.11] reflect: fix s390x reflect method calls

R0 isn't the zero register any more. Oops.

Update #27867

Change-Id: I46a975ed37d5e570afe2e228d3edf74949e08ad7
Reviewed-on: https://go-review.googlesource.com/138580
Reviewed-by: Michael Munday <mike.munday@ibm.com>
Reviewed-on: https://go-review.googlesource.com/138583
Run-TryBot: Keith Randall <khr@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years ago[release-branch.go1.11] reflect: ensure correct scanning of return values
Keith Randall [Tue, 25 Sep 2018 22:54:11 +0000 (15:54 -0700)]
[release-branch.go1.11] reflect: ensure correct scanning of return values

During a call to a reflect-generated function or method (via
makeFuncStub or methodValueCall), when should we scan the return
values?

When we're starting a reflect call, the space on the stack for the
return values is not initialized yet, as it contains whatever junk was
on the stack of the caller at the time. The return space must not be
scanned during a GC.

When we're finishing a reflect call, the return values are
initialized, and must be scanned during a GC to make sure that any
pointers in the return values are found and their referents retained.

When the GC stack walk comes across a reflect call in progress on the
stack, it needs to know whether to scan the results or not. It doesn't
know the progress of the reflect call, so it can't decide by
itself. The reflect package needs to tell it.

This CL adds another slot in the frame of makeFuncStub and
methodValueCall so we can put a boolean in there which tells the
runtime whether to scan the results or not.

This CL also adds the args length to reflectMethodValue so the
runtime can restrict its scanning to only the args section (not the
results) if the reflect package says the results aren't ready yet.

Do a delicate dance in the reflect package to set the "results are
valid" bit. We need to make sure we set the bit only after we've
copied the results back to the stack. But we must set the bit before
we drop reflect's copy of the results. Otherwise, we might have a
state where (temporarily) no one has a live copy of the results.
That's the state we were observing in issue #27695 before this CL.

The bitmap used by the runtime currently contains only the args.
(Actually, it contains all the bits, but the size is set so we use
only the args portion.) This is safe for early in a reflect call, but
unsafe late in a reflect call. The test issue27695.go demonstrates
this unsafety. We change the bitmap to always include both args
and results, and decide at runtime which portion to use.

issue27695.go only has a test for method calls. Function calls were ok
because there wasn't a safepoint between when reflect dropped its copy
of the return values and when the caller is resumed. This may change
when we introduce safepoints everywhere.

This truncate-to-only-the-args was part of CL 9888 (in 2015). That
part of the CL fixed the problem demonstrated in issue27695b.go but
introduced the problem demonstrated in issue27695.go.

TODO, in another CL: simplify FuncLayout and its test. stack return
value is now identical to frametype.ptrdata + frametype.gcdata.

Update #27867

Change-Id: I2d49b34e34a82c6328b34f02610587a291b25c5f
Reviewed-on: https://go-review.googlesource.com/137440
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-on: https://go-review.googlesource.com/138582
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years ago[release-branch.go1.11] reflect: use correct write barrier operations for method...
Keith Randall [Tue, 25 Sep 2018 21:32:44 +0000 (14:32 -0700)]
[release-branch.go1.11] reflect: use correct write barrier operations for method funcs

Fix the code to use write barriers on heap memory, and no
write barriers on stack memory.

These errors were discovered as part of fixing #27695. They may
have something to do with that issue, but hard to be sure.
The core cause is different, so this fix is a separate CL.

Update #27867

Change-Id: Ib005f6b3308de340be83c3d07d049d5e316b1e3c
Reviewed-on: https://go-review.googlesource.com/137438
Reviewed-by: Austin Clements <austin@google.com>
(cherry picked from commit e35a41261b19589f40d32bd66274c23ab4b9b32e)
Reviewed-on: https://go-review.googlesource.com/138581
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years ago[release-branch.go1.11] doc: add go1.11 to contrib.html
Chris Broadfoot [Fri, 28 Sep 2018 09:02:22 +0000 (02:02 -0700)]
[release-branch.go1.11] doc: add go1.11 to contrib.html

Missing from https://golang.org/project

Change-Id: I6cb769ae861a81f0264bae624b5fe8d70aa92497
Reviewed-on: https://go-review.googlesource.com/138356
Reviewed-by: Chris Broadfoot <cbro@golang.org>
5 years ago[release-branch.go1.11] cmd/go: add GOMIPS value to build id for mipsle
Ian Lance Taylor [Mon, 27 Aug 2018 03:38:43 +0000 (20:38 -0700)]
[release-branch.go1.11] cmd/go: add GOMIPS value to build id for mipsle

Strip a trailing "le" from the GOARCH value when calculating the GOxxx
environment variable that affects it.

Updates #27260
Fixes #27420

Change-Id: I081f30d5dc19281901551823f4f56be028b5f71a
Reviewed-on: https://go-review.googlesource.com/131379
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 61318d7ffe8a49e9dedc5aa8195a164a3821465c)
Reviewed-on: https://go-review.googlesource.com/138176
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years ago[release-branch.go1.11] net: fail fast for DNS rcode success with no answers of reque...
Ian Gudger [Thu, 6 Sep 2018 06:53:36 +0000 (23:53 -0700)]
[release-branch.go1.11] net: fail fast for DNS rcode success with no answers of requested type

DNS responses which do not contain answers of the requested type return
errNoSuchHost, the same error as rcode name error. Prior to
golang.org/cl/37879, both cases resulted in no additional name servers
being consulted for the question. That CL changed the behavior for both
cases. Issue #25336 was filed about the rcode name error case and
golang.org/cl/113815 fixed it. This CL fixes the no answers of requested
type case as well.

Updates #27525
Fixes #27537

Change-Id: I52fadedcd195f16adf62646b76bea2ab3b15d117
Reviewed-on: https://go-review.googlesource.com/133675
Run-TryBot: Ian Gudger <igudger@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 94f48ddb96c4dfc919ae024f64df19d764f5fb5b)
Reviewed-on: https://go-review.googlesource.com/138175
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years ago[release-branch.go1.11] runtime: ignore races between close and len/cap
Keith Randall [Mon, 17 Sep 2018 19:25:36 +0000 (12:25 -0700)]
[release-branch.go1.11] runtime: ignore races between close and len/cap

They aren't really races, or at least they don't have any
observable effect. The spec is silent on whether these are actually
races or not.

Fix this problem by not using the address of len (or of cap)
as the location where channel operations are recorded to occur.
Use a random other field of hchan for that.

I'm not 100% sure we should in fact fix this. Opinions welcome.

Fixes #27778

Change-Id: Ib4efd4b62e0d1ef32fa51e373035ef207a655084
Reviewed-on: https://go-review.googlesource.com/135698
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
(cherry picked from commit 83dfc3b001245f0b725afdc94c0b540fe1952d21)
Reviewed-on: https://go-review.googlesource.com/138179
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years ago[release-branch.go1.11] net/http: ensure null body in Fetch response is not read
Johan Brandhorst [Fri, 24 Aug 2018 11:10:01 +0000 (12:10 +0100)]
[release-branch.go1.11] net/http: ensure null body in Fetch response is not read

The Fetch API returns a null body if there is no response body,
on browsers that support streaming the response body. This
change ensures we check for both undefined and null bodies
before attempting to read the body.

Fixes #27424

Change-Id: I0da86b61284fe394418b4b431495e715a037f335
Reviewed-on: https://go-review.googlesource.com/131236
Reviewed-by: Richard Musiol <neelance@gmail.com>
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit ce536837d8e53f1bf0c7ef450d4580d19f7d6f52)
Reviewed-on: https://go-review.googlesource.com/136915

5 years ago[release-branch.go1.11] doc/go1.11, cmd/go: elaborate on new GOFLAGS environment...
Dmitri Shuralyov [Wed, 12 Sep 2018 17:58:18 +0000 (13:58 -0400)]
[release-branch.go1.11] doc/go1.11, cmd/go: elaborate on new GOFLAGS environment variable

In Go 1.11, cmd/go gained support for the GOFLAGS environment variable.
It was added and described in detail in CL 126656.
Mention it in the Go 1.11 release notes, link to the cmd/go documentation,
and add more details there.

Fixes #27387.

Change-Id: Ifc35bfe3e0886a145478d36dde8e80aedd8ec68e
Reviewed-on: https://go-review.googlesource.com/135035
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Rob Pike <r@golang.org>
(cherry picked from commit 58c6afe075d74261dd67750e0aab5a1b8460839f)
Reviewed-on: https://go-review.googlesource.com/135496
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years ago[release-branch.go1.11] cmd/compile: prevent overflow in walkinrange
Alberto Donizetti [Wed, 22 Aug 2018 12:01:22 +0000 (14:01 +0200)]
[release-branch.go1.11] cmd/compile: prevent overflow in walkinrange

In the compiler frontend, walkinrange indiscriminately calls Int64()
on const CTINT nodes, even though Int64's return value is undefined
for anything over 2⁶³ (in practise, it'll return a negative number).

This causes the introduction of bad constants during rewrites of
unsigned expressions, which make the compiler reject valid Go
programs.

This change introduces a preliminary check that Int64() is safe to
call on the consts on hand. If it isn't, walkinrange exits without
doing any rewrite.

Fixes #27246

Change-Id: I2017073cae65468a521ff3262d4ea8ab0d7098d9
Reviewed-on: https://go-review.googlesource.com/130735
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
(cherry picked from commit 42cc4ca30a7729a4c6d1bb0bbbc3e4a736ef91c8)
Reviewed-on: https://go-review.googlesource.com/131596
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>

5 years ago[release-branch.go1.11] go/types: handle nil pointer when panic is written outside...
Rebecca Stambler [Thu, 30 Aug 2018 15:33:19 +0000 (11:33 -0400)]
[release-branch.go1.11] go/types: handle nil pointer when panic is written outside of a function

The current implementation crashes when someone writes a panic outside of
a function, which makes sense since that is broken code. This fix allows
one to type-check broken code.

Fixes #27497

Change-Id: I81b90dbd918162a20c60a821340898eaf02e648d
Reviewed-on: https://go-review.googlesource.com/132235
Reviewed-by: Alan Donovan <adonovan@google.com>
(cherry picked from commit c99687f87aed84342cfe92ae78924f791237c6f6)
Reviewed-on: https://go-review.googlesource.com/133395
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years ago[release-branch.go1.11] cmd/compile: count nil check as use in dead auto elim
Cherry Zhang [Tue, 28 Aug 2018 18:52:30 +0000 (14:52 -0400)]
[release-branch.go1.11] cmd/compile: count nil check as use in dead auto elim

Nil check is special in that it has no use but we must keep it.
Count it as a use of the auto.

Fixes #27342.

Change-Id: I857c3d0db2ebdca1bc342b4993c0dac5c01e067f
Reviewed-on: https://go-review.googlesource.com/131955
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit 54f9c0416a588963cb5a1c10ffb6a88f3956858c)
Reviewed-on: https://go-review.googlesource.com/134615
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years ago[release-branch.go1.11] runtime/trace: fix syntax errors in NewTask doc example
Charles Kenney [Mon, 3 Sep 2018 07:02:03 +0000 (07:02 +0000)]
[release-branch.go1.11] runtime/trace: fix syntax errors in NewTask doc example

Fixes #27406

Change-Id: I9c6f5bac5b26558fa7628233c74a62faf676e811
GitHub-Last-Rev: 29d19f719316b486224a15a50556465811985edf
GitHub-Pull-Request: golang/go#27437
Reviewed-on: https://go-review.googlesource.com/132775
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit b794ca64d29f3e584cbdf49bde7141d3c12dd2ab)
Reviewed-on: https://go-review.googlesource.com/134616
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
5 years ago[release-branch.go1.11] crypto/x509: allow ":" in Common Name hostnames
Filippo Valsorda [Fri, 7 Sep 2018 16:58:14 +0000 (12:58 -0400)]
[release-branch.go1.11] crypto/x509: allow ":" in Common Name hostnames

At least one popular service puts a hostname which contains a ":"
in the Common Name field. On the other hand, I don't know of any name
constrained certificates that only work if we ignore such CNs.

Updates #24151

Change-Id: I2d813e3e522ebd65ab5ea5cd83390467a869eea3
Reviewed-on: https://go-review.googlesource.com/134076
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit 03c703697f321f66d28d6223457622c5879ba37f)
Reviewed-on: https://go-review.googlesource.com/134078
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[release-branch.go1.11] cmd/go: add -Wl,--export-dynamic to linker flag whitelist
Ian Lance Taylor [Fri, 7 Sep 2018 11:12:42 +0000 (04:12 -0700)]
[release-branch.go1.11] cmd/go: add -Wl,--export-dynamic to linker flag whitelist

Fixes #27496

Change-Id: I53538c7697729294a9e50ace26a6a7183131e837
Reviewed-on: https://go-review.googlesource.com/134016
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
(cherry picked from commit 7f57e2236d59b96467635c8adb024f9b7b972790)
Reviewed-on: https://go-review.googlesource.com/134056

5 years ago[release-branch.go1.11] runtime: in semasleep, subtract time spent so far from timeout
Keith Randall [Wed, 5 Sep 2018 21:36:20 +0000 (14:36 -0700)]
[release-branch.go1.11] runtime: in semasleep, subtract time spent so far from timeout

When pthread_cond_timedwait_relative_np gets a spurious wakeup
(due to a signal, typically), we used to retry with the same
relative timeout. That's incorrect, we should lower the timeout
by the time we've spent in this function so far.

In the worst case, signals come in and cause spurious wakeups
faster than the timeout, causing semasleep to never time out.

Also fix nacl and netbsd while we're here. They have similar issues.

Fixes #27521

Change-Id: I6601e120e44a4b8ef436eef75a1e7c8cf1d39e39
Reviewed-on: https://go-review.googlesource.com/133655
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 2bf1370f4369d75f4fffffc6fc05722bce13481b)
Reviewed-on: https://go-review.googlesource.com/134096

5 years ago[release-branch.go1.11] cmd/compile: in prove, fix fence-post implications for unsign...
Giovanni Bajo [Fri, 31 Aug 2018 00:15:26 +0000 (02:15 +0200)]
[release-branch.go1.11] cmd/compile: in prove, fix fence-post implications for unsigned domain

Fence-post implications of the form "x-1 >= w && x > min ⇒ x > w"
were not correctly handling unsigned domain, by always checking signed
limits.

This bug was uncovered once we taught prove that len(x) is always
>= 0 in the signed domain.

In the code being miscompiled (s[len(s)-1]), prove checks
whether len(s)-1 >= len(s) in the unsigned domain; if it proves
that this is always false, it can remove the bound check.

Notice that len(s)-1 >= len(s) can be true for len(s) = 0 because
of the wrap-around, so this is something prove should not be
able to deduce.

But because of the bug, the gate condition for the fence-post
implication was len(s) > MinInt64 instead of len(s) > 0; that
condition would be good in the signed domain but not in the
unsigned domain. And since in CL105635 we taught prove that
len(s) >= 0, the condition incorrectly triggered
(len(s) >= 0 > MinInt64) and things were going downfall.

Fixes #27378

Change-Id: I3dbcb1955ac5a66a0dcbee500f41e8d219409be5
Reviewed-on: https://go-review.googlesource.com/132495
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit 09ea3c08e8fd1915515383f8cb4c0bb237d2b87d)
Reviewed-on: https://go-review.googlesource.com/132575
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[release-branch.go1.11] net: refactor readerAtEOF splice test
Andrei Tudor Călin [Thu, 30 Aug 2018 04:55:05 +0000 (06:55 +0200)]
[release-branch.go1.11] net: refactor readerAtEOF splice test

Refactor TestSplice/readerAtEOF to handle cases where we disable
splice on older kernels better.

If splice is disabled, net.splice and poll.Splice do not get to
observe EOF on the reader, because poll.Splice returns immediately
with EINVAL. The test fails unexpectedly, because the splice operation
is reported as not handled.

This change refactors the test to handle the aforementioned case
correctly, by not calling net.splice directly, but using a higher
level check.

Fixes #27355.

Change-Id: I0d5606b4775213f2dbbb84ef82ddfc3bab662a31
Reviewed-on: https://go-review.googlesource.com/132096
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit bd49b3d580731d8f391e40fb9e2f17301651cede)
Reviewed-on: https://go-review.googlesource.com/132281
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[release-branch.go1.11] doc: add Go 1.11 to release history page
Joe Cortopassi [Thu, 30 Aug 2018 03:20:00 +0000 (03:20 +0000)]
[release-branch.go1.11] doc: add Go 1.11 to release history page

Fixes #27357

Change-Id: I048fbd88a08e8b17fcda3872ee4c78935d5075d8
GitHub-Last-Rev: a0751eca094d68e9bf005abeb6616eb5b0050190
GitHub-Pull-Request: golang/go#27359
Reviewed-on: https://go-review.googlesource.com/132117
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit d8067d1da60fb890ba656321e1f293bf7b9ee7f7)
Reviewed-on: https://go-review.googlesource.com/132118
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[release-branch.go1.11] cmd/go: don't let script grep commands match $WORK
Ian Lance Taylor [Sat, 25 Aug 2018 17:11:19 +0000 (10:11 -0700)]
[release-branch.go1.11] cmd/go: don't let script grep commands match $WORK

If $WORK happens to contain the string that a stdout/stderr/grep
command is searching for, a negative grep command will fail incorrectly.

Fixes #27170
Fixes #27221

Change-Id: I84454d3c42360fe3295c7235d388381525eb85b4
Reviewed-on: https://go-review.googlesource.com/131398
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
(cherry picked from commit e3106b455b74c91db94e8e1abf2342b5b5aec7b1)
Reviewed-on: https://go-review.googlesource.com/131399
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.11] doc/go1.11: fix typo
Shenghou Ma [Fri, 24 Aug 2018 22:44:17 +0000 (18:44 -0400)]
[release-branch.go1.11] doc/go1.11: fix typo

Change-Id: I097bd90f62add7838f8c7baf3b777ad167635354
Reviewed-on: https://go-review.googlesource.com/131357
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit 02367105e608bb7c92fab06c9cbdcd94f5dd2704)
Reviewed-on: https://go-review.googlesource.com/131281
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.11] runtime: mark sigInitIgnored nosplit go1.11
Ian Lance Taylor [Fri, 24 Aug 2018 18:44:55 +0000 (11:44 -0700)]
[release-branch.go1.11] runtime: mark sigInitIgnored nosplit

The sigInitIgnored function can be called by initsig before a shared
library is initialized, before the runtime is initialized.

Fixes #27183

Change-Id: I7073767938fc011879d47ea951d63a14d1cce878
Reviewed-on: https://go-review.googlesource.com/131277
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit d20ecd6e5dab55376ea4f169eed63608f9bb3b2b)
Reviewed-on: https://go-review.googlesource.com/131278
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.11] go1.11
Andrew Bonventre [Fri, 24 Aug 2018 19:55:36 +0000 (15:55 -0400)]
[release-branch.go1.11] go1.11

Change-Id: Ifd0090a7fee96ae726a84aeece7512b967acf869
Reviewed-on: https://go-review.googlesource.com/131338
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[release-branch.go1.11] doc: document Go 1.10.4
Andrew Bonventre [Fri, 24 Aug 2018 19:20:33 +0000 (15:20 -0400)]
[release-branch.go1.11] doc: document Go 1.10.4

Change-Id: I7383e7d37a71defcad79fc662c4b4d1ca02189d1
Reviewed-on: https://go-review.googlesource.com/131336
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 97cc4b5123a71193cbb207a40a14b9025e769ec7)
Reviewed-on: https://go-review.googlesource.com/131356
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[release-branch.go1.11] doc/go1.11: add link to new WebAssembly wiki page
Dmitri Shuralyov [Thu, 23 Aug 2018 19:05:19 +0000 (15:05 -0400)]
[release-branch.go1.11] doc/go1.11: add link to new WebAssembly wiki page

The wiki page has recently been created, and at this time it's
just a stub. It's expected that support for WebAssembly will be
evolving over time, and the wiki page can be kept updated with
helpful information, how to get started, tips and tricks, etc.

Use present tense because it's expected that there will be more
general information added by the time Go 1.11 release happens.

Also add link to https://webassembly.org/ in first paragraph.

Change-Id: I139c2dcec8f0d7fd89401df38a3e12960946693f
Reviewed-on: https://go-review.googlesource.com/131078
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 6e76aeba0bda33f6bd45ac9c8e5c026c1688e846)
Reviewed-on: https://go-review.googlesource.com/131096

5 years ago[release-branch.go1.11] doc/go1.11: remove draft status
Andrew Bonventre [Thu, 23 Aug 2018 18:31:32 +0000 (14:31 -0400)]
[release-branch.go1.11] doc/go1.11: remove draft status

Change-Id: I3f99083b7d8ab06482c2c22eafda8b0141a872bd
Reviewed-on: https://go-review.googlesource.com/131076
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 2e10e28a10c77d4967cc03bbbf0929600b89440c)
Reviewed-on: https://go-review.googlesource.com/131095
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[release-branch.go1.11] go1.11rc2 go1.11rc2
Andrew Bonventre [Wed, 22 Aug 2018 22:04:16 +0000 (18:04 -0400)]
[release-branch.go1.11] go1.11rc2

Change-Id: Ib303cf7c8965d1d004f4c9e4935f9d4d54c5ee37
Reviewed-on: https://go-review.googlesource.com/130935
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[release-branch.go1.11] internal/poll, net: fix sendfile on Windows, add test
Brad Fitzpatrick [Wed, 22 Aug 2018 20:31:37 +0000 (20:31 +0000)]
[release-branch.go1.11] internal/poll, net: fix sendfile on Windows, add test

Fixes #27085

Change-Id: I4eb3ff7c76e0b8e4d8fe0298f739b0284d74a031
Reviewed-on: https://go-review.googlesource.com/130895
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[release-branch.go1.11] crypto/tls: make ConnectionState.ExportKeyingMaterial a method
Filippo Valsorda [Tue, 21 Aug 2018 20:50:04 +0000 (14:50 -0600)]
[release-branch.go1.11] crypto/tls: make ConnectionState.ExportKeyingMaterial a method

The unexported field is hidden from reflect based marshalers, which
would break otherwise. Also, make it return an error, as there are
multiple reasons it might fail.

Fixes #27131

Change-Id: I92adade2fe456103d2d5c0315629ca0256953764
Reviewed-on: https://go-review.googlesource.com/130535
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 240cb4c75fbe969364edb1a7f7ebd2d827831d34)
Reviewed-on: https://go-review.googlesource.com/130655

5 years ago[release-branch.go1.11] cmd/go: fix list -compiled of package with only tests
Russ Cox [Tue, 21 Aug 2018 01:35:02 +0000 (21:35 -0400)]
[release-branch.go1.11] cmd/go: fix list -compiled of package with only tests

Fixes #27097.

Change-Id: I6aa48a1c58a21fd320b0e9dcd1f86c90172f0182
Reviewed-on: https://go-review.googlesource.com/130139
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit df6aedb630b3c79ff50147a85278a17702dcff1f)
Reviewed-on: https://go-review.googlesource.com/130617
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[release-branch.go1.11] cmd/go: fix 'go help go.mod' example
Russ Cox [Tue, 21 Aug 2018 01:42:02 +0000 (21:42 -0400)]
[release-branch.go1.11] cmd/go: fix 'go help go.mod' example

Dropped the example referred to in the text
when copying this text out of 'go help mod fix'.

Fixes #27083.

Change-Id: I63dfa3033fa2b2408019eef9d8b5a055aa803c57
Reviewed-on: https://go-review.googlesource.com/130140
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 27ed675b4bbb63b5b5d84a21be583ef6147a2084)
Reviewed-on: https://go-review.googlesource.com/130618
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[release-branch.go1.11] cmd/go: add go.sum entries to go mod download -json output
Russ Cox [Sat, 18 Aug 2018 18:16:26 +0000 (14:16 -0400)]
[release-branch.go1.11] cmd/go: add go.sum entries to go mod download -json output

Clients of 'go mod download', particularly proxies, may need
the hashes of the content they downloaded, for checking against
go.sum entries or recording elsewhere.

Change-Id: Ic36c882cefc540678e1bc5a3dae1e865d181aa69
Reviewed-on: https://go-review.googlesource.com/129802
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
(cherry picked from commit 46033d7639cb1399029b99bb0cdc53d2b8f4bd08)
Reviewed-on: https://go-review.googlesource.com/130615
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.11] cmd/go: fix modload response for std-vendored packages
Russ Cox [Tue, 21 Aug 2018 01:25:01 +0000 (21:25 -0400)]
[release-branch.go1.11] cmd/go: fix modload response for std-vendored packages

This fixes a failure when using Go 1.11 to build App Engine code.

Change-Id: I008e8cf5ad4c568676d904deddff031a166f2d5d
Reviewed-on: https://go-review.googlesource.com/130138
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit c652a1b9c041a2d359665f01de21b19d53ba5ce5)
Reviewed-on: https://go-review.googlesource.com/130616
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[release-branch.go1.11] cmd/go: fix modload infinite directory loop
Daniel Martí [Sun, 19 Aug 2018 12:53:57 +0000 (13:53 +0100)]
[release-branch.go1.11] cmd/go: fix modload infinite directory loop

It is possible to enter the parent-walking directory loop in a way that
it will loop forever - if mdir is empty, and d reaches ".". To avoid
this, make sure that the 'd = filepath.Dir(d)' step only happens if the
parent directory is actually different than the current directory.

This fixes some of the tests like TestImport/golang.org_x_net_context,
which were never finishing before.

While at it, also fix TestImport/golang.org_x_net, which seems to have
the wrong expected error. The root of the x/net repo doesn't have a
go.mod file, nor is part of a module itself, so it seems like the
expected error should reflect that.

After these two changes, 'go test cmd/go/internal/modload' passes on my
linux/amd64 machine.

Fixes #27080.

Change-Id: Ie8bab0f9fbc9f447844cbbc64117420d9087db1b
Reviewed-on: https://go-review.googlesource.com/129778
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 692307aa839252285ebb91b4072e3c05ff554341)
Reviewed-on: https://go-review.googlesource.com/130275
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[release-branch.go1.11] Merge branch 'master' into release-branch.go1.11
Brad Fitzpatrick [Mon, 20 Aug 2018 04:32:00 +0000 (04:32 +0000)]
[release-branch.go1.11] Merge branch 'master' into release-branch.go1.11

Change-Id: I4f09f847c7304e37df8388b45aa8d6281a677de3

5 years agocmd/go: add missing newlines in printf formats
Daniel Martí [Sun, 19 Aug 2018 14:58:35 +0000 (15:58 +0100)]
cmd/go: add missing newlines in printf formats

These are all errors given by module-aware cmd/go, so they must end with
a newline. It looks like they were omitted by mistake.

Fixes #27081.

Change-Id: I19b5803bb48a6d5dd52e857f483278fe20fe246b
Reviewed-on: https://go-review.googlesource.com/129780
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc/go1.11: Delve 1.1.0 added support for method calls
Austin Clements [Sat, 18 Aug 2018 18:50:50 +0000 (14:50 -0400)]
doc/go1.11: Delve 1.1.0 added support for method calls

Change-Id: I5f887f9831378cf76f5a9f447f481ea24c63f390
Reviewed-on: https://go-review.googlesource.com/129803
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: fix module get -insecure
Russ Cox [Sat, 18 Aug 2018 04:42:58 +0000 (00:42 -0400)]
cmd/go: fix module get -insecure

Need to actually use the flag for it to take effect.

Fixes #27049.

Change-Id: I57227b45f46f9dd67ecbf87c11bb2d08124bcfa0
Reviewed-on: https://go-review.googlesource.com/129801
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go/internal/modconv: fix TestConvertLegacyConfig expectations
Russ Cox [Sat, 18 Aug 2018 04:41:52 +0000 (00:41 -0400)]
cmd/go/internal/modconv: fix TestConvertLegacyConfig expectations

It was a bug to find that commit in the Masterminds/semver repo.
It's not part of the main repo but only part of an unmerged pull request.
The code was updated to try not to look at unmerged pull requests,
but the test was not. Worse, whether the code succeeds at not looking
at unmerged pull requests apparently depends on the git version.
Sigh.

Fixes #26754.
Fixes #27043.

Change-Id: Ib9e07f565906de4f1169244911a258396688f14d
Reviewed-on: https://go-review.googlesource.com/129800
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: fix go mod tidy crash on empty module
Russ Cox [Sat, 18 Aug 2018 03:08:24 +0000 (23:08 -0400)]
cmd/go: fix go mod tidy crash on empty module

Fixes #27066.

Change-Id: Iede4385ad86b42d7d90814965b161a7e64d29833
Reviewed-on: https://go-review.googlesource.com/129799
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: allow 'go run x.go' to use nearby internal imports in module mode
Russ Cox [Sat, 18 Aug 2018 02:32:22 +0000 (22:32 -0400)]
cmd/go: allow 'go run x.go' to use nearby internal imports in module mode

In GOPATH mode the rule has always been that 'go run x.go' can
import whatever the package in x.go's directory would be able to
import. Apply the same rule here.

The bad import path was triggering other mysterious errors
during 'go run' in other circumstances. Setting it correctly fixes
those too.

Fixes #26046.
Fixes #27022.

Change-Id: I0a9b0a154a20f48add5a199da85572e7ffe0cde4
Reviewed-on: https://go-review.googlesource.com/129798
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: fix and reenable TestAccidentalGitCheckout
Russ Cox [Sat, 18 Aug 2018 01:25:52 +0000 (21:25 -0400)]
cmd/go: fix and reenable TestAccidentalGitCheckout

This is an important security problem so we shouldn't disable the test.
The second half was failing on case-sensitive file systems but the
first half is still good.

Fixes #22983.

Change-Id: I437bb4c9f78eb3177aa8b619e2357b2539566ca9
Reviewed-on: https://go-review.googlesource.com/129797
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: update TestGoGetUpdateWithWildcard expected behavior
Russ Cox [Sat, 18 Aug 2018 01:10:19 +0000 (21:10 -0400)]
cmd/go: update TestGoGetUpdateWithWildcard expected behavior

If you run

go get -u github.com/rsc/foo/bar...

then the go get command has always worked hard to make sure
that it applies the wildcard after downloading rsc/foo.
(If it applied the wildcard only before downloading rsc/foo,
it would match nothing if you had an empty GOPATH before,
and you'd still have an empty afterward, which is clearly useless.)

The goal has always been that if you run the same go get
command twice, the second command doesn't find anything
new to do.

CL 19892 worked around an "internal error" failure but broke
the rule about the first command doing everything the second
command would. Suppose you had github.com/rsc/foo already,
with just github.com/rsc/foo/bar, and you run

go get -u github.com/rsc/...

The wildcard first matches github.com/rsc/foo/bar, but suppose
updating the repo pulls down github.com/rsc/foo/baz, which
in turn depends on the non-existent package github.com/rsc/quux.
We need to reevaluate the wildcard after the download.

The new pattern match refactoring makes this easier and happened
to have corrected the behavior, but we missed a long test that
expected the old behavior.

Fix that long test.

Change-Id: I088473e7a90925e5c0f9697da9554a11456ddd08
Reviewed-on: https://go-review.googlesource.com/129796
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: treat VCS errors as hard errors in module search
Russ Cox [Fri, 17 Aug 2018 19:40:55 +0000 (15:40 -0400)]
cmd/go: treat VCS errors as hard errors in module search

If we're looking for a module for a/b/c/d/e,
we check for a module named a/b/c/d/e,
then a/b/c/d, then a/b/c, then a/b, then a.
If we know the source repo for a/b/c and that
fails, we should report that error instead of
continuing the loop: a/b and a are useless,
and the error from a/b/c contains important
information.

The errors are now a bit more verbose than
I'd like but they will suffice for Go 1.11.

$ go get github.com/bradfitz/private/sonos
go get github.com/bradfitz/private/sonos: git ls-remote -q origin in /Users/rsc/pkg/mod/cache/vcs/61e3c76780847e514802ec6af8f940f641c6017f711444f05c59cb17ac46d456: exit status 128:
remote: Repository not found.
fatal: repository 'https://github.com/bradfitz/private/' not found
$ go list launchpad.net/gocheck
can't load package: package launchpad.net/gocheck: unknown import path "launchpad.net/gocheck": bzr branch --use-existing-dir https://launchpad.net/~niemeyer/gocheck/trunk . in /Users/rsc/pkg/mod/cache/vcs/f46ce2ae80d31f9b0a29099baa203e3b6d269dace4e5357a2cf74bd109e13339: exec: "bzr": executable file not found in $PATH
$

Fixes #26885.
Fixes #26982.

Change-Id: I2f9cf1853d2d68af18adad668c80513b6ba220d6
Reviewed-on: https://go-review.googlesource.com/129683
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: remove go mod fix, add go help go.mod
Russ Cox [Fri, 17 Aug 2018 18:47:31 +0000 (14:47 -0400)]
cmd/go: remove go mod fix, add go help go.mod

"go mod fix" does work already done by nearly every other go command.
It was also confusing why we had both "go mod fix" and "go mod tidy".
Delete "go mod fix".

The main reason we kept "go mod fix" this long was for the discussion
of automatic go.mod updates in its documentation, which is now moved
into a new "go help go.mod".

Fixes #26831.

Change-Id: Ic95ca8918449ab79791d27998e02eb3377ac7972
Reviewed-on: https://go-review.googlesource.com/129682
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go/internal/modfetch: correct TestCodeRepo expectation
Russ Cox [Fri, 17 Aug 2018 19:53:35 +0000 (15:53 -0400)]
cmd/go/internal/modfetch: correct TestCodeRepo expectation

The proxy protocol was simplified to only send
(and only receive) the Path and Version fields
in the JSON blob, not Name and Short.
(Those make sense when querying a VCS repo directly,
but not when talking about extracted modules.)
So don't expect them in the test.

Fixes #27042.

Change-Id: I3daacd668126e2227dcc8e6b89ee0cf0e3c8497c
Reviewed-on: https://go-review.googlesource.com/129684
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoos: handle TMPDIR in TempDir on Plan 9
David du Colombier [Fri, 17 Aug 2018 22:05:46 +0000 (00:05 +0200)]
os: handle TMPDIR in TempDir on Plan 9

CL 129063 added a test in TestScript/mod_enabled,
which was failing on Plan 9.

The test was failing because the Init function
of the cmd/go/internal/modload package was
expecting ModRoot to be part of os.TempDir.

However, ModRoot was set to TMPDIR, while
os.TempDir is returning /tmp on Plan 9.

This change fixes the implementation of
os.TempDir on Plan 9 to handle the TMPDIR
environment variable, similarly to Unix.

Fixes #27065.

Change-Id: Id6ff926c5c379f63cab2dfc378fa6c15293fd453
Reviewed-on: https://go-review.googlesource.com/129775
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: do not turn list ./nonexist into a network lookup
Russ Cox [Fri, 10 Aug 2018 20:28:48 +0000 (16:28 -0400)]
cmd/go: do not turn list ./nonexist into a network lookup

If you're in a directory corresponding to x/y
and you run go list ./z, we do at some point
want to turn that into x/y/z. But if ./z does
not exist that will make the go command
check the network to see if it can find x/y/z.
That's clearly wrong: ./z means that directory,
nothing else. And it turns a typo into a long delay,
which is even worse.

Fixes #26874.

Change-Id: Iec15fa7b359af11b6a4fc6cb082e593658fb6e41
Reviewed-on: https://go-review.googlesource.com/129061
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
5 years agocmd/go: report which patterns match each package in list
Russ Cox [Fri, 17 Aug 2018 16:40:18 +0000 (12:40 -0400)]
cmd/go: report which patterns match each package in list

It's important for some uses of go/packages, as well as for some
of go/packages's internal use, to be able to tell which results from
go list output correspond to which patterns, keeping in mind that
a single package might have been matched by multiple patterns.

Also adds test for #26925.

Change-Id: I708ac162f65d9946fe6afb244b08dc7b04d2b530
Reviewed-on: https://go-review.googlesource.com/129060
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
5 years agocmd/go: fix -gcflags, -ldflags not applying to current directory
Russ Cox [Fri, 10 Aug 2018 04:01:48 +0000 (00:01 -0400)]
cmd/go: fix -gcflags, -ldflags not applying to current directory

A flag setting like -gcflags=-e applies only to the packages
named on the command line, not to their dependencies.
The way we used to implement this was to remember the
command line arguments, reinterpret them as pattern matches
instead of package argument generators (globs), and apply them
during package load. The reason for this complexity was to
address a command-line like:

go build -gcflags=-e fmt runtime

The load of fmt will load dependencies, including runtime,
and the load of runtime will reuse the result of the earlier load.
Because we were computing the effective -gcflags for each
package during the load, we had to have a way to tell, when
encountering runtime during the load of fmt, that runtime had
been named on the command line, even though we hadn't
gotten that far. That would be easy if the only possible
arguments were import paths, but we also need to handle

go build -gcflags=-e fmt runt...
go build -gcflags=-e fmt $GOROOT/src/runtime
go build -gcflags=-e fmt $GOROOT/src/runt...
and so on.

The match predicates usually did their job well, but not
always. In particular, thanks to symlinks and case-insensitive
file systems and unusual ways to spell file paths, it's always
been possible in various corner cases to give an argument
that evalutes to the runtime package during loading but
failed to match it when reused to determine "was this package
named on the command line?"

CL 109235 fixed one instance of this problem by making
a directory pattern match case-insensitive on Windows, but that
is incorrect in some other cases and doesn't address the root problem,
namely that there will probably always be odd corner cases
where pattern matching and pattern globbing are not exactly aligned.

This CL eliminates the assumption that pattern matching
and pattern globbing are always completely in agreement,
by simply marking the packages named on the command line
after the package load returns them. This means delaying
the computation of tool flags until after the load too,
for a few different ways packages are loaded.
The different load entry points add some complexity,
which is why the original approach seemed more attractive,
but the original approach had complexity that we simply
didn't recognize at the time.

This CL then rolls back the CL 109235 pattern-matching change,
but it keeps the test introduced in that CL. That test still passes.

In addition to fixing ambiguity due to case-sensitive file systems,
this new approach also very likely fixes various ambiguities that
might arise from abuse of symbolic links.

Fixes #24232.
Fixes #24456.
Fixes #24750.
Fixes #25046.
Fixes #25878.

Change-Id: I0b09825785dfb5112fb11494cff8527ebf57966f
Reviewed-on: https://go-review.googlesource.com/129059
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
5 years agocmd/go: distinguish patterns from the results of matching them
Russ Cox [Fri, 10 Aug 2018 17:26:32 +0000 (13:26 -0400)]
cmd/go: distinguish patterns from the results of matching them

To date the go command has always just treated the command line
package patterns as a []string, expanded by pattern matching into
another []string. As a result, the code is not always clear about
whether a particular []string contains patterns or results.
A few different important bugs are caused by not keeping
this distinction clear enough. This CL sets us up well for fixing those,
by introducing an explicit search.Match struct holding the
results of matching a single pattern.

The added clarity here also makes it clear how to avoid duplicate
warnings about unmatched packages.

Fixes #26925. (Test in followup CL.)

Change-Id: Ic2f0606f7ab8b3734a40e22d3cb1e6f58d031061
Reviewed-on: https://go-review.googlesource.com/129058
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
5 years agodoc: describe golang.org/x/go/packages in go1.11 release notes
Alan Donovan [Thu, 16 Aug 2018 20:31:45 +0000 (16:31 -0400)]
doc: describe golang.org/x/go/packages in go1.11 release notes

Also, rename an HTML element ID to avoid duplicate.

Fixes golang/go#27038

Change-Id: Icc064a1cc86ddc794fc085d98b4cde3effff8ad0
Reviewed-on: https://go-review.googlesource.com/129635
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
5 years agogo/doc: allow interior dot in heading, as in "go.mod"
Russ Cox [Fri, 17 Aug 2018 14:51:53 +0000 (10:51 -0400)]
go/doc: allow interior dot in heading, as in "go.mod"

Only the expected headings are affected.
Diffing the output of "go run headscan.go" before and after:

$ diff head1 head2
26a27,28
>  Edit go.mod from tools or scripts
>  Make go.mod semantically consistent
168c170
< 141 headings found
---
> 143 headings found
$

Fixes #26938.

Change-Id: I204fd982a60773aa26880cd19eed890c373b8ab6
Reviewed-on: https://go-review.googlesource.com/129677
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc/code: drop mentions of GOPATH/pkg directory
Russ Cox [Fri, 17 Aug 2018 15:07:30 +0000 (11:07 -0400)]
doc/code: drop mentions of GOPATH/pkg directory

It's already half gone and later will be all gone.
It's not worth explaining in an introduction doc.

Fixes #24506
Updates #4719

Change-Id: Ie48128b3aa090d84e0e734aa45f14a4480292913
Reviewed-on: https://go-review.googlesource.com/129679
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/vet: don't suggest ... if it breaks a program
Daniel Martí [Thu, 16 Aug 2018 13:39:13 +0000 (14:39 +0100)]
cmd/vet: don't suggest ... if it breaks a program

It is possible to write a function that seems to wrap a print/printf
call, but then doesn't. For example, if the string parameter we thought
was the format is used as another argument.

One option would be to make vet's print analysis smarter, to detect when
format strings are indeed used like we initially suspected.

However, I've opted for a simpler solution - check if the print/printf
call is already using more than one variadic argument, in which case
using an ellipsis in the last one would break the program:

// too many arguments in call to fmt.Printf
fmt.Printf(format, arg0, args...)

Fixes #26979.

Change-Id: I39371f1cec8483cfd2770a91670c1e80cbb9efdf
Reviewed-on: https://go-review.googlesource.com/129575
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agocmd/compile: make duplicate anonymous interface output deterministic
Dan Johnson [Wed, 15 Aug 2018 23:48:44 +0000 (16:48 -0700)]
cmd/compile: make duplicate anonymous interface output deterministic

Ranging through a map is non-deterministic and there can be duplicate
entries in the set (with the same name) which don't have identical
definitions in some cases.

Fixes #27013

Change-Id: I378c48bc359c10b25b9238e0c663b498455b19fd
Reviewed-on: https://go-review.googlesource.com/129515
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agocmd/go: document import "C" check from CL 129062
Russ Cox [Fri, 17 Aug 2018 14:54:20 +0000 (10:54 -0400)]
cmd/go: document import "C" check from CL 129062

Added this locally but then broke the first rule of Gerrit
and clicked Submit instead of running "git submit".

Change-Id: I83c28d9151c566e9b2092e2613d67731a5d64beb
Reviewed-on: https://go-review.googlesource.com/129678
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agocmd/go: ignore import "C" files in module loader in non-cgo mode
Russ Cox [Sat, 11 Aug 2018 00:05:44 +0000 (20:05 -0400)]
cmd/go: ignore import "C" files in module loader in non-cgo mode

Obviously, including files that import "C" when cgo is disabled is wrong.
The package load step correctly excludes them and finds no files at all,
which then causes a failure.

Fixes #26927.

Change-Id: I00e6d6450e783d467d20bde99e91240ecb0db837
Reviewed-on: https://go-review.googlesource.com/129062
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: David du Colombier <0intro@gmail.com>
5 years agocmd/go: ignore /tmp/go.mod
Russ Cox [Sat, 11 Aug 2018 00:22:21 +0000 (20:22 -0400)]
cmd/go: ignore /tmp/go.mod

Two different people have created /tmp/go.mod for experimentation
and then had other tests that create fresh work directories
below /tmp fail unexpectedly because the go command finds
/tmp/go.mod. Refuse to use /tmp/go.mod. /tmp/anything/go.mod is fine.

Fixes #26708.

Change-Id: I2a4f61ea63099cff59fbf9e8798e5dcefefd5557
Reviewed-on: https://go-review.googlesource.com/129063
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: disable TestAccidentalGitCheckout for now
Brad Fitzpatrick [Thu, 16 Aug 2018 16:54:11 +0000 (09:54 -0700)]
cmd/go: disable TestAccidentalGitCheckout for now

It seems it might not have ever worked.

Updates #22983

Change-Id: Icc022539aa2555486a65900abf97dfa30f92a1ea
Reviewed-on: https://go-review.googlesource.com/129615
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agoruntime: load errno as signed 32-bit
Keith Randall [Wed, 15 Aug 2018 23:21:00 +0000 (16:21 -0700)]
runtime: load errno as signed 32-bit

the function libc_errno returns a pointer to a signed-32 bit quantity,
not a 64-bit quantity.

Fixes #27004

Change-Id: I0623835ee34fd9655532251f096022a5accb58cd
Reviewed-on: https://go-review.googlesource.com/129475
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: fix typos in go help mod subpages
Alberto Donizetti [Thu, 16 Aug 2018 14:55:32 +0000 (16:55 +0200)]
cmd/go: fix typos in go help mod subpages

mkalldocs.sh was run and it also picked up a doc change introduced in
CL 128935, where it wasn't run.

Fixes #27030

Change-Id: Ie13fdb71cd7d5481366a02eb711ca48f094026fd
Reviewed-on: https://go-review.googlesource.com/129576
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agogo/printer: consider empty lines in table layout computation
Robert Griesemer [Tue, 14 Aug 2018 00:57:39 +0000 (17:57 -0700)]
go/printer: consider empty lines in table layout computation

In previous versions of Go including 1.10, an empty line would break the
alignment of elements within an expression list.

golang.org/cl/104755 changed the heuristic, with the side effect that
empty lines no longer broke the table alignment.

A prior fix (https://go-review.googlesource.com/c/go/+/125260, reverted)
introduced another regression (#26930) which this change doesn't produce.

Added test cases for both #26352 and #26930.

Fixes #26352.
Updates #26930.

Change-Id: I371f48e6f3620ebbab53f2128ec5e58bcd4a62f1
Reviewed-on: https://go-review.googlesource.com/129256
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Alan Donovan <adonovan@google.com>
5 years agoruntime: go fmt runtime2.go
Martin Möhrmann [Sat, 28 Jul 2018 14:46:22 +0000 (16:46 +0200)]
runtime: go fmt runtime2.go

Change-Id: I29a6125c9ef285fc365c4e11ab158b79224ae333
Reviewed-on: https://go-review.googlesource.com/126602
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agogo/printer: revert "make empty lines break table alignment"
Robert Griesemer [Tue, 14 Aug 2018 00:25:49 +0000 (17:25 -0700)]
go/printer: revert "make empty lines break table alignment"

This reverts commit c116265eb3f2b1a8549e7ceef73b780439404030.

The change, while addressing issue #26352, introduced another
regression (#26930), which is worse. Reverting this change in
favor of a better fix for the original issue.

Updates #26352.
Fixes #26930.

Change-Id: I71ad12a8212992cce5c1e73907d1f7460f98d9e8
Reviewed-on: https://go-review.googlesource.com/129255
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile/internal/gc: add nil check for closure call on wasm
Richard Musiol [Sun, 5 Aug 2018 16:52:15 +0000 (18:52 +0200)]
cmd/compile/internal/gc: add nil check for closure call on wasm

This commit adds an explicit nil check for closure calls on wasm,
so calling a nil func causes a proper panic instead of crashing on the
WebAssembly level.

Change-Id: I6246844f316677976cdd420618be5664444c25ae
Reviewed-on: https://go-review.googlesource.com/127759
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years ago[release-branch.go1.11] go1.11rc1 go1.11rc1
Filippo Valsorda [Mon, 13 Aug 2018 22:08:35 +0000 (18:08 -0400)]
[release-branch.go1.11] go1.11rc1

Change-Id: I3bb2ad8f9f7283d76aa7d8999aa08c9f740c7b5d
Reviewed-on: https://go-review.googlesource.com/129236
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agonet/http: support configuring fetch options
Johan Brandhorst [Fri, 3 Aug 2018 14:48:16 +0000 (14:48 +0000)]
net/http: support configuring fetch options

The default WASM RoundTripper is implemented using
the browser Fetch API. Some options don't readily map to
existing http.Request options, so we use the precedent
set by the TrailerPrefix constant to allow a user to configure
the "mode" and "credentials" options by supplying them
as headers in the http.Request.

Updates #26769

Change-Id: If42d24418c4ffb17211f57e36708cf460fb4c579
GitHub-Last-Rev: b230502084d628938cd50818d3d336f9f911d48d
GitHub-Pull-Request: golang/go#26784
Reviewed-on: https://go-review.googlesource.com/127718
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agonet/http: update request cancelation docs
Brad Fitzpatrick [Mon, 13 Aug 2018 16:00:34 +0000 (16:00 +0000)]
net/http: update request cancelation docs

Fixes #26101

Change-Id: Id4def032b846257d2de992b7561ac90a17e08b91
Reviewed-on: https://go-review.googlesource.com/129155
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agodoc: update the primary security coordinator to filippo@
Filippo Valsorda [Sun, 12 Aug 2018 20:00:58 +0000 (16:00 -0400)]
doc: update the primary security coordinator to filippo@

Fixes #26876

Change-Id: Ibef4e305bead1432c6a02bc2507f8000c2f4b892
Reviewed-on: https://go-review.googlesource.com/129064
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoA+C: second and final round of updates for Go 1.11
Filippo Valsorda [Thu, 9 Aug 2018 20:10:41 +0000 (16:10 -0400)]
A+C: second and final round of updates for Go 1.11

Updates #12042

Change-Id: Ia8d2214caad50560c4d46d723f8b94c954059b98
Reviewed-on: https://go-review.googlesource.com/128877
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: don't let ... match GOROOT/src/cmd in module mode
Russ Cox [Fri, 10 Aug 2018 19:25:15 +0000 (15:25 -0400)]
cmd/go: don't let ... match GOROOT/src/cmd in module mode

GOROOT/src/cmd uses GOROOT/src/cmd/vendor, which module
mode simply cannot handle.

Exposed by making ... match the standard library, which it still should.

But for now it's fine to just exclude commands.

Change-Id: I2201b94445f11239022de8a2473aa3b573f405c0
Reviewed-on: https://go-review.googlesource.com/129055
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: report implicit cgo inputs in go list -compiled
Russ Cox [Fri, 10 Aug 2018 03:44:43 +0000 (23:44 -0400)]
cmd/go: report implicit cgo inputs in go list -compiled

Tools using go list -compiled expect to see an Imports list
that includes all the imports in CompiledGoFiles.
Make sure the list includes the cgo-generated imports.

Fixes #26136.

Change-Id: I6cfe14063f8edfe65a7af37522c7551272115b82
Reviewed-on: https://go-review.googlesource.com/128935
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>