]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
22 months agoMerge "[dev.unified] all: merge master (8e1e64c) into dev.unified" into dev.unified
Gerrit Code Review [Wed, 20 Jul 2022 13:55:41 +0000 (13:55 +0000)]
Merge "[dev.unified] all: merge master (8e1e64c) into dev.unified" into dev.unified

23 months ago[dev.unified] cmd/compile/internal/reflectdata: remove hasRType's `required` param
Matthew Dempsky [Fri, 1 Jul 2022 01:48:02 +0000 (18:48 -0700)]
[dev.unified] cmd/compile/internal/reflectdata: remove hasRType's `required` param

Unified IR now always provides RTTI needed by the backend, no need to
allow exceptions anymore. 🥳

Change-Id: Ie1ba42c81f92cc43e1b01b3289de10e261ccef57
Reviewed-on: https://go-review.googlesource.com/c/go/+/415576
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
23 months ago[dev.unified] cmd/compile/internal/noder: simplify mixed tag/case RTTI wiring
Matthew Dempsky [Mon, 18 Jul 2022 20:45:57 +0000 (13:45 -0700)]
[dev.unified] cmd/compile/internal/noder: simplify mixed tag/case RTTI wiring

The previous CL largely removed the need for worrying about mixed
tag/case comparisons in switch statements by ensuring they're always
converted to a common type, except for one annoying case: switch
statements with an implicit `true` tag, and case values of interface
type (which must be empty interface, because `bool`'s method set is
empty).

It would be simpler to have writer.go desugar the implicit `true`
itself, because we already handle explicit `true` correctly. But the
existing code already works fine, and I don't want to add further
complexity to writer.go until dictionaries and stenciling is done.

Change-Id: Ia8d44c425b1be7fc578cd570d15a7560fe9d2674
Reviewed-on: https://go-review.googlesource.com/c/go/+/418102
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
23 months ago[dev.unified] cmd/compile/internal/noder: better switch statements
Matthew Dempsky [Mon, 18 Jul 2022 19:28:11 +0000 (12:28 -0700)]
[dev.unified] cmd/compile/internal/noder: better switch statements

Walk desugars switch statements into a bunch of OEQ comparisons, and
sometimes (although rarely in practice) this currently requires
converting the tag value to the case value's type. And because this
conversion is inserted during walk, unified IR can't wire up
appropriate RTTI operands for the conversion.

As a simple solution, if any of the case values are *not* assignable
to the tag value's type, we instead convert them all to `any`. This
works because `any(x) == any(y)` yields the same value as `x == y`, as
long as neither `x` nor `y` are `nil`.

We never have to worry about `x` or `y` being `nil` either, because:

1. `switch nil` is invalid, so `x` can never be `nil`.

2. If the tag type is a channel, map, or function type, they
can *only* be compared against `nil`; so the case values will always
be assignable to the tag value's type, and so we won't convert to
`any`.

3. For other nullable types, the previous commit (adding explicit
`nil` handling to unified IR) ensures that `case nil:` is actually
treated as `case tagType(nil):`.

Change-Id: I3adcb9cf0d42a91a12b1a163c58d4133a24fca5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/418101
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
23 months ago[dev.unified] cmd/compile/internal/noder: explicit nil handling
Matthew Dempsky [Mon, 18 Jul 2022 20:13:46 +0000 (13:13 -0700)]
[dev.unified] cmd/compile/internal/noder: explicit nil handling

Currently, uses of "nil" are handling as references to cmd/compile's
own untyped "nil" object, and then we rely on implicitly converting
that to its appropriate type. But there are cases where this can
subtly go wrong (e.g., the switch test case added in the previous CL).

Instead, explicitly handling "nil" expressions so that we can
construct them directly with the appropriate type, as computed already
by types2.

Change-Id: I587f044f60f24e87525dde6d7dad6c58f14478de
Reviewed-on: https://go-review.googlesource.com/c/go/+/418100
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
23 months ago[dev.unified] test: add switch test case for tricky nil handling
Matthew Dempsky [Mon, 18 Jul 2022 20:02:02 +0000 (13:02 -0700)]
[dev.unified] test: add switch test case for tricky nil handling

The next CL will change Unified IR's switch statement handling to
convert values to empty interface in some tricky cases. My initial
attempt at this accidentally mishandled `case nil:` in some cases, and
this wasn't caught by any existing tests. So this CL adds one.

Change-Id: Idcfaf0e869dca91be46d665e65d4623dc52bb60f
Reviewed-on: https://go-review.googlesource.com/c/go/+/418099
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>

23 months ago[dev.unified] cmd/compile/internal/noder: preserve RTTI for select statements
Matthew Dempsky [Mon, 18 Jul 2022 19:41:56 +0000 (12:41 -0700)]
[dev.unified] cmd/compile/internal/noder: preserve RTTI for select statements

In a select statement, `case i = <-c: ...` may require an implicit
conversion of the received value to i's type, but walk does not expect
a conversion here. Instead, typecheck actually discards the
conversion (resulting in ill-typed IR), and then relies on it being
reinserted later when walk desugars the assignment.

However, that might lose the explicit RTTI operands we've set for
conversions to interface type, so explicitly introduce a temporary
variable and rewrite as `case tmp := <-c: i = tmp; ...`, which is
semantically equivalent and allows the `i = tmp` assignment to
maintain the explicit RTTI without confusing the rest of the compiler
frontend.

Change-Id: Ie6c4dc9b19437e83970cd3ce83420813b8a47dc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/418098
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
23 months ago[dev.unified] cmd/compile/internal/noder: wire RTTI for implicit conversions
Matthew Dempsky [Fri, 1 Jul 2022 00:58:47 +0000 (17:58 -0700)]
[dev.unified] cmd/compile/internal/noder: wire RTTI for implicit conversions

This CL updates Unified IR to set the TypeWord and SrcRType fields on
interface conversions, which will be necessary for dictionary support
shortly.

Change-Id: I9486b417f514ba4ec2ee8036194aa9ae3ad0ad93
Reviewed-on: https://go-review.googlesource.com/c/go/+/415575
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months ago[dev.unified] cmd/compile/internal/noder: implicit conversions for binary exprs
Matthew Dempsky [Fri, 1 Jul 2022 02:16:23 +0000 (19:16 -0700)]
[dev.unified] cmd/compile/internal/noder: implicit conversions for binary exprs

Binary operations (except for shifts) require one operand to be
assignable to the other's type. In particular, for equality
comparisons, this can imply a conversion to interface type.

Change-Id: Ic973c8287a40fdaefcf11458378574fdcd243b17
Reviewed-on: https://go-review.googlesource.com/c/go/+/415577
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
23 months ago[dev.unified] test: relax panic message expectations
Matthew Dempsky [Mon, 18 Jul 2022 02:53:19 +0000 (19:53 -0700)]
[dev.unified] test: relax panic message expectations

In this test, traditionally the comparison `*l == r[0]` was left as a
comparison between `*l` (type `any`) and `r[0]` (type `*int`), and the
rest of the compiler needed to handle mixed-typed comparisons.
However, this means more complexity for wiring up explicit rtypes.

To simplify rtype handling, the next CL will change unified IR to
instead handle the expression as `*l == any(r[0])`. However, a
consequence of this currently is that walk will now sequence the
`any(r[0])` expression first, because it involves a
concrete-to-interface conversion. And in turn, this means the `r[0]`
panic ("index out of bounds") will take priority over the `*l`
panic ("nil pointer dereference").

This is a change in user-visible semantics in some cases, but the Go
spec leaves this unspecified, so it shouldn't be an issue. Note also:
gccgo has the same behavior (i.e., panicking on index out of bounds,
not nil pointer dereference), and cmd/compile also already has the
same behavior when the interface conversion is explicit (as in the
added "nil pointer dereference #3" test case).

Updates #23735.
Updates #32187.

Change-Id: I49e5dcca85b4680f9c8780ef0013e64254d38fe5
Reviewed-on: https://go-review.googlesource.com/c/go/+/418097
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
23 months ago[dev.unified] cmd/compile/internal/noder: prefer *At functions
Matthew Dempsky [Mon, 18 Jul 2022 19:15:09 +0000 (12:15 -0700)]
[dev.unified] cmd/compile/internal/noder: prefer *At functions

Unified IR tries to avoid depending on base.Pos, so we should prefer
explicit position arguments wherever possible.

Change-Id: I7163b1b8c5244fe7c2a7989e6a3f459a21a23e81
Reviewed-on: https://go-review.googlesource.com/c/go/+/418096
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months ago[dev.unified] all: merge master (8e1e64c) into dev.unified
David Chase [Tue, 19 Jul 2022 20:55:13 +0000 (16:55 -0400)]
[dev.unified] all: merge master (8e1e64c) into dev.unified

Conflicts:

- test/run.go
Conflicts in the known-fails list, plus removed a test from the known-fails that now works.

Merge List:

+ 2022-07-19 8e1e64c16a cmd/compile: fix mknode script
+ 2022-07-19 28be440d34 A+C: add Weizhi Yan
+ 2022-07-19 85a482fc24 runtime: revert to using the precomputed trigger for pacer calculations
+ 2022-07-19 ae7340ab68 CONTRIBUTORS: update for the Go 1.19 release
+ 2022-07-18 de8101d21b runtime: fix typos
+ 2022-07-18 967a3d985d cmd/compile: revert "remove -installsuffix flag"
+ 2022-07-18 c0c1bbde17 http: improve Get documentation
+ 2022-07-15 2aa473cc54 go/types, types2: correct alignment of atomic.Int64
+ 2022-07-15 4651ebf961 encoding/gob: s/TestIngoreDepthLimit/TestIgnoreDepthLimit/
+ 2022-07-14 dc00aed6de go/parser: skip TestParseDepthLimit for short tests
+ 2022-07-14 783ff7dfc4 encoding/xml: skip TestCVE202230633 for short tests
+ 2022-07-14 aa80228526 cmd/go/internal/modfetch: avoid duplicating path components in Git fetch errors
+ 2022-07-14 b9d5a25442 cmd/go: save zip sums for downloaded modules in 'go mod download' in a workspace
+ 2022-07-14 a906d3dd09 cmd/go: avoid re-enqueuing workspace dependencies with errors
+ 2022-07-14 266c70c263 doc/go1.19: add a release note for 'go list -json=SomeField'
+ 2022-07-13 558785a0a9 cmd/compile: remove -installsuffix flag
+ 2022-07-13 1355ea3045 cmd/compile: remove -importmap flag
+ 2022-07-13 f71f3d1b86 misc/cgo/testshared: run tests only in GOPATH mode
+ 2022-07-13 feada53661 misc/cgo/testcshared: don't rely on an erroneous install target in tests
+ 2022-07-13 c006b7ac27 runtime: clear timerModifiedEarliest when last timer is deleted
+ 2022-07-13 923740a8cc cmd/compile: fix type assert in dict pass
+ 2022-07-12 bf2ef26be3 cmd/go: in script tests, avoid checking non-main packages for staleness
+ 2022-07-12 5f5cae7200 cmd/go: avoid indexing GOROOT packages when the compiler is 'gccgo'
+ 2022-07-12 c2edb2c841 cmd/go: port TestIssue16471 to a script test and add verbose logging
+ 2022-07-12 9c2526e637 cmd/go/internal/modfetch/codehost: add missing newline in '# lock' log message
+ 2022-07-12 85486bcccb image/jpeg: increase TestLargeImageWithShortData timeout by an order of magnitude
+ 2022-07-12 27794c4d4a cmd/go/internal/modload: ignore disallowed errors when checking for updates
+ 2022-07-12 b2b8872c87 compress/gzip: fix stack exhaustion bug in Reader.Read
+ 2022-07-12 ac68c6c683 path/filepath: fix stack exhaustion in Glob
+ 2022-07-12 fa2d41d0ca io/fs: fix stack exhaustion in Glob
+ 2022-07-12 6fa37e98ea encoding/gob: add a depth limit for ignored fields
+ 2022-07-12 695be961d5 go/parser: limit recursion depth
+ 2022-07-12 08c46ed43d encoding/xml: use iterative Skip, rather than recursive
+ 2022-07-12 c4c1993fd2 encoding/xml: limit depth of nesting in unmarshal
+ 2022-07-12 913d05133c cmd/go: avoid spurious readdir during fsys.Walk
+ 2022-07-12 d3d7998756 net/http: clarify that MaxBytesReader returns *MaxBytesError
+ 2022-07-11 126c22a098 syscall: gofmt after CL 412114
+ 2022-07-11 123a6328b7 internal/trace: don't report regions on system goroutines
+ 2022-07-11 846490110a runtime/race: update amd64 syso images to avoid sse4
+ 2022-07-11 b75ad09cae cmd/trace: fix typo in web documentation
+ 2022-07-11 7510e597de cmd/go: make module index loading O(1)
+ 2022-07-11 b8bf820d5d cmd/nm: don't rely on an erroneous install target in tests
+ 2022-07-11 ad641e8521 misc/cgo/testcarchive: don't rely on an erroneous install target in tests
+ 2022-07-11 bf5898ef53 net/url: use EscapedPath for url.JoinPath
+ 2022-07-11 398dcd1cf0 database/sql: make TestTxContextWaitNoDiscard test more robust
+ 2022-07-11 f956941b0f cmd/go: use package index for std in load.loadPackageData
+ 2022-07-11 59ab6f351a net/http: remove Content-Encoding in writeNotModified
+ 2022-07-08 c1a4e0fe01 cmd/compile: fix libfuzzer instrumentation line number
+ 2022-07-08 5c1a13e7a4 cmd/go: avoid setting variables for '/' and ':' in TestScript subprocess environments
+ 2022-07-08 180bcad33d net/http: wait for listeners to exit in Server.Close and Shutdown
+ 2022-07-08 14abe8aa73 cmd/compile: don't convert to interface{} for un-comparable types in generic switch
+ 2022-07-07 1ebc983000 runtime: overestimate the amount of allocated memory in heapLive
+ 2022-07-07 c177d9d98a crypto/x509: restrict CRL number to <=20 octets
+ 2022-07-07 486fc01770 crypto/x509: correctly parse CRL entry extensions
+ 2022-07-07 8ac58de185 crypto/x509: populate Number and AKI of parsed CRLs
+ 2022-07-07 0c7fcf6bd1 cmd/link: explicitly disable PIE for windows/amd64 -race mode
+ 2022-07-07 eaf2125654 cmd/go: default to "exe" build mode for windows -race
+ 2022-07-06 1243ec9c17 cmd/compile: only check implicit dots for method call enabled by a type bound
+ 2022-07-06 c391156f96 cmd/go: set up git identity for build_buildvcs_auto.txt
+ 2022-07-06 2acd3646fc cmd/compile: rework induction variable detector
+ 2022-07-06 53a4152d47 os/exec: clarify that Wait must be called
+ 2022-07-06 177306f630 cmd/internal/notsha256: add purego tag as needed
+ 2022-07-06 f4755fc733 cmd/dist: use purego tag when building the bootstrap binaries
+ 2022-07-06 4484c30f78 misc/cgo/test: make TestSetgidStress cheaper
+ 2022-07-06 2007599dc8 test: recognize new gofrontend error message
+ 2022-07-05 d602380f58 cmd/compile: drop "buildcfg" from no instrument packages
+ 2022-07-05 c111091071 cmd/go: make module@nonexistentversion failures reusable
+ 2022-07-05 5f305ae8e5 cmd/go: add -reuse flag to make proxy invocations more efficient
+ 2022-07-05 84e091eef0 cmd/go: record origin metadata during module download
+ 2022-07-04 ceda93ed67 build/constraint: update doc to mention a feature added in Go 1.17
+ 2022-07-04 3cf79d9610 runtime: pass correct string to exits on Plan 9
+ 2022-07-01 e822b1e26e net/http: omit invalid header value from error message
+ 2022-07-01 4a2a3bca18 cmd/go, go/build: clarify build constraint docs
+ 2022-07-01 9a4d5357f4 flag: highlight support for double dashes in docs
+ 2022-07-01 c847a2c9f0 go/types, types2: document that exported predicates are unspecified for invalid type arguments
+ 2022-06-30 405c269b85 go/types, types2: re-enable a couple of commented out tests
+ 2022-06-30 aad9382e59 go/doc/comment: support links in lists in comments
+ 2022-06-30 af725f4286 os: fix a typo in path_windows.go

Change-Id: I381728322188aca0bfa81a946d6aedda8c07903c

23 months agocmd/compile: fix mknode script
Keith Randall [Tue, 19 Jul 2022 16:07:38 +0000 (09:07 -0700)]
cmd/compile: fix mknode script

It's not currently working. Somehow a field of type []constant.Value
causes it to barf. (That field was added with jump table statements.)

Also added some instructions about how to run it correctly (which took
me a suprisingly long time to figure out).

Larger improvements coming, but this gets us to a working state
and is safe for 1.19.

Change-Id: I3027356fde1294942e87d075ca28bb40d2c0d6c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/418234
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Keith Randall <khr@golang.org>

23 months ago[dev.unified] test: change Unicode file/package name to use characters not translated...
David Chase [Tue, 19 Jul 2022 19:20:55 +0000 (15:20 -0400)]
[dev.unified] test: change Unicode file/package name to use characters not translated by macOS.

In filenames, macOS translates Ä (U+00c4, c3 84) to Ä (U+0041 U+0308, 41 cc 88).
This causes problems for run.go's crude rules for testing the compiler.

Fixes #53954.

Change-Id: I850421cbf07e022ca5ff8122e0fb4e80deb55adf
Reviewed-on: https://go-review.googlesource.com/c/go/+/418334
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
23 months agoA+C: add Weizhi Yan
yanweizhi [Tue, 19 Jul 2022 10:56:23 +0000 (18:56 +0800)]
A+C: add Weizhi Yan

Change-Id: I2cef8fa2a61fc69b9b21ff75428af428d99ae2f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/418174
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

23 months agoruntime: revert to using the precomputed trigger for pacer calculations
Michael Anthony Knyszek [Thu, 14 Jul 2022 21:19:37 +0000 (21:19 +0000)]
runtime: revert to using the precomputed trigger for pacer calculations

Issue #53738 describes in detail how switching to using the actual
trigger point over the precomputed trigger causes a memory regression,
that arises from the fact that the PI controller in front of the
cons/mark ratio has a long time constant (for overdamping), so it
retains a long history of inputs.

This change, for the Go 1.19 cycle, just reverts to using the
precomputed trigger because it's safer, but in the future we should
consider moving away from such a history-sensitive smoothing function.

See the big comment in the diff and #53738 for more details.

Performance difference vs. 1.18 after this change:
https://perf.golang.org/search?q=upload:20220714.15

Fixes #53738.

Change-Id: I636993a730a3eaed25da2a2719860431b296c6f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/417557
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>

23 months agoCONTRIBUTORS: update for the Go 1.19 release
Carlos Amedee [Mon, 18 Jul 2022 16:42:25 +0000 (12:42 -0400)]
CONTRIBUTORS: update for the Go 1.19 release

This update was created using the updatecontrib command:

go install golang.org/x/build/cmd/updatecontrib@latest
cd gotip
updatecontrib

With manual changes based on publicly available information
to canonicalize letter case and formatting for a few names.

For #12042.

Change-Id: I5e648b99004026513c5772b579a72b7add970db4
Reviewed-on: https://go-review.googlesource.com/c/go/+/418016
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months ago[dev.unified] cmd/compile/internal/reflectdata: prefer ITabAddrAt in ConvIfaceTypeWord
Matthew Dempsky [Fri, 1 Jul 2022 02:38:10 +0000 (19:38 -0700)]
[dev.unified] cmd/compile/internal/reflectdata: prefer ITabAddrAt in ConvIfaceTypeWord

We already have an explicit `pos` parameter, so we should use
ITabAddrAt instead of ITabAddr (which uses `base.Pos` instead).

Change-Id: I7c8c5ae93d0ae7a6467cc972575cb547981576f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/415578
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agoruntime: fix typos
Jun10ng [Sat, 16 Jul 2022 14:31:14 +0000 (14:31 +0000)]
runtime: fix typos

"finializer" =>  "finalizer"

Change-Id: Ia3c12bff8556b6a8d33b700c59357f47502757b1
GitHub-Last-Rev: c64cf47974020c8480039ba61d0890bdc07a3b0f
GitHub-Pull-Request: golang/go#53917
Reviewed-on: https://go-review.googlesource.com/c/go/+/417915
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
23 months agocmd/compile: revert "remove -installsuffix flag"
Matthew Dempsky [Mon, 18 Jul 2022 17:03:30 +0000 (17:03 +0000)]
cmd/compile: revert "remove -installsuffix flag"

This reverts CL 415236 (commit 558785a0a9df5fbb7e9617c05059cf2892884620).

Reason for revert: Google's internal build system uses -installsuffix.
Restoring -installsuffix for Go 1.19, and will try again for Go 1.20.

Change-Id: Id6571f34f99f01bcf55e8e949e6fe7b6c1896134
Reviewed-on: https://go-review.googlesource.com/c/go/+/418036
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
23 months agohttp: improve Get documentation
minherz [Mon, 13 Jun 2022 05:26:02 +0000 (22:26 -0700)]
http: improve Get documentation

The existing documentation is unclear about header keys formatting.
The clarifying sentence is added to Get function to emphasis that
keys have to be stored in canonical format to have Get returining
non empty value.

Fixes #53140

Change-Id: Icd0955bcbb6676cec028fe37042aed5846e13ed1
Reviewed-on: https://go-review.googlesource.com/c/go/+/417975
Run-TryBot: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
23 months agogo/types, types2: correct alignment of atomic.Int64
Austin Clements [Wed, 13 Jul 2022 19:18:41 +0000 (15:18 -0400)]
go/types, types2: correct alignment of atomic.Int64

atomic.Int64 has special logic in the compiler to ensure it's 8-byte
aligned on 32-bit architectures. The equivalent logic is missing in
go/types, which means the compiler and go/types can come to different
conclusions about the layout of types.

Fix this by mirroring the compiler's logic into go/types.

Fixes #53884.

Change-Id: I3f58a56babb76634839a161ca174c8f085fe3ba4
Reviewed-on: https://go-review.googlesource.com/c/go/+/417555
Reviewed-by: Robert Findley <rfindley@google.com>
23 months agoencoding/gob: s/TestIngoreDepthLimit/TestIgnoreDepthLimit/
Ian Lance Taylor [Fri, 15 Jul 2022 02:47:59 +0000 (19:47 -0700)]
encoding/gob: s/TestIngoreDepthLimit/TestIgnoreDepthLimit/

For #53615

Change-Id: Ib85004d400931094fc1ea933cf73f4a5157aece1
Reviewed-on: https://go-review.googlesource.com/c/go/+/417559
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
23 months agogo/parser: skip TestParseDepthLimit for short tests
Roland Shoemaker [Thu, 14 Jul 2022 20:00:05 +0000 (13:00 -0700)]
go/parser: skip TestParseDepthLimit for short tests

Because it requires a not insignificant amount of memory to run. Also
remove the WASM-only skip from TestScopeDepthLimit, which is less
intensive.

Fixes #53816

Change-Id: I8463046510ce4dd3d8f6d66938828d5e6963c3be
Reviewed-on: https://go-review.googlesource.com/c/go/+/417657
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>

23 months agoencoding/xml: skip TestCVE202230633 for short tests
Roland Shoemaker [Thu, 14 Jul 2022 19:09:19 +0000 (12:09 -0700)]
encoding/xml: skip TestCVE202230633 for short tests

TestCVE202230633 uses a bunch of memory, and the input cannot be
feasibly reduced while maintaining the behavior hasn't regressed. This
test could be reasonably removed, but I'd rather keep it around if we
can.

Fixes #53814

Change-Id: Ie8b3f306efd20b2d9c0fb73122c26351a55694c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/417655
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
23 months agocmd/go/internal/modfetch: avoid duplicating path components in Git fetch errors
Bryan C. Mills [Wed, 16 Feb 2022 19:07:06 +0000 (14:07 -0500)]
cmd/go/internal/modfetch: avoid duplicating path components in Git fetch errors

Fixes #51114

Change-Id: Iebfe65f826b7b583ff2b48b8bc9d2eb23f2726af
Reviewed-on: https://go-review.googlesource.com/c/go/+/386234
Reviewed-by: Valentin Deleplace <deleplace@google.com>
Reviewed-by: Nooras Saba‎ <saba@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>

23 months agocmd/go: save zip sums for downloaded modules in 'go mod download' in a workspace
Bryan C. Mills [Thu, 14 Jul 2022 18:44:21 +0000 (14:44 -0400)]
cmd/go: save zip sums for downloaded modules in 'go mod download' in a workspace

Within a single module we expect all needed checksums to have already
been recorded by a previous call to 'go get' or 'go mod tidy' in that
module. However, when we combine multiple modules in a workspace, they
may upgrade each other's dependencies, so a given module might be
upgraded above the highest version recorded in the individual go.sum
files for the workspace modules.

Since the checksums might not be present in individual go.sum files,
record them in go.work.sum.

Fixes #51946.

Change-Id: Icb4ea874b9e5c5b1950d42650974a24b5d6543d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/417654
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>

23 months agocmd/go: avoid re-enqueuing workspace dependencies with errors
Bryan C. Mills [Thu, 14 Jul 2022 14:51:56 +0000 (10:51 -0400)]
cmd/go: avoid re-enqueuing workspace dependencies with errors

Fixes #53874.

Change-Id: I41ab15cb9b86b807a9d9ad21fe21fb7aa5fbb46f
Reviewed-on: https://go-review.googlesource.com/c/go/+/417594
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agodoc/go1.19: add a release note for 'go list -json=SomeField'
Bryan C. Mills [Thu, 14 Jul 2022 15:37:17 +0000 (11:37 -0400)]
doc/go1.19: add a release note for 'go list -json=SomeField'

For #29666.

Change-Id: I575375fb039e5809b0ed2ce985f6352a61142d63
Reviewed-on: https://go-review.googlesource.com/c/go/+/417595
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Bryan Mills <bcmills@google.com>

23 months agocmd/compile: remove -installsuffix flag
Matthew Dempsky [Wed, 29 Jun 2022 20:20:36 +0000 (13:20 -0700)]
cmd/compile: remove -installsuffix flag

Obsoleted by -importcfg.

cmd/link has a similar flag, but it seems to still be needed at least
for misc/cgo/testshared.TestGopathShlib. I can't immediately tell why
(has something to do with finding .so files), but it doesn't appear to
possibly affect cmd/compile.

Updates #51225.

Change-Id: I80c6aef860bd162c010ad4a1a4f532b400cf901c
Reviewed-on: https://go-review.googlesource.com/c/go/+/415236
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agocmd/compile: remove -importmap flag
Matthew Dempsky [Wed, 29 Jun 2022 20:03:51 +0000 (13:03 -0700)]
cmd/compile: remove -importmap flag

Obsoleted by -importcfg, and no longer used by anything.

Updates #51225.

Change-Id: I49e646d2728347f862f90805051bb03dd4f4bed2
Reviewed-on: https://go-review.googlesource.com/c/go/+/415235
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
23 months agomisc/cgo/testshared: run tests only in GOPATH mode
Bryan C. Mills [Tue, 12 Jul 2022 18:41:33 +0000 (14:41 -0400)]
misc/cgo/testshared: run tests only in GOPATH mode

-buildmode=shared installs shared libraries into GOROOT
and expects to reuse them across builds.
Builds in module mode, however, each have their own set of
dependencies (determined by the module's requirements), so in general
cannot share dependencies with a single GOROOT.

Ideally in the long term we would like to eliminate -buildmode=shared
entirely (see #47788), but first we need a replacement for the subset
of use-cases where it still works today.

In the meantime, we should run these tests only in GOPATH mode.
Non-main packages in module mode should not be installed to
GOPATH/pkg, but due to #37015 they were installed there anyway,
and this test heavily relies on installing non-main packages.

For #37015.

Change-Id: I7c5d90b4075d6f33e3505d6a8f12752309ae5c03
Reviewed-on: https://go-review.googlesource.com/c/go/+/417194
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>

23 months agomisc/cgo/testcshared: don't rely on an erroneous install target in tests
Bryan C. Mills [Tue, 12 Jul 2022 17:43:02 +0000 (13:43 -0400)]
misc/cgo/testcshared: don't rely on an erroneous install target in tests

Non-main packages in module mode should not be installed to
GOPATH/pkg, but due to #37015 they were installed there anyway.

This change switches the 'go install' command in createHeaders to
instead use 'go build' (with an extension determined by the install
target for 'runtime/cgo', which is well-defined at least for the
moment), and switches TestCachedInstall (which appears to be
explicitly testing 'go install') to explicitly request GOPATH mode
(which provides a well-defined install target for the library).

This change follows a similar structure to CL 416954.

For #37015.

Change-Id: I22ae4af0f0d4c50adc9e0f0dc279859d1f258cc8
Reviewed-on: https://go-review.googlesource.com/c/go/+/417096
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
23 months agoruntime: clear timerModifiedEarliest when last timer is deleted
Michael Pratt [Wed, 13 Jul 2022 15:48:04 +0000 (11:48 -0400)]
runtime: clear timerModifiedEarliest when last timer is deleted

timerModifiedEarliest contains the lowest possible expiration for a
modified earlier timer, which may be earlier than timer0When because we
haven't yet updated the heap. Note "may", as the modified earlier timer
that set timerModifiedEarliest may have since been modified later or
deleted.

We can clear timerModifiedEarliest when the last timer is deleted
because by definition there must not be any modified earlier timers.

Why does this matter? checkTimersNoP claims that there is work to do if
timerModifiedEarliest has passed, causing findRunnable to loop back
around to checkTimers. But the code to clean up timerModifiedEarliest in
checkTimers (i.e., the call to adjusttimers) is conditional behind a
check that len(pp.timers) > 0.

Without clearing timerModifiedEarliest, a spinning M that would
otherwise go to sleep will busy loop in findRunnable until some other
work is available.

Note that changing the condition on the call to adjusttimers would also
be a valid fix. I took this approach because it feels a bit cleaner to
clean up timerModifiedEarliest as soon as it is known to be irrelevant.

Fixes #51654.

Change-Id: I3f3787c67781cac7ce87939c5706cef8db927dd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/417434
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
23 months agocmd/compile: fix type assert in dict pass
Wayne Zuo [Sun, 10 Jul 2022 03:11:05 +0000 (11:11 +0800)]
cmd/compile: fix type assert in dict pass

For type assertions, if src type is empty interface, we should
use normal type assertions rather than dynamic type assertions.

Fixes #53762

Change-Id: I596b2e4ad647fe5e42ad884f7273c78f8f50dac2
Reviewed-on: https://go-review.googlesource.com/c/go/+/416736
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
23 months agocmd/go: in script tests, avoid checking non-main packages for staleness
Bryan C. Mills [Mon, 11 Jul 2022 19:12:06 +0000 (15:12 -0400)]
cmd/go: in script tests, avoid checking non-main packages for staleness

Non-main packages in module mode should not be installed to
GOPATH/pkg, but due to #37015 they were installed there anyway.
Lacking a proper install location, 'go install' becomes a no-op
for non-main packages in module mode.

This change switches the 'go install' commands in the test_fuzz_cache
and build_overlay tests to instead use 'go build', using the '-x' flag
to check for compile commands instead of querying 'go list' about
staleness.

For #37015.

Change-Id: I56d80cf2a43efb6163c62082c86cd3e4f0ff73c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/417095
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
23 months agocmd/go: avoid indexing GOROOT packages when the compiler is 'gccgo'
Bryan C. Mills [Tue, 12 Jul 2022 14:48:47 +0000 (10:48 -0400)]
cmd/go: avoid indexing GOROOT packages when the compiler is 'gccgo'

The gccgo compiler does not load standard-library packages from
GOROOT/src, so we cannot load those packages from the GOROOT/src
index when using that compiler.

This fixes TestScript/gccgo_link_c (and perhaps other gccgo tests)
when a 'gccgo' executable is present. Unfortunately, only a few
builders caught the broken test because 'gccgo' is not installed
on most Go project builders (see #35786).

For #53577.
Fixes #53815.

Change-Id: I11a5cf6dbf4ac9893c4d02bd6ab7ef60f67b1e87
Reviewed-on: https://go-review.googlesource.com/c/go/+/417094
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
23 months agocmd/go: port TestIssue16471 to a script test and add verbose logging
Bryan C. Mills [Fri, 7 Jan 2022 19:17:51 +0000 (14:17 -0500)]
cmd/go: port TestIssue16471 to a script test and add verbose logging

For #50471

Change-Id: I082c1f96113a3228f2ef423a04eaa9fbaa6c7522
Reviewed-on: https://go-review.googlesource.com/c/go/+/376359
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agocmd/go/internal/modfetch/codehost: add missing newline in '# lock' log message
Bryan C. Mills [Wed, 4 May 2022 15:11:20 +0000 (11:11 -0400)]
cmd/go/internal/modfetch/codehost: add missing newline in '# lock' log message

Change-Id: Ib92e983b6cdeed2b275a028c85b2bba583def059
Reviewed-on: https://go-review.googlesource.com/c/go/+/403850
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
23 months agoimage/jpeg: increase TestLargeImageWithShortData timeout by an order of magnitude
Bryan C. Mills [Wed, 25 May 2022 15:09:56 +0000 (11:09 -0400)]
image/jpeg: increase TestLargeImageWithShortData timeout by an order of magnitude

Also dump goroutines on failure.

The original bug report in #10413 reported a hang of “several
minutes”. An apparently-spurious failure was observed in
https://build.golang.org/log/e5ac3ce3fb7d04ec13e5bbfadea8bb5869a4dd1e,
with a delay of only 3.64s.

Moreover, if the test does fail due to a regression, we will want a
goroutine dump to diagnose where it got stuck. The current call to
t.Fatalf does not produce such a dump, so is not nearly as useful if
the failure only occasionally reproduces.

Updates #10413.

Change-Id: I6ab9d112f14f438a0c54e02ec95934627acdc64b
Reviewed-on: https://go-review.googlesource.com/c/go/+/408355
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Yuval Pavel Zholkover <paulzhol@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agocmd/go/internal/modload: ignore disallowed errors when checking for updates
Jay Conrod [Wed, 29 Jun 2022 01:15:32 +0000 (18:15 -0700)]
cmd/go/internal/modload: ignore disallowed errors when checking for updates

addUpdate calls Query with the query "upgrade". Normally, this returns
the highest release version (or prerelease, etc.) that is higher than
the current version and is not retracted or excluded. If there is no
such version, Query should return the current version. If the current
version is retracted or excluded, then Query currently returns an error.

addUpdate should ignore this error, as it ignores ErrNotExist and
NoMatchingVersionError. For 'go list -m -u', addRetraction is also
called, and that will detect the retraction.

Fixes #53594

Change-Id: I90a2872cdeabf03894acad9e0cbdd7db4a4e269e
Reviewed-on: https://go-review.googlesource.com/c/go/+/414825
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
23 months agointernal/pkgbits: change EnableSync into a dynamic knob
Matthew Dempsky [Tue, 12 Jul 2022 18:04:44 +0000 (11:04 -0700)]
internal/pkgbits: change EnableSync into a dynamic knob

Rather than requiring users to recompile the compiler and all tools to
enable/disable sync markers, this CL adds a flag word into the Unified
IR file format to allow indicating whether they're enabled or not.
This in turn requires bumping the file format version.

Thanks to drchase@ for benchmarks showing this isn't as expensive as I
feared it would be.

Change-Id: I99afa0ee0b6ef5f30ed8ca840805ff9fd46b1857
Reviewed-on: https://go-review.googlesource.com/c/go/+/417097
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agocompress/gzip: fix stack exhaustion bug in Reader.Read
Tatiana Bradley [Fri, 6 May 2022 15:25:06 +0000 (11:25 -0400)]
compress/gzip: fix stack exhaustion bug in Reader.Read

Replace recursion with iteration in Reader.Read to avoid stack
exhaustion when there are a large number of files.

Fixes CVE-2022-30631
Fixes #53168

Change-Id: I47d8afe3f2d40b0213ab61431df9b221794dbfe0
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1455673
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417067
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agopath/filepath: fix stack exhaustion in Glob
Julie Qiu [Thu, 23 Jun 2022 23:18:56 +0000 (23:18 +0000)]
path/filepath: fix stack exhaustion in Glob

A limit is added to the number of path separators allowed by an input to
Glob, to prevent stack exhaustion issues.

Thanks to Juho Nurminen of Mattermost who reported the issue.

Fixes CVE-2022-30632
Fixes #53416

Change-Id: I1b9fd4faa85411a05dbc91dceae1c0c8eb021f07
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1498176
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417066
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>

23 months agoio/fs: fix stack exhaustion in Glob
Julie Qiu [Thu, 23 Jun 2022 23:17:53 +0000 (23:17 +0000)]
io/fs: fix stack exhaustion in Glob

A limit is added to the number of path separators allowed by an input to
Glob, to prevent stack exhaustion issues.

Thanks to Juho Nurminen of Mattermost who reported a similar issue in
path/filepath.

Fixes CVE-2022-30630
Fixes golang/go#53415

Change-Id: I5a9d02591fed90cd3d52627f5945f1301e53465d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1497588
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417065
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
23 months agoencoding/gob: add a depth limit for ignored fields
Roland Shoemaker [Tue, 7 Jun 2022 20:00:43 +0000 (13:00 -0700)]
encoding/gob: add a depth limit for ignored fields

Enforce a nesting limit of 10,000 for ignored fields during decoding
of messages. This prevents the possibility of triggering stack
exhaustion.

Fixes #53615
Fixes CVE-2022-30635

Change-Id: I05103d06dd5ca3945fcba3c1f5d3b5a645e8fb0f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1484771
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417064
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>

23 months agogo/parser: limit recursion depth
Roland Shoemaker [Wed, 15 Jun 2022 17:43:05 +0000 (10:43 -0700)]
go/parser: limit recursion depth

Limit nested parsing to 100,000, which prevents stack exhaustion when
parsing deeply nested statements, types, and expressions. Also limit
the scope depth to 1,000 during object resolution.

Thanks to Juho Nurminen of Mattermost for reporting this issue.

Fixes #53616
Fixes CVE-2022-1962

Change-Id: I4d7b86c1d75d0bf3c7af1fdea91582aa74272c64
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1491025
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417063
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agoencoding/xml: use iterative Skip, rather than recursive
Roland Shoemaker [Tue, 29 Mar 2022 01:41:26 +0000 (18:41 -0700)]
encoding/xml: use iterative Skip, rather than recursive

Prevents exhausting the stack limit in _incredibly_ deeply nested
structures.

Fixes #53614
Fixes CVE-2022-28131

Change-Id: I47db4595ce10cecc29fbd06afce7b299868599e6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1419912
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417062
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agoencoding/xml: limit depth of nesting in unmarshal
Roland Shoemaker [Tue, 29 Mar 2022 22:52:09 +0000 (15:52 -0700)]
encoding/xml: limit depth of nesting in unmarshal

Prevent exhausting the stack limit when unmarshalling extremely deeply
nested structures into nested types.

Fixes #53611
Fixes CVE-2022-30633

Change-Id: Ic6c5d41674c93cfc9a316135a408db9156d39c59
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1421319
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417061
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agocmd/go: avoid spurious readdir during fsys.Walk
Russ Cox [Wed, 6 Jul 2022 17:21:34 +0000 (13:21 -0400)]
cmd/go: avoid spurious readdir during fsys.Walk

fsys.Walk is cloned from filepath.Walk, which has always handled
a walk of a directory by reading the full directory before calling the
callback on the directory itself. So if the callback returns fs.SkipDir,
those entries are thrown away, but the expense of reading them was
still incurred. (Worse, this is the expensive directory read that also
calls Stat on every entry.) On machines with slow file system I/O,
these reads are particularly annoying. For example, if I do

go list m...

there is a call to filepath.Walk that is told about $GOROOT/src/archive
and responds by returning filepath.SkipDir because archive does not
start with m, but it only gets the chance to do that after the archive
directory has been read. (Same for all the other top-level directories.)
Even something like go list github.com/foo/bar/... reads every top-level
$GOPATH/src directory.

When we designed filepath.WalkDir, one of the changes we made was
to allow calling the callback twice for a directory: once before reading it,
and then possibly again if the read produces an error (uncommon).
This CL changes fsys.Walk to use that same model. None of the callbacks
need changing, but now the $GOROOT/src/archive and other top-level
directories won't be read when evaluating a pattern like 'm...'.

For #53577.
Fixes #53765.

Change-Id: Idfa3b9e2cc335417bfd9d66dd584cb16f92bd12e
Reviewed-on: https://go-review.googlesource.com/c/go/+/416179
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agonet/http: clarify that MaxBytesReader returns *MaxBytesError
Damien Neil [Mon, 11 Jul 2022 16:49:14 +0000 (09:49 -0700)]
net/http: clarify that MaxBytesReader returns *MaxBytesError

A MaxBytesReader returns a *MaxBytesError when reading beyond
its limit, not a MaxBytesError.

Fixes #53764.

Change-Id: Icac3aeac96fd8b172f951241f8f111cda633752c
Reviewed-on: https://go-review.googlesource.com/c/go/+/416914
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agosyscall: gofmt after CL 412114
Tobias Klauser [Mon, 11 Jul 2022 17:10:00 +0000 (19:10 +0200)]
syscall: gofmt after CL 412114

Change-Id: Ie51545eaebd22a31379bf8814a2c62b91d1d105b
Reviewed-on: https://go-review.googlesource.com/c/go/+/416934
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
23 months agointernal/trace: don't report regions on system goroutines
Michael Pratt [Mon, 11 Jul 2022 19:34:26 +0000 (15:34 -0400)]
internal/trace: don't report regions on system goroutines

If a goroutine is started within a user region, internal/trace assigns
the child goroutine a nameless region for its entire lifetime which is
assosciated the same task as the parent's region.

This is not strictly necessary: a child goroutine is not necessarily
related to the task unless it performs some task operation (in which
case it will be associated with the task through the standard means).

However, it can be quite handy to see child goroutines within a region,
which may be child worker goroutines that you simply didn't perform task
operations on.

If the first GC occurs during a region, the GC worker goroutines will
also inherit a child region. We know for sure that these aren't related
to the task, so filter them out from the region list.

Note that we can't exclude system goroutines from setting activeRegions
in EvGoCreate handling, because we don't know the goroutine start
function name until the first EvGoStart.

Fixes #53784.

Change-Id: Ic83d84e23858a8400a76d1ae2f1418ef49951178
Reviewed-on: https://go-review.googlesource.com/c/go/+/416858
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
23 months agoruntime/race: update amd64 syso images to avoid sse4
Than McIntosh [Mon, 11 Jul 2022 19:20:13 +0000 (15:20 -0400)]
runtime/race: update amd64 syso images to avoid sse4

Rebuild selected amd64 syso images with updated LLVM build rules that
avoid the use of SSE4, so as to ensure that the Go race detector
continues to work on older x86 cpus. No changes to the syso files for
openbsd/amd64 (upstream support has been removed in LLVM) or
netbsd/amd64 (work still in progress there).

Fixes #53743.

Change-Id: I738ae4d1e0528c6e06dd4ddb78e7039a30a51779
Reviewed-on: https://go-review.googlesource.com/c/go/+/416857
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>

23 months agocmd/trace: fix typo in web documentation
Tobias Klauser [Mon, 11 Jul 2022 17:10:50 +0000 (19:10 +0200)]
cmd/trace: fix typo in web documentation

Change-Id: I950224c3f698fbdf2bcab6f847f4afddaa6e9c2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/416974
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
23 months agocmd/go: make module index loading O(1)
Russ Cox [Wed, 6 Jul 2022 13:49:32 +0000 (09:49 -0400)]
cmd/go: make module index loading O(1)

For a large module, opening the index was populating tables with
entries for every package in the module. If we are only using a small
number of those packages, this is wasted work that can dwarf the
benefit from the index.

This CL changes the index reader to avoid loading all packages
at module index open time. It also refactors the code somewhat
for clarity.

It also removes some duplication by defining that a per-package
index is a per-module index containing a single package, rather
than having two different formats and two different decoders.

It also changes the string table to use uvarint-prefixed data
instead of having to scan for a NUL byte. This makes random access
to long strings more efficient - O(1) instead of O(n) - and can significantly
speed up the strings.Compare operation in the binary search looking
for a given package.

Also add a direct test of the indexing code.

For #53577.

Change-Id: I7428d28133e4e7fe2d2993fa014896cd15af48af
Reviewed-on: https://go-review.googlesource.com/c/go/+/416178
Reviewed-by: Bryan Mills <bcmills@google.com>
23 months agocmd/nm: don't rely on an erroneous install target in tests
Bryan C. Mills [Mon, 11 Jul 2022 17:32:40 +0000 (13:32 -0400)]
cmd/nm: don't rely on an erroneous install target in tests

Non-main packages in module mode should not be installed to
GOPATH/pkg, but due to #37015 they were installed there anyway.
This change switches the 'go install' command in testGoLib to instead
use 'go build -buildmode=archive' with an explicit output file.

For #37015.

Change-Id: I15781aa33d1b2adc6a4437a58622276f4e20b889
Reviewed-on: https://go-review.googlesource.com/c/go/+/416955
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>

23 months agomisc/cgo/testcarchive: don't rely on an erroneous install target in tests
Bryan C. Mills [Mon, 11 Jul 2022 17:06:56 +0000 (13:06 -0400)]
misc/cgo/testcarchive: don't rely on an erroneous install target in tests

Non-main packages in module mode should not be installed to
GOPATH/pkg, but due to #37015 they were installed there anyway.

This change switches the 'go install' command in TestPIE to instead
use 'go build', and switches TestInstall and TestCachedInstall
(which appear to be explicitly testing 'go install') to explicitly
request GOPATH mode (which does have a well-defined install target).

For #37015.

Change-Id: Ifb24657d2781d1e35cf40078e8e3ebf56aab9cc8
Reviewed-on: https://go-review.googlesource.com/c/go/+/416954
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
23 months agonet/url: use EscapedPath for url.JoinPath
Sean Liao [Sat, 9 Jul 2022 17:38:45 +0000 (18:38 +0100)]
net/url: use EscapedPath for url.JoinPath

Fixes #53763

Change-Id: I08b53f159ebdce7907e8cc17316fd0c982363239
Reviewed-on: https://go-review.googlesource.com/c/go/+/416774
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

23 months agodatabase/sql: make TestTxContextWaitNoDiscard test more robust
Dmitri Goutnik [Sat, 9 Jul 2022 12:36:45 +0000 (07:36 -0500)]
database/sql: make TestTxContextWaitNoDiscard test more robust

Similar to CL 385934, rely on waiter trigger instead of the WAIT query
prefix and factor out the common test code.

Fixes #53222

Change-Id: I46efc85ca102b350bb4dbe8e514921e016870ffb
Reviewed-on: https://go-review.googlesource.com/c/go/+/416655
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Dmitri Goutnik <dgoutnik@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
23 months agocmd/go: use package index for std in load.loadPackageData
Russ Cox [Tue, 5 Jul 2022 17:53:35 +0000 (13:53 -0400)]
cmd/go: use package index for std in load.loadPackageData

load.loadPackageData was only using an index for modules,
not for standard library packages. Other parts of the code were
using the index, so there was some benefit, but not as much
as you'd hope.

With the index disabled, the Script/work test takes 2.2s on my Mac.
With the index enabled before this CL, it took 2.0s.
With the index enabled after this CL, it takes 1.6s.

Before this CL, the Script/work test issued:

 429 IsDir
  19 IsDirWithGoFiles
   7 Lstat
9072 Open
 993 ReadDir
 256 Stat
   7 Walk
   3 indexModule
  24 openIndexModule
 525 openIndexPackage

After this CL, it issued:

  19 IsDirWithGoFiles
   7 Lstat
  60 Open
 606 ReadDir
 256 Stat
   7 Walk
   3 indexModule
  24 openIndexModule
 525 openIndexPackage

This speedup helps the Dragonfly builder, which has very slow
file I/O and is timing out since a recent indexing change.

Times for go test -run=Script/^work$ on the Dragonfly builder:

50s before indexing changes
31s full module indexing of std
46s per-package indexing of std

It cuts the time for go test -run=Script/^work$ from 44s to 20s.

For #53577.

Change-Id: I7189a77fc7fdf61de3ab3447efc4e84d1fc52c25
Reviewed-on: https://go-review.googlesource.com/c/go/+/416134
Reviewed-by: Bryan Mills <bcmills@google.com>
23 months agonet/http: remove Content-Encoding in writeNotModified
Mitar [Sun, 10 Jul 2022 14:06:09 +0000 (14:06 +0000)]
net/http: remove Content-Encoding in writeNotModified

Additional header to remove if set before calling http.ServeContent.

The API of ServeContent is that one should set Content-Encoding before calling it, if the content is encoded (e.g., compressed). But then, if content has not been modified, that header should be removed, according to RFC 7232 section 4.1.

Change-Id: If51b35b7811a4dbb19de2ddb73f40c5e68fcec7e
GitHub-Last-Rev: 53df6e73c44b63f351f7aeeb45cab82d706311eb
GitHub-Pull-Request: golang/go#50903
Reviewed-on: https://go-review.googlesource.com/c/go/+/381955
Run-TryBot: hopehook <hopehook@qq.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
23 months agocmd/compile: fix libfuzzer instrumentation line number
Keith Randall [Fri, 8 Jul 2022 21:52:23 +0000 (14:52 -0700)]
cmd/compile: fix libfuzzer instrumentation line number

Set a reasonable starting line number before processing the body of
the function in the order pass.

We update base.Pos each time we process a node, but some of the
libfuzzer instrumentation is added before we process any node, so the
base.Pos used is junk.

Fixes #53688

Change-Id: I3654b805eabb8866a9a1574845ef4ff062797319
Reviewed-on: https://go-review.googlesource.com/c/go/+/416654
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agocmd/go: avoid setting variables for '/' and ':' in TestScript subprocess environments
Bryan C. Mills [Fri, 8 Jul 2022 14:02:14 +0000 (10:02 -0400)]
cmd/go: avoid setting variables for '/' and ':' in TestScript subprocess environments

Also simplify platform-dependent handling of the PATH variable,
to make it more like the existing platform-dependent handling for
HOME and TMPDIR.

Fixes #53671.

Change-Id: Ica2665d3f61988c66fb6982b9feb61ca48eced79
Reviewed-on: https://go-review.googlesource.com/c/go/+/416554
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agonet/http: wait for listeners to exit in Server.Close and Shutdown
Damien Neil [Tue, 31 May 2022 21:47:33 +0000 (14:47 -0700)]
net/http: wait for listeners to exit in Server.Close and Shutdown

Avoid race conditions when a new connection is accepted just after
Server.Close or Server.Shutdown is called by waiting for the
listener goroutines to exit before proceeding to clean up active
connections.

No test because the mechanism required to trigger the race condition
reliably requires such tight coupling to the Server internals that
any test would be quite fragile in the face of reasonable refactorings.

Fixes #48642
Updates #33313, #36819

Change-Id: I109a93362680991bf298e0a95637595dcaa884af
Reviewed-on: https://go-review.googlesource.com/c/go/+/409537
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
23 months agocmd/compile: don't convert to interface{} for un-comparable types in generic switch
Cuong Manh Le [Fri, 1 Jul 2022 09:33:54 +0000 (16:33 +0700)]
cmd/compile: don't convert to interface{} for un-comparable types in generic switch

Fixes #53635

Change-Id: I41f383be8870432fc0d29fa83687911ddd8217f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/415634
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
23 months agoruntime: overestimate the amount of allocated memory in heapLive
Michael Anthony Knyszek [Thu, 7 Jul 2022 20:01:21 +0000 (20:01 +0000)]
runtime: overestimate the amount of allocated memory in heapLive

CL 377516 made it so that memory metrics are truly monotonic, but also
updated how heapLive tracked allocated memory to also be monotonic.

The result is that cached spans with allocated memory aren't fully
accounted for by the GC, causing it to make a worse assumption (the
exact mechanism is at this time unknown), resulting in a memory
regression, especially for smaller heaps.

This change is a partial revert of CL 377516 that makes heapLive a
non-monotonic overestimate again, which appears to resolve the
regression.

For #53738.

Change-Id: I5c51067abc0b8e0a6b89dd8dbd4a0be2e8c0c1b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/416417
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agocrypto/x509: restrict CRL number to <=20 octets
Roland Shoemaker [Wed, 29 Jun 2022 18:30:47 +0000 (11:30 -0700)]
crypto/x509: restrict CRL number to <=20 octets

Similar to certificate serial numbers, RFC 5280 restricts the length of
the CRL number field to no more than 20 octets. Enforce this in
CreateRevocationList.

Fixes #53543

Change-Id: If392ef6b0844db716ae9ee6ef317135fceab039c
Reviewed-on: https://go-review.googlesource.com/c/go/+/415134
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>

23 months agocrypto/x509: correctly parse CRL entry extensions
Aaron Gable [Tue, 28 Jun 2022 22:28:21 +0000 (15:28 -0700)]
crypto/x509: correctly parse CRL entry extensions

When checking to see if a CRL entry has any extensions, attempt to read
them from the individual revokedCertificate, rather than from the parent
TBSCertList.

Additionally, crlEntryExtensions is not an EXPLICIT field (c.f.
crlExtension and Certificate extensions), so do not perform an extra
layer of unwrapping when parsing the field.

The added test case fails without the accompanying changes.

Fixes #53592

Change-Id: Icc00e4c911f196aef77e3248117de64ddc5ea27f
Reviewed-on: https://go-review.googlesource.com/c/go/+/414877
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agocrypto/x509: populate Number and AKI of parsed CRLs
Aaron Gable [Wed, 6 Jul 2022 23:59:03 +0000 (16:59 -0700)]
crypto/x509: populate Number and AKI of parsed CRLs

The x509.RevocationList type has two fields which correspond to
extensions, rather than native fields, of the underlying ASN.1 CRL:
the .Number field corresponds to the crlNumber extension, and
the .AuthorityKeyId field corresponds to the authorityKeyIdentifier
extension.

The x509.CreateRevocationList() function uses these fields to populate
their respective extensions in the resulting CRL. However, the
x509.ParseRevocationList() function does not perform the reverse
operation: the fields retain their zero-values even after parsing a CRL
which contains the relevant extensions.

Add code which populates these fields when parsing their extensions.
Add assertions to the existing tests to confirm that the values are
populated appropriately.

Fixes #53726

Change-Id: Ie5b71081e53034e0b5b9ff3c122065c62f15cf23
Reviewed-on: https://go-review.googlesource.com/c/go/+/416354
Run-TryBot: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
23 months agocmd/link: explicitly disable PIE for windows/amd64 -race mode
Than McIntosh [Fri, 1 Jul 2022 12:39:12 +0000 (08:39 -0400)]
cmd/link: explicitly disable PIE for windows/amd64 -race mode

Turn off PIE explicitly for windows/amd64 when -race is in effect,
since at the moment the race detector runtime doesn't seem to handle
PIE binaries correctly. Note that newer C compilers on windows
produce PIE binaries by default, so the Go linker needs to explicitly
turn off PIE when invoking the external linker in this case.

Updates #53539.

Change-Id: Ib990621f22cf61a5fa383584bab81d3dfd7552e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/415676
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
23 months agocmd/go: default to "exe" build mode for windows -race
Than McIntosh [Wed, 6 Jul 2022 11:45:19 +0000 (07:45 -0400)]
cmd/go: default to "exe" build mode for windows -race

This patch changes the default build mode from "pie" to "exe" when
building programs on windows with "-race" in effect. The Go command
already issues an error if users explicitly ask for -buildmode=pie in
combination with -race on windows, but wasn't revising the default
"pie" build mode if a specific buildmode was not requested.

Updates #53539.
Updates #35006.

Change-Id: I2f81a41a1d15a0b4f5ae943146175c5a1202cbe0
Reviewed-on: https://go-review.googlesource.com/c/go/+/416174
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>

23 months agocmd/compile: only check implicit dots for method call enabled by a type bound
Cuong Manh Le [Tue, 28 Jun 2022 19:05:21 +0000 (02:05 +0700)]
cmd/compile: only check implicit dots for method call enabled by a type bound

Fixes #53419

Change-Id: Ibad64f5c4af2112deeb0a9ecc9c589b17594bd05
Reviewed-on: https://go-review.googlesource.com/c/go/+/414836
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>

23 months agocmd/go: set up git identity for build_buildvcs_auto.txt
Daniel Martí [Tue, 5 Jul 2022 15:14:22 +0000 (16:14 +0100)]
cmd/go: set up git identity for build_buildvcs_auto.txt

Just like in other tests like get_dotfiles.txt or
version_buildvcs_git.txt. Without it, I get a failure on my machine:

fatal: empty ident name (for <mvdan@p14s.localdomain>) not allowed

Change-Id: I1c17c0d58c539b59154570b5438c7bd850bac5aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/416095
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
23 months agocmd/compile: rework induction variable detector
Keith Randall [Sat, 2 Jul 2022 18:07:55 +0000 (11:07 -0700)]
cmd/compile: rework induction variable detector

Induction variable detection is still not quite right. I've added
another failing test.

Redo the overflow/underflow detector so it is more obviously correct.

Update #53600
Fixes #53653
Fixes #53663

Change-Id: Id95228e282fdbf6bd80b26e1c41d62e935ba08ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/415874
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
23 months agoos/exec: clarify that Wait must be called
Ian Lance Taylor [Fri, 24 Jun 2022 21:34:28 +0000 (14:34 -0700)]
os/exec: clarify that Wait must be called

Fixes #52580

Change-Id: Ib2dd8a793b9c6fcb083abb3f7c346f6279adefc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/414056
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
23 months agocmd/internal/notsha256: add purego tag as needed
Ian Lance Taylor [Sun, 3 Jul 2022 20:34:47 +0000 (13:34 -0700)]
cmd/internal/notsha256: add purego tag as needed

This permits building the package with gccgo, when using gccgo
as a bootstrap compiler.

Fixes #53662

Change-Id: Ic7ae9323ec5954e9306a32e1160e9aa1ed3aa202
Reviewed-on: https://go-review.googlesource.com/c/go/+/415935
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
23 months agocmd/dist: use purego tag when building the bootstrap binaries
Ian Lance Taylor [Sun, 3 Jul 2022 20:32:54 +0000 (13:32 -0700)]
cmd/dist: use purego tag when building the bootstrap binaries

This is in addition to the current math_big_pure_go tag.
Using purego ensures that we can build the cmd binaries with gccgo.

For #53662

Change-Id: Ib82f8bf10659b5f94935f2b427ae8b2da875cd3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/415934
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>

23 months agomisc/cgo/test: make TestSetgidStress cheaper
Cherry Mui [Fri, 1 Jul 2022 16:56:39 +0000 (12:56 -0400)]
misc/cgo/test: make TestSetgidStress cheaper

TestSetgidStress spawns 1000 threads, which can be expensive on
some platforms or slow builders. Run with 50 threads in short
mode instead.

This makes the failure less reproducible even with buggy code. But
one can manually stress test it (e.g. when a flaky failure appear
on the builder).

Fixes #53641.

Change-Id: I33b5ea5ecaa8c7a56f59c16f9171657ee295db47
Reviewed-on: https://go-review.googlesource.com/c/go/+/415677
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>

23 months agotest: recognize new gofrontend error message
Ian Lance Taylor [Mon, 4 Jul 2022 20:16:46 +0000 (13:16 -0700)]
test: recognize new gofrontend error message

The new gofrontend message matches other gofrontend error messages,
so adjust the test to accept it.

For #27938
For #51237

Change-Id: I29b536f83a0cf22b1dbdae9abc2f5f6cf21d522d
Reviewed-on: https://go-review.googlesource.com/c/go/+/416014
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
23 months agocmd/compile: drop "buildcfg" from no instrument packages
Michael Pratt [Tue, 28 Jun 2022 18:47:49 +0000 (14:47 -0400)]
cmd/compile: drop "buildcfg" from no instrument packages

Package buildcfg was added to this list by CL 403851, but package
buildcfg does not exist.

This was probably intended to refer to internal/buildcfg, but
internal/buildcfg is only used by the compiler so it is not clear why it
couldn't be instrumented.

For #44853.

Change-Id: Iad2517358be79c3eabf240376156bcff0c4bcefc
Reviewed-on: https://go-review.googlesource.com/c/go/+/414516
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>

23 months agocmd/go: make module@nonexistentversion failures reusable
Russ Cox [Fri, 1 Jul 2022 20:10:19 +0000 (16:10 -0400)]
cmd/go: make module@nonexistentversion failures reusable

CL 411398 added the -reuse flag for reusing cached JSON output
when the remote Git repository has not changed. One case that was
not yet cached is a lookup of a nonexistent version.

This CL adds caching of failed lookups of nonexistent versions,
by saving a checksum of all the heads and tags refs on the remote
server (we never consider other kinds of refs). If none of those have
changed, then we don't need to download the full server.

Fixes #53644.

Change-Id: I428bbc8ec8475bd7d03788934d643e1e2be3add0
Reviewed-on: https://go-review.googlesource.com/c/go/+/415678
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agocmd/go: add -reuse flag to make proxy invocations more efficient
Russ Cox [Fri, 10 Jun 2022 16:03:06 +0000 (12:03 -0400)]
cmd/go: add -reuse flag to make proxy invocations more efficient

The go list -m and go mod download commands now have a -reuse flag,
which is passed the name of a file containing the JSON output from a
previous run of the same command. (It is up to the caller to ensure
that flags such as -versions or -retracted, which affect the output,
are consistent between the old and new run.)

The new run uses the old JSON to evaluate whether the answer is
unchanged since the old run. If so, it reuses that information,
avoiding a costly 'git fetch', and sets a new Reuse: true field in its
own JSON output.

This dance with saving the JSON output and passing it back to -reuse
is not necessary on most systems, because the go command caches
version control checkouts in the module cache. That cache means that a
new 'git fetch' would only download the commits that are new since the
previous one (often none at all).

The dance becomes important only on systems that do not preserve the
module cache, for example by running 'go clean -modcache' aggressively
or by running in some environment that starts with an empty file
system.

For #53644.

Change-Id: I447960abf8055f83cc6dbc699a9fde9931130004
Reviewed-on: https://go-review.googlesource.com/c/go/+/411398
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
23 months agocmd/go: record origin metadata during module download
Russ Cox [Thu, 9 Jun 2022 03:56:28 +0000 (23:56 -0400)]
cmd/go: record origin metadata during module download

This change adds an "Origin" JSON key to the output of
go list -json -m and go mod download -json. The associated value is a
JSON object with metadata about the source control system. For Git,
that metadata is sufficient to evaluate whether the remote server has
changed in any interesting way that might invalidate the cached data.
In most cases, it will not have, and a fetch could then avoid
downloading a full repo from the server.

This origin metadata is also now recorded in the .info file for a
given module@version, for informational and debugging purposes.

This change only adds the metadata. It does not use it to optimize
away unnecessary git fetch operations. (That's the next change.)

For #53644.

Change-Id: I4a1712a2386d1d8ab4e02ffdf0f72ba75d556115
Reviewed-on: https://go-review.googlesource.com/c/go/+/411397
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
23 months agobuild/constraint: update doc to mention a feature added in Go 1.17
Cristian Greco [Sun, 3 Jul 2022 11:04:04 +0000 (11:04 +0000)]
build/constraint: update doc to mention a feature added in Go 1.17

The pkg documentation mentions that the "//go:build" syntax "will be"
added in Go 1.17. In fact, it has been added in that Go release, so the
documentation can now be updated.

Change-Id: I72f24063c3be62d97ca78bf724d56599f5f19460
GitHub-Last-Rev: 4371886f6ce9f2c2a370df047a5baa1f122c681f
GitHub-Pull-Request: golang/go#53647
Reviewed-on: https://go-review.googlesource.com/c/go/+/415774
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

23 months agoruntime: pass correct string to exits on Plan 9
Ori Bernstein [Sun, 3 Jul 2022 16:26:30 +0000 (12:26 -0400)]
runtime: pass correct string to exits on Plan 9

In CL 405901 the definition of exit in the Plan 9 go runtime
was changed like so:

-               status = append(itoa(tmp[:len(tmp)-1], uint64(e)), 0)
+               sl := itoa(tmp[:len(tmp)-1], uint64(e))
+               // Don't append, rely on the existing data being zero.
+               status = tmp[:len(sl)+1]

However, itoa only puts the converted number "somewhere" in the buffer.
Specifically, it builds it from the end of the buffer towards the start,
meaning the first byte of the buffer is a 0 byte, and the resulting string
that's passed to exits is empty, leading to a falsely successful exit.

This change uses the returned value from itoa, rather than the buffer
that was passed in, so that we start from the correct location in the
string.

Fixes #53669

Change-Id: I63f0c7641fc6f55250857dc17a1eeb12ae0c2e10
Reviewed-on: https://go-review.googlesource.com/c/go/+/415680
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
23 months agonet/http: omit invalid header value from error message
Alexander Yastrebov [Thu, 14 Oct 2021 22:01:49 +0000 (22:01 +0000)]
net/http: omit invalid header value from error message

Updates #43631

Change-Id: I0fe3aafdf7ef889fed1a830128721393f8d020e6
GitHub-Last-Rev: c359542d741b17f4e2cb0d50982bf341246233b0
GitHub-Pull-Request: golang/go#48979
Reviewed-on: https://go-review.googlesource.com/c/go/+/355929
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months agocmd/go, go/build: clarify build constraint docs
Ian Lance Taylor [Fri, 10 Jun 2022 22:58:22 +0000 (15:58 -0700)]
cmd/go, go/build: clarify build constraint docs

Clarify that the //go:build line is an expression of constraints,
not a constraint itself.

Fixes #53308

Change-Id: Ib67243c6ee5cfe3b688c12b943b5e7496f686035
Reviewed-on: https://go-review.googlesource.com/c/go/+/411697
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
23 months agoflag: highlight support for double dashes in docs
Sebastian Gassner [Thu, 30 Jun 2022 13:37:04 +0000 (13:37 +0000)]
flag: highlight support for double dashes in docs

Updating examples, to show that double dashes are also permitted. This has been easy to miss previously.

Change-Id: Ib67b4e39fea90ef4cb9e894709c53baedfc18fc2
GitHub-Last-Rev: f7df57b646d6412c1346e85c3a7353a8df41afc6
GitHub-Pull-Request: golang/go#53628
Reviewed-on: https://go-review.googlesource.com/c/go/+/415374
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>

23 months ago[dev.unified] cmd/compile/internal/walk: RType fields for range assignments
Matthew Dempsky [Thu, 30 Jun 2022 21:49:28 +0000 (14:49 -0700)]
[dev.unified] cmd/compile/internal/walk: RType fields for range assignments

This CL adds extra fields to RangeStmt that can be used when
desugaring into primitive assignment statements. This will allow the
frontend to wire up all of the RTTI necessary, pulling from
dictionaries as necessary.

Updates #53328.

Change-Id: Iab0e3029ff18c947782ff24f71ef20b2b5cb8305
Reviewed-on: https://go-review.googlesource.com/c/go/+/415518
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
23 months agogo/types, types2: document that exported predicates are unspecified for invalid type...
Robert Griesemer [Thu, 30 Jun 2022 23:41:31 +0000 (16:41 -0700)]
go/types, types2: document that exported predicates are unspecified for invalid type arguments

Per discussion on the issue.

For #53595.

Change-Id: Iefd161e5c7e792d454652cbe831a0c2d769f748e
Reviewed-on: https://go-review.googlesource.com/c/go/+/415574
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
23 months agogo/types, types2: re-enable a couple of commented out tests
Robert Griesemer [Thu, 30 Jun 2022 01:21:32 +0000 (18:21 -0700)]
go/types, types2: re-enable a couple of commented out tests

Change-Id: Ibb27012b18fc0f0f9f9ef74cc120e7ef981e6d43
Reviewed-on: https://go-review.googlesource.com/c/go/+/415156
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>

23 months agogo/doc/comment: support links in lists in comments
Ben Sarah Golightly [Wed, 29 Jun 2022 18:42:46 +0000 (19:42 +0100)]
go/doc/comment: support links in lists in comments

The proposed (#51082) new go doc comment additions supports lists,
links, and doc links, but does not support links and doc links inside
lists, so implemnent this.

Fixes #53610

Change-Id: I4fa17d204fc9efa8f3633133e4a49e56cf1aa9bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/415174
Reviewed-by: Ben Golightly <golightly.ben@googlemail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

23 months agoos: fix a typo in path_windows.go
AndreasHGK [Thu, 30 Jun 2022 15:59:30 +0000 (15:59 +0000)]
os: fix a typo in path_windows.go

I believe the path_windows.go file has a typo, which is fixed in this PR

Change-Id: Ibf1a7189a6312dbb3b1e6b512beeb6d99da5b5bc
GitHub-Last-Rev: cedac7eaa07d26667e6800c5ac96239d5ccf6ba8
GitHub-Pull-Request: golang/go#53629
Reviewed-on: https://go-review.googlesource.com/c/go/+/415434
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

23 months ago[dev.unified] all: merge master (993c387) into dev.unified
Matthew Dempsky [Thu, 30 Jun 2022 20:39:49 +0000 (13:39 -0700)]
[dev.unified] all: merge master (993c387) into dev.unified

Conflicts:

- test/run.go: textual conflict in 1.18 known failures list

Merge List:

+ 2022-06-30 993c387032 os: simplify deadline fluctuation tests
+ 2022-06-30 4914e4e334 cmd/go/internal/modindex: remove spurious field from index_format documentation
+ 2022-06-30 981d5947af cmd/go: include module root in package index key
+ 2022-06-30 84db00ffd1 cmd/go: add a 'sleep' command for script tests
+ 2022-06-30 31b8c23c57 cmd/compile: fix prove pass when upper condition is <= maxint
+ 2022-06-30 17083a2fdf spec: retitle section on "Assignments" to "Assignment statements"
+ 2022-06-30 4d95fe6653 test: add regress test for #53619
+ 2022-06-29 6a7c64fde5 debug/pe: add IMAGE_FILE_MACHINE_LOONGARCH{64,32}
+ 2022-06-29 b2cc0fecc2 net/http: preserve nil values in Header.Clone
+ 2022-06-29 64ef16e777 cmd/internal/obj/arm64: save LR and SP in one instruction for small frames
+ 2022-06-29 0750107074 go/token: use atomics not Mutex for last file cache
+ 2022-06-29 e5017a93fc net/http: don't strip whitespace from Transfer-Encoding headers
+ 2022-06-29 20760cff00 runtime: add race annotations to cbs.lock
+ 2022-06-29 e6c0546c54 crypto/x509/pkix: move crl deprecation message
+ 2022-06-29 3562977b6f cmd/internal/obj/mips,s390x,riscv: save LR after decrementing SP
+ 2022-06-29 d6481d5b96 runtime: add race annotations to metricsSema
+ 2022-06-29 bd1783e812 crypto/x509: improve RevocationList documentation
+ 2022-06-28 160414ca6a cmd/internal/obj/arm64: fix BITCON constant printing error
+ 2022-06-28 a30f434667 cmd/go: pass --no-decorate when listing git tags for a commit
+ 2022-06-28 3580ef9d64 os/exec: on Windows, suppress ErrDot if the implicit path matches the explicit one
+ 2022-06-28 34f3ac5f16 cmd/compile: fix generic inter-inter comparisons from value switch statements
+ 2022-06-28 7df0a002e6 cmd/go/internal/modfetch: cache latest revinfo in Versions func
+ 2022-06-28 d5bf9604aa test: add more tests for const decls with ommitted RHS expressions
+ 2022-06-28 533082d1a0 test: add test that gofrontend failed to compile
+ 2022-06-28 47e792e22e runtime: clean up unused function gosave on loong64
+ 2022-06-28 a6e5be0d30 cmd/go: omit build metadata that may contain system paths when -trimpath is set
+ 2022-06-28 d3ffff2790 api: correct debug/pe issue number for Go 1.19 changes
+ 2022-06-28 751cae8855 cmd/go/internal/modload: fix doc comment
+ 2022-06-28 85d7bab91d go/printer: report allocs and set bytes
+ 2022-06-27 3af5280c00 net: really skip Windows PTR tests if we say we are skipping them
+ 2022-06-27 a42573c2f1 net: avoid darwin/arm64 platform bug in TestCloseWrite
+ 2022-06-27 68289f39f0 html/template: fix typo in content_test.go
+ 2022-06-27 c3bea70d9b cmd/link: link against libsynchronization.a for -race on windows
+ 2022-06-27 f093cf90bf test: add test that caused gofrontend crash
+ 2022-06-27 155612a9b9 test: add test that caused gofrontend crash
+ 2022-06-27 a861eee51a cmd/go: compile runtime/internal/syscall as a runtime package
+ 2022-06-27 8f9bfa9b7b crypto/internal/boring: factor Cache into crypto/internal/boring/bcache
+ 2022-06-26 351e0f4083 runtime: avoid fma in mkfastlog2table
+ 2022-06-26 416c953960 test: add test that gofrontend gets wrong
+ 2022-06-26 666d736ecb cmd/compile: do branch/label checks only once
+ 2022-06-26 6b309be7ab cmd/compile/internal/syntax: check fallthrough in CheckBranches mode
+ 2022-06-25 1821639b57 runtime: mark string comparison hooks as no split
+ 2022-06-25 3b594b9255 io: clarify SeekEnd offset value
+ 2022-06-25 4f45ec5963 cmd/go: prepend builtin prolog when checking for preamble errors
+ 2022-06-24 41e1d9075e strconv: avoid panic on invalid call to FormatFloat
+ 2022-06-24 bd4753905d internal/trace: add Go 1.19 test data
+ 2022-06-24 6b6c64b1cc cmd/internal/archive: don't rely on an erroneous install target in tests

Change-Id: Ib43126833bf534c311730d4283d4d25381cd3428

23 months agoos: simplify deadline fluctuation tests
Ian Lance Taylor [Wed, 29 Jun 2022 20:11:33 +0000 (13:11 -0700)]
os: simplify deadline fluctuation tests

This applies the net package CL 365334, CL 366176, CL 372215 to the os
package.

CL 365334:

    These tests were checking for fairly narrow timing windows, but were
    running in parallel and heavily dependent on timer and goroutine
    scheduling. This change eliminates unnecessary goroutines, runs the
    tests sequentially (dramatically shortening the timeouts to reduce the
    penalty of doing so), and uses timestamp comparison instead of
    background timers to hopefully gain some robustness from monotonic
    timestamps.

    Many of the other tests from this package would benefit from similar
    simplifications, which we can apply if and when we notice flaky
    failures or want to improve the latency of running the test.

CL 366176:

    It appears that at least the OpenBSD kernel gets sloppier the longer
    the timeout we give it, up to an observed overhead of around 25%.
    Let's give it a little more than that (33%) in the comparison, and
    also increase the growth curve to match the actual observed times
    instead of exponential initial growth.

CL 372215:

    Decrease the slop everywhere else, since NetBSD and OpenBSD seem to be
    the only ones that miss by that much.

For #36108
For #50189
Fixes #50725 (we hope)

Change-Id: I0854d27af67ca9fcf0f9d9e4ff67acff4c2effc8
Reviewed-on: https://go-review.googlesource.com/c/go/+/415234
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
23 months agocmd/go/internal/modindex: remove spurious field from index_format documentation
Bryan C. Mills [Thu, 30 Jun 2022 18:18:02 +0000 (14:18 -0400)]
cmd/go/internal/modindex: remove spurious field from index_format documentation

The 'path' field was removed in an earlier revision to the format.

While auditing the format, I also cleaned up a couple of minor
typographical issues.

For #53586.

Change-Id: I4cd1ce9e970023441c11244428ed2971be1d8138
Reviewed-on: https://go-review.googlesource.com/c/go/+/415514
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months ago[dev.unified] cmd/compile: refactor `range` desugaring
Matthew Dempsky [Thu, 30 Jun 2022 02:23:34 +0000 (19:23 -0700)]
[dev.unified] cmd/compile: refactor `range` desugaring

This CL refactors the code responsible for emitting the user-visible
assignments within a range statement. This will make it easier to
propagate RTTI from the frontend into any implicit conversions.

Updates #53328.

Change-Id: Ibed15e3b4951b0a6a726067b401a630977f4c6c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/415158
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months ago[dev.unified] cmd/compile/internal/noder: implicit conversions for multi-valued expre...
Matthew Dempsky [Tue, 28 Jun 2022 23:31:29 +0000 (16:31 -0700)]
[dev.unified] cmd/compile/internal/noder: implicit conversions for multi-valued expressions

This CL changes GOEXPERIMENT=unified to insert implicit conversions
for multi-valued expressions.

Unfortunately, IR doesn't have strong, first-class support for
multi-valued expressions, so this CL takes the approach of spilling
them to temporary variables, which can then be implicitly converted.
This is the same approach taken by walk, but doing it this early does
introduce some minor complications:

1. For select case clauses with comma-ok assignments (e.g., `case x,
ok := <-ch:`), the compiler middle end wants to see the OAS2RECV
assignment is the CommClause.Comm statement. So when constructing
select statements, we need to massage this around a little.

2. The extra temporary variables and assignments skew the existing
inlining heuristics. As mentioned, the temporaries/assignments will
eventually be added (and often optimized away again) anyway, but now
they're visible to the inliner. So this CL also kludges the inlining
heuristics in this case to keep things comparable.

Change-Id: I3e3ea756ad92472ebe28bae3963be61ed7684a75
Reviewed-on: https://go-review.googlesource.com/c/go/+/415244
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

23 months ago[dev.unified] cmd/compile/internal/noder: refactor N:1 expression handling
Matthew Dempsky [Fri, 24 Jun 2022 21:19:06 +0000 (14:19 -0700)]
[dev.unified] cmd/compile/internal/noder: refactor N:1 expression handling

Pull all multi-value expression handling logic into a new multiExpr
helper method.

Change-Id: I78ec2dfc523abcfa3368a1064df7045aade8e468
Reviewed-on: https://go-review.googlesource.com/c/go/+/415243
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>