]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
2 years ago[release-branch.go1.17] go1.17rc1 go1.17rc1
Cherry Mui [Tue, 13 Jul 2021 16:26:10 +0000 (16:26 +0000)]
[release-branch.go1.17] go1.17rc1

Change-Id: Idc207e34c54b9bff0ae59348e4bc97474b1c11d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/334254
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Cherry Mui <cherryyz@google.com>

2 years ago[release-branch.go1.17] all: merge master into release-branch.go1.17
Cherry Mui [Tue, 13 Jul 2021 15:14:29 +0000 (11:14 -0400)]
[release-branch.go1.17] all: merge master into release-branch.go1.17

a98589711d crypto/tls: test key type when casting
cfbd73ba33 doc/go1.17: editing pass over the "Compiler" section
ab4085ce84 runtime/pprof: call runtime.GC twice in memory profile test

Change-Id: I5b19d559629353886752e2a73ce8f37f983772df

2 years agocrypto/tls: test key type when casting
Roland Shoemaker [Wed, 9 Jun 2021 18:31:27 +0000 (11:31 -0700)]
crypto/tls: test key type when casting

When casting the certificate public key in generateClientKeyExchange,
check the type is appropriate. This prevents a panic when a server
agrees to a RSA based key exchange, but then sends an ECDSA (or
other) certificate.

Fixes #47143
Fixes CVE-2021-34558

Thanks to Imre Rad for reporting this issue.

Change-Id: Iabccacca6052769a605cccefa1216a9f7b7f6aea
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1116723
Reviewed-by: Filippo Valsorda <valsorda@google.com>
Reviewed-by: Katie Hockman <katiehockman@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/334031
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2 years agodoc/go1.17: editing pass over the "Compiler" section
Austin Clements [Fri, 9 Jul 2021 20:22:32 +0000 (16:22 -0400)]
doc/go1.17: editing pass over the "Compiler" section

Change-Id: I08c082f548daa7011a8dc42769371329684c90e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/333609
Trust: Austin Clements <austin@google.com>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
2 years agoruntime/pprof: call runtime.GC twice in memory profile test
Michael Anthony Knyszek [Fri, 9 Jul 2021 17:34:07 +0000 (17:34 +0000)]
runtime/pprof: call runtime.GC twice in memory profile test

This change fixes #46500 by working around #45315 which may cause freed
objects to get missed in the heap profile published for the test.

By calling runtime.GC one more time this change ensures that all freed
objects are accounted for.

Fixes #46500.

Change-Id: Iedcd0b37dbaffa688b0ff8631a8b79f7a1169634
Reviewed-on: https://go-review.googlesource.com/c/go/+/333549
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2 years agonet: filter bad names from Lookup functions instead of hard failing
Roland Shoemaker [Fri, 2 Jul 2021 17:25:49 +0000 (10:25 -0700)]
net: filter bad names from Lookup functions instead of hard failing

Instead of hard failing on a single bad record, filter the bad records
and return anything valid. This only applies to the methods which can
return multiple records, LookupMX, LookupNS, LookupSRV, and LookupAddr.

When bad results are filtered out, also return an error, indicating
that this filtering has happened.

Updates #46241
Fixes #46979

Change-Id: I6493e0002beaf89f5a9795333a93605abd30d171
Reviewed-on: https://go-review.googlesource.com/c/go/+/332549
Trust: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2 years agoUpdate oudated comment
makdon [Mon, 17 May 2021 16:27:11 +0000 (16:27 +0000)]
Update oudated comment

Update comment cause gc/select.go has been moved to walk/select.go and gc/reflect.go has been moved to reflectdata/reflect.go

Change-Id: I6894527e1e9dbca50ace92a51bf942f9495ce88c
GitHub-Last-Rev: 6d6a4471440403218b68ba32d4038ca41eae2901
GitHub-Pull-Request: golang/go#45976
Reviewed-on: https://go-review.googlesource.com/c/go/+/317191
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Michael Pratt <mpratt@google.com>

2 years agodoc/go1.17: linkify time.UnixMilli and time.UnixMicro
Tobias Klauser [Mon, 5 Jul 2021 08:35:53 +0000 (10:35 +0200)]
doc/go1.17: linkify time.UnixMilli and time.UnixMicro

Change-Id: I8503c4649fc42670f13d981f98af480467d6a3e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/332829
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2 years agocmd/compile: remove special-casing of blank in types.sconv{,2}
Matthew Dempsky [Wed, 7 Jul 2021 20:18:42 +0000 (13:18 -0700)]
cmd/compile: remove special-casing of blank in types.sconv{,2}

I'm not sure why blank was special-cased here before, but it's
wrong. Blank is a non-exported identifier, and writing it out without
package-qualification can result in linker symbol collisions.

Fixes #47087.

Change-Id: Ie600037c8e54e3d4fdaeec21e2ca212badbd830b
Reviewed-on: https://go-review.googlesource.com/c/go/+/333163
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agocmd/compile: optimize types.sconv
Matthew Dempsky [Wed, 7 Jul 2021 19:33:40 +0000 (12:33 -0700)]
cmd/compile: optimize types.sconv

Now that symfmt is simpler, we can simply manually inline it into
sconv. Importantly, this allows us to avoid allocating a buffer +
writing a string + re-interning it when we don't need to qualify the
identifier.

Passes toolstash -cmp.

Updates #47087.

Change-Id: I47b57aef22301ba242556a645346f478f0c1a7d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/333162
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agocmd/compile: extract pkgqual from symfmt
Matthew Dempsky [Wed, 7 Jul 2021 19:11:37 +0000 (12:11 -0700)]
cmd/compile: extract pkgqual from symfmt

The logic in symfmt for deciding how to package-qualify an identifier
is easily refactored into a separate function, loosely similar to
go/types.Qualifier's API.

Passes toolstash -cmp.

Updates #47087.

Change-Id: Ib3e7cc35a6577dc28df8eca79ba3457c48168e86
Reviewed-on: https://go-review.googlesource.com/c/go/+/333161
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agocmd/go: don't lock .mod and .sum files for read in overlay
Jay Conrod [Tue, 6 Jul 2021 17:38:18 +0000 (10:38 -0700)]
cmd/go: don't lock .mod and .sum files for read in overlay

On Plan 9, locking a file requires a chmod call. In general, the go
command should not modify files in the overlay, even metadata. With
this change, we won't lock these files for reading.

The go command already reported errors when attempting to write these
files if they were in the overlay, but this change moves those checks
to the point of access for clearer error
messages. cmd/go/internal/lockedfile no longer imports
cmd/go/internal/fsys.

Fixes #44700

Change-Id: Ib544459dd6cf56ca0f7a27b3285f045f08040d7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/333012
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2 years agocmd/go/internal/modfetch/codehost: skip hg tests if no hg binary is present
Bryan C. Mills [Fri, 25 Jun 2021 16:49:51 +0000 (12:49 -0400)]
cmd/go/internal/modfetch/codehost: skip hg tests if no hg binary is present

Change-Id: I5cf57bf1153eb662bcab71e3d2c04848212559a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/330989
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years agocmd/go/internal/modload: remove unused functions
Bryan C. Mills [Fri, 2 Jul 2021 15:27:37 +0000 (11:27 -0400)]
cmd/go/internal/modload: remove unused functions

Also unexport functions that are not used outside the modload package.

Change-Id: I0de187cbb673cadafce95a27f5ccff934ae21104
Reviewed-on: https://go-review.googlesource.com/c/go/+/332570
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years agocmd/go/internal/modload: fix an apparent typo in the AutoRoot comment
Bryan C. Mills [Fri, 2 Jul 2021 18:00:49 +0000 (14:00 -0400)]
cmd/go/internal/modload: fix an apparent typo in the AutoRoot comment

Updates #40276

Change-Id: Ic192d51f9f0306e5c206c550ef02f6d4495d0851
Reviewed-on: https://go-review.googlesource.com/c/go/+/332569
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years agodoc: remove stale comment about arm64 port
Michael Anthony Knyszek [Wed, 7 Jul 2021 14:58:36 +0000 (14:58 +0000)]
doc: remove stale comment about arm64 port

Fixes #47079.

Change-Id: I8a671e3fdc13083e44e8d89064a5e7621e53bc4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/333075
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agonet/http: mention socks5 support in proxy
Sean Liao [Tue, 8 Jun 2021 18:13:23 +0000 (20:13 +0200)]
net/http: mention socks5 support in proxy

Change-Id: I55b6d5c77221569eeafea625379affd476a65772
Reviewed-on: https://go-review.googlesource.com/c/go/+/326011
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

2 years agocmd/compile: fix stack growing algorithm
go101 [Fri, 2 Jul 2021 08:01:20 +0000 (08:01 +0000)]
cmd/compile: fix stack growing algorithm

The current stack growing implementation looks not right.
Specially, the line runtime/stack.go#L1068 never gets executed,
which causes many unnecessary copystack calls.

This PR is trying to correct the implementation.
As I'm not familiar with the code, the fix is just a guess.

Change-Id: I0bea1148175fad34f74f19d455c240c94d3cb78b
GitHub-Last-Rev: 57205f91fe6f7cecbf0b7aad0d90d2f81270b1e8
GitHub-Pull-Request: golang/go#47010
Reviewed-on: https://go-review.googlesource.com/c/go/+/332229
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

2 years agospec, unsafe: clarify unsafe.Slice docs
Ian Lance Taylor [Thu, 1 Jul 2021 23:52:59 +0000 (16:52 -0700)]
spec, unsafe: clarify unsafe.Slice docs

For #19367

Change-Id: If0ff8ddba3b6b48e2e198cf3653e73284c7572a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/332409
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agocmd/dist: correct comment: SysProcAttri -> SysProcAttr
komisan19 [Fri, 2 Jul 2021 05:41:10 +0000 (05:41 +0000)]
cmd/dist: correct comment: SysProcAttri -> SysProcAttr

Fixes #46982

Change-Id: I07a18507b7aad828714b187f296fa7268f32b1c4
GitHub-Last-Rev: f498febffdae0bc93ae1794d1ee62b2ef3ecf1bb
GitHub-Pull-Request: golang/go#46983
Reviewed-on: https://go-review.googlesource.com/c/go/+/331869
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agonet: don't reject null mx records
Roland Shoemaker [Wed, 30 Jun 2021 21:28:18 +0000 (14:28 -0700)]
net: don't reject null mx records

Bypass hostname validity checking when a null mx record is returned as,
defined in RFC 7505.

Updates #46979

Change-Id: Ibe683bd6b47333a8ff30909fb2680ec8e10696ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/332094
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2 years agotesting: add TB.Setenv
Russ Cox [Thu, 10 Jun 2021 19:17:17 +0000 (15:17 -0400)]
testing: add TB.Setenv

For #41260 and #46688.

Change-Id: I6f42742cc3234a90003136ae8798a6b0e1291788
Reviewed-on: https://go-review.googlesource.com/c/go/+/326790
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agocmd/compile: fix bug in dwarf-gen var location generation
Than McIntosh [Thu, 1 Jul 2021 15:22:02 +0000 (11:22 -0400)]
cmd/compile: fix bug in dwarf-gen var location generation

This patch fixes a bug in the SSA back end's DWARF generation code
that determines variable locations / lifetimes.

The code in question was written to handle sequences of initial
pseudo-ops (zero width instructions such as OpPhi, OpArg, etc) in a
basic block, detecting these ops at the start of a block and then
treating the values specially when emitting ranges for the variables
in those values.  The logic in this code wasn't quite correct, meaning
that a flag variable wasn't being set properly to record the presence
of a block of zero-width value-bearing ops, leading to incorrect or
missing DWARF locations for register params.

Also in this patch is a tweak to some sanity-checking code intended to
catch scheduling problems with OpArg/OpPhi etc. The checks need to
allow for the possibility of an Arg op scheduled after a spill of an
incoming register param inserted by the register allocator. Example:

    b1:
      v13 = ArgIntReg <int> {p1+16} [2] : CX
      v14 = ArgIntReg <int> {p2+16} [5] : R8
      v38 = ArgIntReg <int> {p3+16} [8] : R11
      v35 = ArgIntReg <int> {p1+0} [0] : AX
      v15 = StoreReg <int> v35 : .autotmp_4[int]
      v40  = Arg <int> {p4} [16] : p4+16[int]
      v1 = InitMem <mem>
      v3 = SB <uintptr> : SB
      v18 = CMPQ <flags> v14 v13
      NE v18 → b3 b2 (unlikely) (18)

Here the register allocator has decided to spill v35, meaning that the
OpArg v40 is no longer going to be positioned prior to all other
non-zero-width ops; this is a valid scenario and needs to be handled
properly by the debug code.

Fixes #46425.

Change-Id: I239b3ad56a9c1b8ebf68af42e1f57308293ed7e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/332269
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agocmd/go: add a regression test for 'go mod vendor' path traversal
Bryan C. Mills [Thu, 1 Jul 2021 16:32:05 +0000 (12:32 -0400)]
cmd/go: add a regression test for 'go mod vendor' path traversal

For #46867

Change-Id: I1547ebf7b91e9ddd7b67fd2f20e91391d79fa35d
Reviewed-on: https://go-review.googlesource.com/c/go/+/332250
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years agocmd/go: use path.Dir instead of filepath.Dir for package paths in 'go mod vendor'
Yasuhiro Matsumoto [Tue, 22 Jun 2021 16:02:33 +0000 (01:02 +0900)]
cmd/go: use path.Dir instead of filepath.Dir for package paths in 'go mod vendor'

copyMetadata walk-up to parent directory until the pkg become modPath.
But pkg should be slash-separated paths. It have to use path.Dir instead of
filepath.Dir.

Fixes #46867

Change-Id: I44cf1429fe52379a7415b94cc30ae3275cc430e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/330149
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Alexander Rakoczy <alex@golang.org>
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agocmd/compile: make stack value size threshold comparisons consistent
go101 [Thu, 1 Jul 2021 14:25:45 +0000 (14:25 +0000)]
cmd/compile: make stack value size threshold comparisons consistent

Consistency is beautiful.

Change-Id: Ib110dcff0ce2fa87b5576c79cd79c83aab385a7c
GitHub-Last-Rev: b8758f8ae02cb025267aa87ebc5c2f9b4c32e742
GitHub-Pull-Request: golang/go#47011
Reviewed-on: https://go-review.googlesource.com/c/go/+/332230
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agocmd/compile: fix typos in document
fanzha02 [Wed, 30 Jun 2021 02:51:54 +0000 (10:51 +0800)]
cmd/compile: fix typos in document

Correct "a2Spill" to "a3Spill"

Change-Id: I6ac4c45973dfaeb16d3a90d835589b6af1aefe1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/331850
Trust: fannie zhang <Fannie.Zhang@arm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agodoc/go1.17: linkify "language changes" in the runtime section
Bryan C. Mills [Wed, 30 Jun 2021 15:54:46 +0000 (11:54 -0400)]
doc/go1.17: linkify "language changes" in the runtime section

Change-Id: I82bd3954bfc5da59c7952eba2a28ff0e3b41427f
Reviewed-on: https://go-review.googlesource.com/c/go/+/331969
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2 years agopath/filepath: deflake TestEvalSymlinksAboveRoot on darwin
Josh Bleecher Snyder [Wed, 30 Jun 2021 16:44:30 +0000 (09:44 -0700)]
path/filepath: deflake TestEvalSymlinksAboveRoot on darwin

On darwin, under load, it appears that the system occasionally
deletes the temp dir mid-test. Don't fail the test when that happens.

It would be nice to fix this in a deeper way.
See golang.org/cl/332009 for some discussion.

In the meantime, this will at least stop the flakiness.

Updates #37910

Change-Id: I6669e466fed9abda4a87ca88345c04cd7986b41e
Reviewed-on: https://go-review.googlesource.com/c/go/+/332009
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2 years agocmd/dist: pass -Wno-unknown-warning-option in swig_callback_lto
Ian Lance Taylor [Wed, 30 Jun 2021 17:19:02 +0000 (10:19 -0700)]
cmd/dist: pass -Wno-unknown-warning-option in swig_callback_lto

For #46557
Fixes #46991

Change-Id: Ic88ebaa13d3edf904657dc19ada4fd4ff7f44a8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/332010
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2 years agoimage/gif: fix typo in the comment (io.ReadByte -> io.ByteReader)
uji [Tue, 29 Jun 2021 15:06:23 +0000 (00:06 +0900)]
image/gif: fix typo in the comment (io.ReadByte -> io.ByteReader)

Fixes #46967

Change-Id: I66e69c70b74e904623e8ca854562d255692b2143
Reviewed-on: https://go-review.googlesource.com/c/go/+/331649
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>

2 years agoos: change example to avoid deprecated function
Eli Bendersky [Tue, 29 Jun 2021 23:31:18 +0000 (16:31 -0700)]
os: change example to avoid deprecated function

The IsNotExist function is deprecated; change package example to avoid
it and use the recommended way instead.

Fixes #46976

Change-Id: I3c301d0a89b6bda42184df314ba8418062ca39ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/331692
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agoimage: add Uniform.RGBA64At and Rectangle.RGBA64At
Nigel Tao [Tue, 29 Jun 2021 06:53:44 +0000 (16:53 +1000)]
image: add Uniform.RGBA64At and Rectangle.RGBA64At

These types already implemented the Image interface. They should also
implement the RGBA64Image interface (new in Go 1.17)

Updates #44808

Change-Id: I9a2b13e305997088ae874efb95ad9e1648f94812
Reviewed-on: https://go-review.googlesource.com/c/go/+/331570
Trust: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2 years agocrypto/x509: don't fail on optional auth key id fields
Roland Shoemaker [Tue, 29 Jun 2021 16:20:04 +0000 (09:20 -0700)]
crypto/x509: don't fail on optional auth key id fields

If a certificate contains an AuthorityKeyIdentifier extension that
lacks the keyIdentifier field, but contains the authorityCertIssuer
and/or the authorityCertSerialNumber fields, don't return an error and
continue parsing.

Fixes #46854

Change-Id: I82739b415441f639a722755cc1f449d73078adfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/331689
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2 years agonet: fix failure of TestCVE202133195
Xiangdong Ji [Mon, 28 Jun 2021 12:27:30 +0000 (20:27 +0800)]
net: fix failure of TestCVE202133195

TestCVE202133195 fails in testing LookupSRV if /etc/resolv.conf sets the option
'ndots' larger than the number of dots in the domain name under query.

Fix the issue by making the input domain name in test codes 'rooted' to skip search
list qualifying.

Fixes #46955

Change-Id: I1909fa7e54e9c9af57623e57cafc905729ff99fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/330842
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

2 years agodoc/go1.17: fix typo "MacOS" -> "macOS"
Levi(リーバイ) [Tue, 29 Jun 2021 12:45:52 +0000 (12:45 +0000)]
doc/go1.17: fix typo "MacOS" -> "macOS"

Change-Id: Ie2ada2bf875a93b1cc9e86a81c8a25de39ce4752
GitHub-Last-Rev: 462753db015949eb88c6c4e64b6aae1a49ac89b4
GitHub-Pull-Request: golang/go#46962
Reviewed-on: https://go-review.googlesource.com/c/go/+/331589
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2 years agomath/big: fix typo of comment (`BytesScanner` to `ByteScanner`)
tkawakita [Tue, 29 Jun 2021 15:46:05 +0000 (00:46 +0900)]
math/big: fix typo of comment (`BytesScanner` to `ByteScanner`)

Change-Id: I0c2d26d6ede1452008992efbea7392162da65014
Reviewed-on: https://go-review.googlesource.com/c/go/+/331651
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agocmd/compile: suppress details error for invalid variadic argument type
Cuong Manh Le [Tue, 29 Jun 2021 03:11:31 +0000 (10:11 +0700)]
cmd/compile: suppress details error for invalid variadic argument type

CL 255241 made error message involving variadic calls clearer. To do it,
we added a check that the type of variadic argument must be a slice.
That's why the compiler crashes for invalid variadic argument type.

Instead, we can just omit the details error message, and report not
enough arguments error, which matches the behavior of go/types and types2.

Fixes #46957

Change-Id: I638d7e8f031f0ee344d5d802104fd93a60aae00a
Reviewed-on: https://go-review.googlesource.com/c/go/+/331569
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2 years agocmd/internal/obj/arm64: fix an encoding error of CMPW instruction
eric fang [Mon, 21 Jun 2021 02:11:25 +0000 (02:11 +0000)]
cmd/internal/obj/arm64: fix an encoding error of CMPW instruction

For arm64 CMP, ADD and other similar extended register instructions,
if there is no extension, the default extion is LSL<<0, but the default
encoding value (the value of 'option' field) of 32-bit instruction and
64-bit instruction is different, 32-bit is 2 and 64-bit is 3. But the
current assembler incorrectly encodes the value of 32-bit instruction
to 3. This CL fixes this error.

Change-Id: I0e09af2c9c5047a4ed2db7d1183290283db9c31c
Reviewed-on: https://go-review.googlesource.com/c/go/+/329749
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: eric fang <eric.fang@arm.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

2 years agocmd/compile,runtime: change unsafe.Slice((*T)(nil), 0) to return []T(nil)
Matthew Dempsky [Fri, 25 Jun 2021 18:07:28 +0000 (11:07 -0700)]
cmd/compile,runtime: change unsafe.Slice((*T)(nil), 0) to return []T(nil)

This CL removes the unconditional OCHECKNIL check added in
walkUnsafeSlice by instead passing it as a pointer to
runtime.unsafeslice, and hiding the check behind a `len == 0` check.

While here, this CL also implements checkptr functionality for
unsafe.Slice and disallows use of unsafe.Slice with //go:notinheap
types.

Updates #46742.

Change-Id: I743a445ac124304a4d7322a7fe089c4a21b9a655
Reviewed-on: https://go-review.googlesource.com/c/go/+/331070
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agospec: change unsafe.Slice((*T)(nil), 0) to return []T(nil)
Matthew Dempsky [Fri, 25 Jun 2021 18:17:43 +0000 (11:17 -0700)]
spec: change unsafe.Slice((*T)(nil), 0) to return []T(nil)

Updates #46742.

Change-Id: I044933a657cd1a5cdb29863e49751df5fe9c258a
Reviewed-on: https://go-review.googlesource.com/c/go/+/331069
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agoruntime/internal/atomic: drop Cas64 pointer indirection in comments
Mia Zhu [Mon, 28 Jun 2021 17:10:56 +0000 (17:10 +0000)]
runtime/internal/atomic: drop Cas64 pointer indirection in comments

Change-Id: Ieff0065cbd81e045594ce12e10338b0666816d70
GitHub-Last-Rev: d842f5cb3e5d75f87957c068f6accc9d4a4ac224
GitHub-Pull-Request: golang/go#46949
Reviewed-on: https://go-review.googlesource.com/c/go/+/331309
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agocmd/go: add GOEXPERIMENT to `go env` output
Matthew Dempsky [Wed, 16 Jun 2021 22:10:57 +0000 (15:10 -0700)]
cmd/go: add GOEXPERIMENT to `go env` output

This CL adds GOEXPERIMENT to `go env` output, and also makes it
configurable via `GOENV`. Thanks to Baokun Lee's CL 304350 for the
test and initial work on this.

Fixes #45226.

Change-Id: Ie7f92a8a503b6a2a4df3f6598f0b2bf2915e2e7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/328751
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>

2 years agocmd/go: prep for 'go env' refactoring
Matthew Dempsky [Sat, 19 Jun 2021 10:35:15 +0000 (03:35 -0700)]
cmd/go: prep for 'go env' refactoring

This CL refactors code a little to make it easier to add GOEXPERIMENT
support in the future.

Change-Id: I87903056f7863049e58be72047b2b8a60a213baf
Reviewed-on: https://go-review.googlesource.com/c/go/+/329654
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2 years agocmd/link/internal/ld: skip the windows ASLR test when CGO_ENABLED=0
hao [Fri, 28 May 2021 03:40:12 +0000 (03:40 +0000)]
cmd/link/internal/ld: skip the windows ASLR test when CGO_ENABLED=0

the test case is still using gcc when CGO is disabled.

Change-Id: I2d255bfaeb92816c8343ab72fd7984b6632d421d
GitHub-Last-Rev: de14748bd54c7db8687263a7c37080ec884d982a
GitHub-Pull-Request: golang/go#46120
Reviewed-on: https://go-review.googlesource.com/c/go/+/319169
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

2 years agocmd/cgo: fix 'see gmp.go' to 'see doc.go'
Koichi Shiraishi [Sun, 27 Jun 2021 02:50:17 +0000 (11:50 +0900)]
cmd/cgo: fix 'see gmp.go' to 'see doc.go'

Change-Id: I303edc9dfbf4185b5b461b121ab504f6ed9f8630
Reviewed-on: https://go-review.googlesource.com/c/go/+/330839
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

2 years agointernal/buildcfg: refactor GOEXPERIMENT parsing code somewhat
Matthew Dempsky [Fri, 25 Jun 2021 20:24:10 +0000 (13:24 -0700)]
internal/buildcfg: refactor GOEXPERIMENT parsing code somewhat

This CL extracts out a ParseGOEXPERIMENT helper function that parses
GOOS/GOARCH/GOEXPERIMENT values and returns active and baseline
experiment flag sets and an error value, without affecting any global
state. This will be used in the subsequent CL for 'go env' support for
GOEXPERIMENT to validate configuration changes.

The existing package initialization for Experiment and
experimentBaseline and also UpdateExperiments are updated to use it as
well.

Change-Id: Ic2ed3fd36d2a6f7f3d8172fccb865e02505c0052
Reviewed-on: https://go-review.googlesource.com/c/go/+/331109
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>

2 years agoruntime/race: use race build tag on syso_test.go
Cherry Mui [Fri, 25 Jun 2021 19:58:38 +0000 (15:58 -0400)]
runtime/race: use race build tag on syso_test.go

All other test files in the runtime/race package have race build
tag, except syso_test.go. The test is only relevant if the race
detector is supported. So apply the build tag.

Fixes #46931.

Change-Id: Icdb94214d3821b4ccf61133412ef39b4d7cc7691
Reviewed-on: https://go-review.googlesource.com/c/go/+/331050
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Elias Naur <mail@eliasnaur.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agogo/types: in TestCheck/issues.src, import regexp/syntax instead of cmd/compile/intern...
Bryan C. Mills [Thu, 24 Jun 2021 02:06:50 +0000 (22:06 -0400)]
go/types: in TestCheck/issues.src, import regexp/syntax instead of cmd/compile/internal/syntax

TestCheck/issues.src was failing after running
rm -r $(go env GOROOT)/pkg/*/cmd
as the builders do when building binary releases.

For users who write programs that depend on go/types, it should be
reasonable for end users to run the tests for go/types as part of 'go
test all', and those tests should pass even if they installed Go from
a binary release.

The test case in issues.src was importing cmd/compile/internal/syntax
in order to check the reported package name.

I tried to fix the problem by having the test import from source
instead of from export data. Unfortunately, that changed the behavior
under test: the go/types.Package.Imports reports (and is documented to
report) a different set of imported packages when loading from source
as compared to when loading from export data.

For this particular test, after CL 313035 that difference resulted in
go/types treating the "syntax" name as ambiguous when importing from
source, because a transitive dependency on "regexp/syntax" is found
when loading from source but omitted when loading from export data.

The simple fix to make the package unambiguous again is to adapt the
test to import regexp/syntax directly. That not only makes the package
unambiguous with all importers, but also avoids depending on a
cmd-internal package that cannot be loaded from export data in binary
distributions of the Go toolchain.

For #43232

Change-Id: Iba45a680ea20d26daa86ac538fd8f1938e8b73ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/330431
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types: in TestStdlib, import from source instead of export data
Bryan C. Mills [Wed, 23 Jun 2021 04:50:43 +0000 (00:50 -0400)]
go/types: in TestStdlib, import from source instead of export data

TestStdlib was failing after running
rm -r $(go env GOROOT)/pkg/*/cmd
as the builders do when building binary releases.¹

For users who write programs that depend on go/types, it should be
reasonable to run the tests for go/types as part of 'go test all', and
those tests should pass even if they installed Go from a binary
release.

I had originally drafted this as a fallback to import from source only
if the affected packages can't be imported by the default export-data
importer. Unfortunately, I realized that we don't currently have a
builder that tests the actual release (#46900), so it is quite likely
that the fallback path would bit-rot and produce unexpected test
regressions.

So instead, we now unconditionally import from source in TestStdlib.
That makes the test substantially slower (~15s instead of ~5s on my
workstation), but with less risk of regression, and TestStdlib is
skipped in short mode already so short-mode test time is unaffected.

If we change the builders to test the actual release configuration, we
can consider restoring the faster path when export data is available.

¹https://github.com/golang/build/blob/df58bbac082bc87c4a3cdfe336d1ffe60bbaa916/cmd/release/release.go#L533-L545

For #43232

Change-Id: I764ec56926c104053bb2ef23cf258c8f0f773290
Reviewed-on: https://go-review.googlesource.com/c/go/+/330252
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agoruntime: make ncgocall a global counter
Tao Qingyun [Tue, 22 Jun 2021 00:24:05 +0000 (00:24 +0000)]
runtime: make ncgocall a global counter

ncgocall was stored per M, runtime.NumCgoCall lost the counter when a M die.

Fixes #46789

Change-Id: I85831fbb2713f4c30d1800d07e1f47aa0031970e
GitHub-Last-Rev: cbc15fa870de776d3fbf3b62fc9a5e01792e6a26
GitHub-Pull-Request: golang/go#46842
Reviewed-on: https://go-review.googlesource.com/c/go/+/329729
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Alexander Rakoczy <alex@golang.org>

2 years agogo/types: fix a bug in package qualification logic
Rob Findley [Thu, 24 Jun 2021 15:01:49 +0000 (11:01 -0400)]
go/types: fix a bug in package qualification logic

CL 313035 had a bug, initializing pkgPathMap by walking the imported
package being considered rather than check.pkg.

Fix this, and enhance our tests to exercise this bug as well as other
edge cases.

Also fix error assertions in issues.src to not use quotation marks
inside the error regexp. The check tests only matched the error regexp
up to the first quotation mark.

Fixes #46905

Change-Id: I6aa8eae4bec6495006a5c03fc063db0d66b44cd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/330629
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agoreflect: document that InterfaceData is a low-entropy RNG
Matthew Dempsky [Thu, 24 Jun 2021 17:44:39 +0000 (10:44 -0700)]
reflect: document that InterfaceData is a low-entropy RNG

Change-Id: Ie26b9060630e2e774ac23d8492eaaf785bfca6b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/330709
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>

2 years agocmd/compile: fix wrong type in SSA generation for OSLICE2ARRPTR
Cuong Manh Le [Thu, 24 Jun 2021 18:45:32 +0000 (01:45 +0700)]
cmd/compile: fix wrong type in SSA generation for OSLICE2ARRPTR

Fixes #46907

Change-Id: I6a2728d2f2159df583b32f40f6100d3e90c34dd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/330672
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agocmd/go: don't try to add replaced versions that won't be selected
Bryan C. Mills [Thu, 24 Jun 2021 03:29:10 +0000 (23:29 -0400)]
cmd/go: don't try to add replaced versions that won't be selected

In Go 1.12, we added a heuristic to 'go mod tidy' to resolve packages
by adding replaced-but-not-required modules before falling back to
searching for modules from the network. Unfortunately, that heuristic
fails when the replaced version is already lower than the selected
version: adding such a module to the build list doesn't change the
selected version of that module, and so it doesn't make progress
toward resolving the missing package.

Fixes #46659

Change-Id: I75e2387d5290e769f6b0fa1231dcc4605db68597
Reviewed-on: https://go-review.googlesource.com/c/go/+/330432
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years agonet: remove hard-coded timeout in dialClosedPort test helper
Bryan C. Mills [Wed, 23 Jun 2021 01:48:11 +0000 (21:48 -0400)]
net: remove hard-coded timeout in dialClosedPort test helper

The helper function claims that dialing a closed port should be
"nearly instantaneous", but that is empirically not the case on
OpenBSD or Windows. The tests do not appear to be particularly
sensitive to the exact upper bound otherwise, so let's just
remove the arbitrary latency assumption.

Fixes #46884

Change-Id: If00c9fdc3063da6aaf60d365d4a2ee2c94dc6df1
Reviewed-on: https://go-review.googlesource.com/c/go/+/330250
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agotime: handle invalid UTF-8 byte sequences in quote to prevent panic
Andy Pan [Wed, 23 Jun 2021 04:59:48 +0000 (12:59 +0800)]
time: handle invalid UTF-8 byte sequences in quote to prevent panic

Fixes #46883
Updates CL 267017

Change-Id: I15c307bfb0aaa2877a148d32527681f79df1a650
Reviewed-on: https://go-review.googlesource.com/c/go/+/330289
Reviewed-by: Kevin Burke <kev@inburke.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>

2 years agocmd/go: search breadth-first instead of depth-first for test dependency cycles
Bryan C. Mills [Wed, 23 Jun 2021 19:28:37 +0000 (15:28 -0400)]
cmd/go: search breadth-first instead of depth-first for test dependency cycles

When we are looking for a dependency cycle involving a specific
package, we need to keep track of visited packages in order to avoid
repeatedly traversing a cycle that does not involve that package.

If we're keeping track of all visited packages anyway, we're already
spending O(N) memory on the traversal, so we may as well use
breadth-first search. That not only keeps the bookkeeping simple, but
also guarantees that we will find a shortest path (rather than a
completely arbitrary one).

Fixes #45863

Change-Id: I810c7337857e42dcb83630abbdea75021554be45
Reviewed-on: https://go-review.googlesource.com/c/go/+/330430
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years agonet: use absDomainName in the Windows lookupPTR test helper
Bryan C. Mills [Wed, 23 Jun 2021 01:24:57 +0000 (21:24 -0400)]
net: use absDomainName in the Windows lookupPTR test helper

The real net code uses subtle heuristics to transform a domain name
to its absolute form. Since lookupPTR isn't checking that
transformation specifically, it should use the real code instead of
using a different heuristic.

Fixes #46882

Change-Id: I503357e0f62059c37c359cd54b44d343c7d5ab2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/330249
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agoos: enable TestFifoEOF on openbsd
siddharth [Tue, 22 Jun 2021 01:50:09 +0000 (21:50 -0400)]
os: enable TestFifoEOF on openbsd

The test successfully runs on currently supported versions (6.8 and
6.9) of openbsd.

Fixes #25877

Change-Id: I2694f08c5596b486453c2ac829f17b8bc455f828
Reviewed-on: https://go-review.googlesource.com/c/go/+/329732
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>

2 years agocmd/go: update ToolTags based on GOARCH value
Ian Lance Taylor [Mon, 21 Jun 2021 21:48:54 +0000 (14:48 -0700)]
cmd/go: update ToolTags based on GOARCH value

The build.Context ToolTags value is set based on the set of enabled
experiments, which in turn depends on GOARCH. Before this CL the set
of experiments was being set based on GOARCH in the environment.
That is normally fine, but fails with cmd/go when somebody has run
"go env -w GOARCH=val"; in that case cmd/go changes its GOARCH value
after initialization. The new GOARCH value was affect the set of
enabled experiments, which can affect the ToolTags value. With this
CL, we update ToolTags in cmd/go based on the GOARCH value it is using.

This is a pretty ugly fix. We should do something cleaner for 1.18.

Fixes #46815

Change-Id: Ie9416781a168248813c3da8afdc257acdd3fef7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/329930
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2 years agospec: unsafe.Add/Slice are not permitted in statement context
Robert Griesemer [Tue, 22 Jun 2021 05:20:11 +0000 (22:20 -0700)]
spec: unsafe.Add/Slice are not permitted in statement context

Add unsafe.Add and unsafe.Slice to the list of built-in functions
which are not permitted in statement context. The compiler and
type checker already enforce this restriction, this just fixes
a documentation oversight.

For #19367.
For #40481.

Change-Id: Iabc63a8db048eaf40a5f5b5573fdf00b79d54119
Reviewed-on: https://go-review.googlesource.com/c/go/+/329925
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agoruntime/internal/atomic: remove incorrect pointer indirection in comment
Xing Gao [Tue, 22 Jun 2021 02:12:29 +0000 (02:12 +0000)]
runtime/internal/atomic: remove incorrect pointer indirection in comment

Change-Id: I9d743b7f6b001158299bea4af4aede678654bc8e
GitHub-Last-Rev: 7e07834abc861e21030fe4a8eb323bac01e18f7a
GitHub-Pull-Request: golang/go#46851
Reviewed-on: https://go-review.googlesource.com/c/go/+/329730
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ben Shi <powerman1st@163.com>
2 years agogo/types: guard against checking instantiation when generics is disabled
Rob Findley [Tue, 22 Jun 2021 00:16:37 +0000 (20:16 -0400)]
go/types: guard against checking instantiation when generics is disabled

When type checking t[_], where t is a type name, it was possible to leak
an error message related to generics. Fix this by guarding on
typeparams.Enabled.

In order to test this fix, we need to be able to run the new go/types
test only if type parameters are disabled. Introduce the .go1 test data
suffix (similar to .go2) to control this behavior.

Originally found via fuzzing, though the test case was manually
simplified.

Updates #46404

Change-Id: Ib1e2c27cf974c2a5ca5b9d6d01b84a30ba4d583b
Reviewed-on: https://go-review.googlesource.com/c/go/+/329793
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agocmd/gofmt: remove stale documentation for the -G flag
Rob Findley [Tue, 22 Jun 2021 00:14:21 +0000 (20:14 -0400)]
cmd/gofmt: remove stale documentation for the -G flag

This documentation remained from the original dev.typeparams merge. This
flag no longer exists.

Change-Id: Ic9a82071c512614dc1382780d69ef13253fca21d
Reviewed-on: https://go-review.googlesource.com/c/go/+/329792
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agogo/parser: parse an ast.IndexExpr for a[]
Rob Findley [Mon, 21 Jun 2021 20:10:14 +0000 (16:10 -0400)]
go/parser: parse an ast.IndexExpr for a[]

To be consistent with Go 1.16, and to preserve as much information in
the AST as possible, parse an ast.IndexExpr with BadExpr Index for the
invalid expression a[].

A go/types test had to be adjusted to account for an additional error
resulting from this change.

We don't have a lot of test coverage for parser error recovery, so
rather than write an ad-hoc test for this issue, add a new go/types test
that checks that the indexed operand is used.

Updates #46403

Change-Id: I21e6ff4179746aaa50e530d4091fded450e69824
Reviewed-on: https://go-review.googlesource.com/c/go/+/329791
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agocmd/go: add a -go flag to 'go mod graph'
Bryan C. Mills [Fri, 18 Jun 2021 21:28:29 +0000 (17:28 -0400)]
cmd/go: add a -go flag to 'go mod graph'

For #46366

Change-Id: I8417e6e4dbb8cb56ff7afc16893a01b7bb938217
Reviewed-on: https://go-review.googlesource.com/c/go/+/329529
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years agocmd/internal/moddeps: use a temporary directory for GOMODCACHE if needed
Bryan C. Mills [Wed, 16 Jun 2021 20:33:29 +0000 (16:33 -0400)]
cmd/internal/moddeps: use a temporary directory for GOMODCACHE if needed

CL 328770 should be sufficient to fix the specific failure in the
report, but when attempting to reproduce it I noticed a related
failure mode, triggered by the environment variables set in
src/run.bash.

The failure mode is currently masked on the Go project builders due to
the lack of any 'longtest' builder running as a non-root user
(#10719).

It is also masked from Go contributors running 'run.bash' locally
because 'run.bash' does not actually run all of the tests unless
GO_TEST_SHORT=0 is set in the environment (#29266, #46054).

Fixes #46695

Change-Id: I272c09dae462734590dce59b3d3c5b6d3f733c92
Reviewed-on: https://go-review.googlesource.com/c/go/+/328771
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2 years agocmd/internal/moddeps: use -mod=readonly instead of -mod=mod
Bryan C. Mills [Wed, 16 Jun 2021 18:34:54 +0000 (14:34 -0400)]
cmd/internal/moddeps: use -mod=readonly instead of -mod=mod

TestAllDependencies is attempting to check that the modules in GOROOT
satisfy certain properties; it should not modify those modules itself.

The “quick” part of the test checks that vendored packages are present
and complete, without constructing a parallel GOROOT. It shouldn't
resolve new dependencies or change formatting in any way.

The longer version of the test already constructs a parallel GOROOT
and tidies the modules within it. That part of the test will flag any
modifications needed to the go.mod and go.sum files, without modifying
the original GOROOT.

From what I can tell, the failure mode in #46695 is caused by running
the test on a module rooted in $GOROOT proper. There is no such module
in the mainline Go repo, but it may have been introduced in the fork
and could also be introduced by stray edits in contributor CLs. It
should be diagnosed clearly.

For #46695

Change-Id: I62b90ccbd54cb3e3b413017021c952a7b1d455e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/328770
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2 years agocmd/go: document GOPPC64 environment variable
Ian Lance Taylor [Sun, 20 Jun 2021 19:22:16 +0000 (12:22 -0700)]
cmd/go: document GOPPC64 environment variable

Change-Id: I2d2c02eec4ac6eca218fa5334d32650c1620692c
Reviewed-on: https://go-review.googlesource.com/c/go/+/329689
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Carlos Eduardo Seo <carlos.seo@linaro.org>
2 years agogo/scanner: fall back to next() when encountering 0 bytes in parseIdentifier
Rob Findley [Mon, 21 Jun 2021 16:52:17 +0000 (12:52 -0400)]
go/scanner: fall back to next() when encountering 0 bytes in parseIdentifier

CL 308611 optimized parseIdentifier for ASCII, but inadvertently skipped
error handling for 0 bytes. Don't take the optimized path when
encountering 0.

Fixes #46855

Change-Id: Ic584e077eb74c012611fefa20eb71ca09c81b3c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/329790
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agodatabase/sql: fix deadlock test in prepare statement
Daniel Theophanes [Mon, 21 Jun 2021 16:11:20 +0000 (11:11 -0500)]
database/sql: fix deadlock test in prepare statement

The issue go#46783 correctly diagnosed the context timeout
caused an intermittent failure when the context was canceled
prior to the BeginTx call. However due to the asynchronous nature
of canceling a Tx through a context on fast systems, the tx.Prepare
also succeeded. On slower systems or if a time.Sleep was inserted
between the BeginTx and Prepare, the Prepare would fail.

Resolve this by moving the context cancel after the Prepare.
This will still trigger the deadlock which I tested locally.
In addition, I interspersed multiple time.Sleep calls and the
test still functioned.

Fixes #46852

Change-Id: I9cbf90d3c12b2555493a37799738772b615ae39d
Reviewed-on: https://go-review.googlesource.com/c/go/+/329830
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>

2 years agoruntime: fix crash during VDSO calls on PowerPC
Derek Parker [Thu, 17 Jun 2021 20:22:40 +0000 (20:22 +0000)]
runtime: fix crash during VDSO calls on PowerPC

This patch reinstates a fix for PowerPC with regard to making VDSO calls
while receiving a signal, and subsequently crashing. The crash happens
because certain VDSO calls can modify the r30 register, which is where g
is stored. This change was reverted for PowerPC because r30 is supposed
to be a non-volatile register. This is true, but that only makes a
guarantee across function calls, but not "within" a function call. This
patch was seemingly fine before because the Linux kernel still had hand
rolled assembly VDSO function calls, however with a recent change to C
function calls it seems the compiler used can generate instructions
which temporarily clobber r30. This means that when we receive a signal
during one of these calls the value of r30 will not be the g as the
runtime expects, causing a segfault.

You can see from this assembly dump how the register is clobbered during
the call:

(the following is from a 5.13rc2 kernel)

```
Dump of assembler code for function __cvdso_clock_gettime_data:
   0x00007ffff7ff0700 <+0>:     cmplwi  r4,15
   0x00007ffff7ff0704 <+4>:     bgt     0x7ffff7ff07f0 <__cvdso_clock_gettime_data+240>
   0x00007ffff7ff0708 <+8>:     li      r9,1
   0x00007ffff7ff070c <+12>:    slw     r9,r9,r4
   0x00007ffff7ff0710 <+16>:    andi.   r10,r9,2179
   0x00007ffff7ff0714 <+20>:    beq     0x7ffff7ff0810 <__cvdso_clock_gettime_data+272>
   0x00007ffff7ff0718 <+24>:    rldicr  r10,r4,4,59
   0x00007ffff7ff071c <+28>:    lis     r9,32767
   0x00007ffff7ff0720 <+32>:    std     r30,-16(r1)
   0x00007ffff7ff0724 <+36>:    std     r31,-8(r1)
   0x00007ffff7ff0728 <+40>:    add     r6,r3,r10
   0x00007ffff7ff072c <+44>:    ori     r4,r9,65535
   0x00007ffff7ff0730 <+48>:    lwz     r8,0(r3)
   0x00007ffff7ff0734 <+52>:    andi.   r9,r8,1
   0x00007ffff7ff0738 <+56>:    bne     0x7ffff7ff07d0 <__cvdso_clock_gettime_data+208>
   0x00007ffff7ff073c <+60>:    lwsync
   0x00007ffff7ff0740 <+64>:    mftb    r30      <---- RIGHT HERE
=> 0x00007ffff7ff0744 <+68>:    ld      r12,40(r6)
```

What I believe is happening is that the kernel changed the PowerPC VDSO
calls to use standard C calls instead of using hand rolled assembly. The
hand rolled assembly calls never touched r30, so this change was safe to
roll back. That does not seem to be the case anymore as on the 5.13rc2
kernel the compiler *is* generating assembly which modifies r30, making
this change again unsafe and causing a crash when the program receives a
signal during these calls (which will happen often due to async
preempt). This change happened here:
https://lwn.net/ml/linux-kernel/235e5571959cfa89ced081d7e838ed5ff38447d2.1601365870.git.christophe.leroy@csgroup.eu/.

I realize this was reverted due to unexplained hangs in PowerPC
builders, but I think we should reinstate this change and investigate
those issues separately:
https://github.com/golang/go/commit/f4ca3c1e0a2066ca4f7bd6203866d282ed34acf2

Fixes #46803

Change-Id: Ib18d7bbfc80a1a9cb558f0098878d41081324b52
GitHub-Last-Rev: c3002bcfca3ef58b27485e31328e6297b7a9dfe7
GitHub-Pull-Request: golang/go#46767
Reviewed-on: https://go-review.googlesource.com/c/go/+/328110
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>

2 years agoruntime/pprof: deflake TestMorestack more
Cherry Mui [Mon, 21 Jun 2021 16:09:43 +0000 (12:09 -0400)]
runtime/pprof: deflake TestMorestack more

Apparently, TestMorestack is still flaky on darwin/arm64 builder
after CL 307730. Let it spend more time in copying the stack.
With this CL, on my Apple M1 machine it passes reliably in short
mode for 1000 runs, and reliably gets 250+ samples in the 5-second
interval in long mode.

May fix #46755.

Change-Id: I07b36c1cf63ad35f7820e1f8e837e29376a37b2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/329869
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2 years agodoc/go1.17: note deprecation of 'go get' for installing commands
Jay Conrod [Fri, 18 Jun 2021 22:07:00 +0000 (15:07 -0700)]
doc/go1.17: note deprecation of 'go get' for installing commands

Fixes #43684

Change-Id: I8982f6816c002c71e62f37a926c8543e34b8b785
Reviewed-on: https://go-review.googlesource.com/c/go/+/329549
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2 years agodoc/go1.17: add Go 1.18 pre-announcements
Filippo Valsorda [Tue, 15 Jun 2021 14:59:58 +0000 (10:59 -0400)]
doc/go1.17: add Go 1.18 pre-announcements

Updates #41682
Updates #45428

Change-Id: Ia31d454284f0e114bd29ba398a2858fc90454032
Reviewed-on: https://go-review.googlesource.com/c/go/+/327811
Trust: Filippo Valsorda <filippo@golang.org>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2 years agodoc/go1.17: add security-related release notes
Filippo Valsorda [Tue, 15 Jun 2021 11:13:08 +0000 (07:13 -0400)]
doc/go1.17: add security-related release notes

Change-Id: I573def0f48fe66a1bc60fff321ab007c76b47ef0
Reviewed-on: https://go-review.googlesource.com/c/go/+/327810
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>

2 years agodoc/go1.17: document go/parser.SkipObjectResolution
Rob Findley [Thu, 17 Jun 2021 16:28:53 +0000 (12:28 -0400)]
doc/go1.17: document go/parser.SkipObjectResolution

Documents the mode added in CL 306149 to skip object resolution.

Fixes #46298

Change-Id: I6a14aaa00790f9f7e4e4ba17033355f5e878d74b
Reviewed-on: https://go-review.googlesource.com/c/go/+/329009
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agocmd/go: do not require the module cache to exist for 'go mod edit'
Bryan C. Mills [Wed, 16 Jun 2021 18:48:45 +0000 (14:48 -0400)]
cmd/go: do not require the module cache to exist for 'go mod edit'

Updates #46695

Change-Id: I4afbc1401ef4183d94c1ac6271394fac1fff95ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/328769
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years agoos/signal: test with a significantly longer fatal timeout
Andrew G. Morgan [Sat, 19 Jun 2021 16:46:52 +0000 (09:46 -0700)]
os/signal: test with a significantly longer fatal timeout

We've observed some occasional os-arch specific timeouts
in signal.TestSignalTrace(). While the main purpose of a
short timeout is to ensure the passing tests complete
quickly, the unexpected failure path can tolerate waiting
longer (the test is not intended to test how slow or
overloaded the OS is at the time it is run).

Fixes #46736
Change-Id: Ib392fc6ce485a919612784ca88ed76c30f4898e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/329502
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>

2 years agodatabase/sql: do not rely on timeout for deadlock test
Daniel Theophanes [Wed, 16 Jun 2021 16:46:00 +0000 (11:46 -0500)]
database/sql: do not rely on timeout for deadlock test

Fixes #46783

Change-Id: I8a8d1716279a041a7411c0c47a440a7997b39c80
Reviewed-on: https://go-review.googlesource.com/c/go/+/328649
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Carlos Amedee <carlos@golang.org>

2 years agoimage: add RGBA64Image interface
Nigel Tao [Sun, 18 Apr 2021 03:38:34 +0000 (13:38 +1000)]
image: add RGBA64Image interface

The new RGBA64At method is equivalent to the existing At method (and the
new SetRGBA64 method is equivalent to the existing Set method in the
image/draw package), but they can avoid allocations from converting
concrete color types to the color.Color interface type.

Also update api/go1.17.txt and doc/go1.17.html

Fixes #44808

Change-Id: I8671f3144512b1200fa373840ed6729a5d61bc35
Reviewed-on: https://go-review.googlesource.com/c/go/+/311129
Trust: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2 years agoruntime: clarify Frames.Next documentation
Matthew Dempsky [Fri, 18 Jun 2021 05:12:24 +0000 (22:12 -0700)]
runtime: clarify Frames.Next documentation

I wrote code that relied on this API, but I misunderstood the original
description of the "more" result. As a consequence, my code always
stopped one frame early.

This CL expands the documentation to be more explicit and specifically
call out my confusion (i.e., that the "more" result indicates whether
the *next* Next call will return a valid Frame, and not whether this
call did).

Change-Id: If135f8f8c05425073d45377c4179e4f79e6bd6ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/329389
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>

2 years agoruntime: disable CPU profiling before removing the SIGPROF handler
Ian Lance Taylor [Fri, 18 Jun 2021 00:34:18 +0000 (17:34 -0700)]
runtime: disable CPU profiling before removing the SIGPROF handler

Otherwise, in c-archive or c-shared mode, there is the chance of
getting a SIGPROF just after the signal handler is removed but before
profiling is disabled, in which case the program will die.

Fixes #46498

Change-Id: I5492beef45fec9fb9a7f58724356d6aedaf799ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/329290
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
3 years agodoc/go1.17: fix typo
Nick Miyake [Fri, 18 Jun 2021 00:19:10 +0000 (00:19 +0000)]
doc/go1.17: fix typo

Change-Id: Ie8629e0f710d3eb95b4bbcc9c680ffc5004c2f15
GitHub-Last-Rev: 52f48f429cdd65692b88f724f757efed1fa39cd2
GitHub-Pull-Request: golang/go#46812
Reviewed-on: https://go-review.googlesource.com/c/go/+/329289
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>

3 years agocmd/pprof,runtime/pprof: disable test on more broken platforms
Michael Pratt [Thu, 17 Jun 2021 19:23:53 +0000 (15:23 -0400)]
cmd/pprof,runtime/pprof: disable test on more broken platforms

runtime/pprof has a more complete list of platforms with broken
profiling than I used in cmd/pprof in https://golang.org/cl/325809.
Duplicate that list in cmd/pprof and clean it up a bit in runtime/pprof
for easier reference.

Change-Id: I8f2580aac223de9b73cfff4355f49916f7b76493
Reviewed-on: https://go-review.googlesource.com/c/go/+/329149
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agocmd/go: replace a TODO with an explanatory comment
Bryan C. Mills [Thu, 17 Jun 2021 18:12:34 +0000 (14:12 -0400)]
cmd/go: replace a TODO with an explanatory comment

I left a TODO to decide whether to add 'go get' arguments as indirect
(as we have in the past), or to make them direct. I considered both
options, and decided to keep the indirect default because it is easier
(and less invasive) for users to fix.

Updates #45979

Change-Id: I1f23a88db59a01bdd9e6fe48c2fffc8a3b55145a
Reviewed-on: https://go-review.googlesource.com/c/go/+/328971
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
3 years agocmd/pprof: make ObjAddr a no-op
Michael Pratt [Mon, 7 Jun 2021 17:28:09 +0000 (13:28 -0400)]
cmd/pprof: make ObjAddr a no-op

https://golang.org/cl/318049 replaced driver.ObjFile.Base with
driver.ObjFile.ObjAddr. We don't support shared libraries, so these
should be no-op, but CL 318049 accidentally failed to account from the
change in no-op behavior from returning 0 to passing through addr.

Fixes #46636

Change-Id: Iab82224c7db722a1e257ec6e305218e22114d0a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/325809
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 years agotesting: drop unusual characters from TempDir directory name
Tobias Klauser [Tue, 8 Jun 2021 13:33:54 +0000 (15:33 +0200)]
testing: drop unusual characters from TempDir directory name

Only use safe characters of the test name for the os.MkdirTemp pattern.
This currently includes the alphanumeric characters and ASCII
punctuation characters known not to interact with globs.

Fixes #46624

Change-Id: I402c34775b943fed9b97963c52f79245cc16dc1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/326010
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agotime: fix receiver for Time.IsDST method
Russ Cox [Thu, 10 Jun 2021 19:14:01 +0000 (15:14 -0400)]
time: fix receiver for Time.IsDST method

Only methods that modify the time take pointer receivers;
IsDST does not modify it and therefore should not.

For #42102 and #46688.

Change-Id: I4721ef7f4d7572236ae6e4d99a459b9ffb11999e
Reviewed-on: https://go-review.googlesource.com/c/go/+/326789
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agodoc/go1.17: fix redundant space
yangwenmai [Wed, 16 Jun 2021 23:01:16 +0000 (07:01 +0800)]
doc/go1.17: fix redundant space

Change-Id: I6fccab7504f928452fbe490ae83e8d4b23a59f06
Reviewed-on: https://go-review.googlesource.com/c/go/+/328849
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 years agocmd/go: in lazy modules, add transitive imports for 'go get' arguments
Bryan C. Mills [Tue, 15 Jun 2021 16:05:01 +0000 (12:05 -0400)]
cmd/go: in lazy modules, add transitive imports for 'go get' arguments

I needed to also update TestScript/mod_sumdb_golang.
It had been relying on 'go list -mod=mod' to add both the go.mod and
go.sum entries for the named package, but when 'go get' actually adds
all of the needed dependencies, lazy loading kicks in and 'go list'
doesn't end up needing the checksums for go.mod files.
We didn't detect the skew before because the 'go list' command was
(unexpectedly) also adding the missing dependencies, which triggered a
deep scan of the complete module graph.

For #45979

Change-Id: Ica917dee22c83ffa71c6ad0f2e189f911b73edf4
Reviewed-on: https://go-review.googlesource.com/c/go/+/328231
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
3 years agocmd/go: add a regression test for #45979
Bryan C. Mills [Fri, 11 Jun 2021 20:39:54 +0000 (16:39 -0400)]
cmd/go: add a regression test for #45979

Change-Id: Id7f83b2e6a99af798e55b272b04880ebb588351f
Reviewed-on: https://go-review.googlesource.com/c/go/+/328230
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
3 years agomath/rand: mention half-open intervals explicitly
Russ Cox [Tue, 15 Jun 2021 16:46:11 +0000 (12:46 -0400)]
math/rand: mention half-open intervals explicitly

If someone sees "in [0,n)" it might look like a typo.
Saying "in the half-open interval [0,n)" will give people
something to search the web for (half-open interval).

Change-Id: I3c343f0a7171891e106e709ca77ab9db5daa5c84
Reviewed-on: https://go-review.googlesource.com/c/go/+/328210
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agocmd/asm: restore supporting of *1 scaling on ARM64
Cherry Mui [Tue, 15 Jun 2021 16:47:57 +0000 (12:47 -0400)]
cmd/asm: restore supporting of *1 scaling on ARM64

On ARM64, instruction like "MOVD (R1)(R2*1), R3" is accepted and
assembles correctly with Go 1.16, but errors out on tip with
"arm64 doesn't support scaled register format", since CL 289589.

"MOVD (R1)(R2), R3" is the preferred form. But the *1 form works
before and assembles correctly. Keep supporting it.

Fixes #46766.

Change-Id: I0f7fd71fa87ea698919a936b6c68aa5a91afd486
Reviewed-on: https://go-review.googlesource.com/c/go/+/328229
Trust: Cherry Mui <cherryyz@google.com>
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: eric fang <eric.fang@arm.com>
3 years agocmd/compile: better error message for invalid untyped operation
Cuong Manh Le [Tue, 15 Jun 2021 14:40:49 +0000 (21:40 +0700)]
cmd/compile: better error message for invalid untyped operation

For typed vs un-typed operation, the compiler do the conversion
un-conditionally, so if the operation is invalid, the error report is
pointed to the conversion, instead of the invalid operation itself.

To fix this, only do the conversion when the operations are valid
for both types.

Fixes #46749

Change-Id: Ib71c7bcd3ed5454e6df55b6a8db4e0f189259ba7
Reviewed-on: https://go-review.googlesource.com/c/go/+/328050
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
3 years agosyscall: fix TestGroupCleanupUserNamespace test failure on Fedora
Rahul Bajaj [Tue, 15 Jun 2021 13:23:10 +0000 (13:23 +0000)]
syscall: fix TestGroupCleanupUserNamespace test failure on Fedora

Fixes #46752

Change-Id: I2eaa9d15fac4e859e18191fcf1372e5be94899df
GitHub-Last-Rev: 8a2672d8dc6713ec6cbd207d870e893062c8fe5b
GitHub-Pull-Request: golang/go#46753
Reviewed-on: https://go-review.googlesource.com/c/go/+/328109
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
3 years agonet/http: improve some server docs
Filippo Valsorda [Thu, 9 Jul 2020 22:49:05 +0000 (18:49 -0400)]
net/http: improve some server docs

Change-Id: I04662a08e07c49f629f9067a89bf453e697d44dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/327813
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
3 years agocmd/go: ignore UTF8 BOM when reading source code
unbyte [Tue, 15 Jun 2021 17:11:05 +0000 (17:11 +0000)]
cmd/go: ignore UTF8 BOM when reading source code

Fix the problem that UTF8 BOM can cause the parsing of import path and directives to fail.

Fixes #46198
Fixes #46290
Fixes #35726

Change-Id: I2d9995ee82b094bcfa5583f0cb4e8547cb973077
GitHub-Last-Rev: 98abf91377f155266fa60505c0c12beccad38eeb
GitHub-Pull-Request: golang/go#46643
Reviewed-on: https://go-review.googlesource.com/c/go/+/325990
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agocmd/link: set correct flags in .dynamic for PIE buildmode
Than McIntosh [Tue, 15 Jun 2021 12:01:54 +0000 (08:01 -0400)]
cmd/link: set correct flags in .dynamic for PIE buildmode

For internal linking, when generating a PIE binary, set the proper
.dynamic section flags to mark the binary as position-independent.

Fixes #46747.

Change-Id: I2b899148c6d06f92c9d12257a9761278b4236dfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/328089
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Than McIntosh <thanm@google.com>