1
0
mirror of https://github.com/golang/go synced 2024-09-29 22:24:33 -06:00
Commit Graph

54812 Commits

Author SHA1 Message Date
cui fliter
d2901205c1 cmd: remove redundant _
Change-Id: Ia7e1e3679e03d125feb9708cb05bbd32c4954edb
GitHub-Last-Rev: a62b72ea3e
GitHub-Pull-Request: golang/go#55957
Reviewed-on: https://go-review.googlesource.com/c/go/+/436879
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: hopehook <hopehook@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-26 03:49:05 +00:00
Russ Cox
f7f37b9399 crypto/x509: delete trailing spaces
Change-Id: I73ace9f5b9481f3b88be0c5f6b9c5076d2f82c7f
Reviewed-on: https://go-review.googlesource.com/c/go/+/445497
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-26 03:38:38 +00:00
cui fliter
069d1fc9e2 runtime: fix a few function names on comments
Change-Id: I4be0b1e612dcc21ca6bb7d4395f1c0aa52480759
GitHub-Last-Rev: 032480c4c9
GitHub-Pull-Request: golang/go#55993
Reviewed-on: https://go-review.googlesource.com/c/go/+/437518
Reviewed-by: hopehook <hopehook@golangcn.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: hopehook <hopehook@golangcn.org>
2022-10-26 02:39:39 +00:00
Wayne Zuo
5d59fa143a all: delete riscv64 non-register ABI fallback path
Change-Id: I9e997b59ffb868575b780b9660df1f5ac322b79a
Reviewed-on: https://go-review.googlesource.com/c/go/+/443556
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: David Chase <drchase@google.com>
2022-10-26 00:52:05 +00:00
Wayne Zuo
3dc13023c1 all: update golang.org/x/tools to 8166dca1ce
To pick up CL 443575.

Note: This CL also update other x repositories because CL 444536 updates
x/tools dependencies to latest tagged version.

Done by
	go get -d golang.org/x/tools@8166dca1cec9
	go mod tidy
	go mod vendor

Change-Id: Ie2836bb4ebc1db0150ba240af4e2b750dbf1e0b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/445055
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-10-26 00:11:50 +00:00
Robert Griesemer
b95ea201d5 cmd/compile: add support for alternative comparable semantics
Add the experimental compiler flag -altcomparable. If set, the
compiler uses alternative comparable semantics: any ordinary
(non-type parameter) interface implements the comparable
constraint.

This permits experimenting with this alternative semantics
akin to what is proposed in #52509.

For #52509.

Change-Id: I64192eee6f2a550eeb50de011079f2f0b994cf94
Reviewed-on: https://go-review.googlesource.com/c/go/+/444636
Run-TryBot: Robert Griesemer <gri@google.com>
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>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-10-25 20:28:23 +00:00
cuiweixie
2dcc9acbd2 cmd/go: show an error when a package in a module conflicts with one in std
Fixes #35270

Change-Id: I5d2a04359702be6dc04affb867540091b926bc23
Reviewed-on: https://go-review.googlesource.com/c/go/+/434095
Run-TryBot: xie cui <523516579@qq.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-10-25 19:49:17 +00:00
Zeke Lu
2bdb5c57f1 debug/elf: use saferio.SliceCap when decoding ELF sections
This avoids allocating an overly large slice for corrupt input.

No test case because the problem can only happen for invalid data. Let
the fuzzer find cases like this.

Updates #33121.

Change-Id: Ie2d947a3865d3499034286f2d08d3e3204015f3e
GitHub-Last-Rev: 6c62fc3cec
GitHub-Pull-Request: golang/go#56405
Reviewed-on: https://go-review.googlesource.com/c/go/+/445076
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-10-25 16:51:48 +00:00
Russ Cox
90a67d052e math/rand: auto-seed global source
Implement proposal #54880, to automatically seed the global source.

The justification for this not being a breaking change is that any
use of the global source in a package's init function or exported API
clearly must be valid - that is, if a package changes how much
randomness it consumes at init time or in an exported API, that
clearly isn't the kind of breaking change that requires issuing a v2
of that package. That kind of per-package change in the position
of the global source is indistinguishable from seeding the global
source differently. So if the per-package change is valid, so is auto-seeding.

And then, of course, auto-seeding means that packages will be
far less likely to depend on the specific results of the global source
and therefore not break when those kinds of per-package changes
happen in the future.

Seed(1) can be called in programs that need the old sequence from
the global source and want to restore the old behavior.
Of course, those programs will still be broken by the per-package
changes just described, and it would be better for them to allocate
local sources rather than continue to use the global one.

Fixes #54880.

Change-Id: Ib9dc3307b97f7a45587a9cc50d81f919d3edc7ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/443058
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2022-10-25 16:49:48 +00:00
Bryan C. Mills
4c9006e45f cmd/go: make vcstest repo scripts compatible with old Mercurial versions
The scripts added in CL 421455 passed on the TryBots, but failed on
the "-stretch" builders, which supply Mercurial 4.0
(released 2016-11-01).

Debian 9 “Stretch” has been at end-of-life since June 30, 2022, but
until we can turn down the outdated builders (#56414) we should keep
them passing tests.

For #27494.
Updates #56414.

Change-Id: I9df0ed452dfbfaeb1b4c0d869d02dd9ed21b3ff6
Reviewed-on: https://go-review.googlesource.com/c/go/+/445356
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-25 16:48:06 +00:00
Russ Cox
ddaa25b5dd cmd/go: split quotes in GOFLAGS same as in other env vars
GOFLAGS didn't split on quotes because no other env vars
(such as CC, CXX, ...) did either. This kept them all consistent.

CL 341936 changed everything but GOFLAGS, making them inconsistent.

Split GOFLAGS the same way as the other environment variables.

Fixes #26849.

Change-Id: I99bb450fe30cab949da48af133b6a36ff320532f
Reviewed-on: https://go-review.googlesource.com/c/go/+/443956
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2022-10-25 16:47:27 +00:00
Bryan C. Mills
2d63305b84 cmd/go: make vcstest repo scripts compatible with old Git versions
The scripts added in CL 421455 passed on the TryBots, but failed on a
subset of the builders that have older 'git' binaries installed.

Notably, the older versions of git do not support:
- 'git branch -m' before the current branch has a commit
- 'init.defaultBranch' in the '.gitconfig' file, and
- 'git branch -c'.

We address those by, respectively:
- waiting to run 'git branch -m' until after the first commit
- always running 'git branch -m' explicitly to set the branch name, and
- using 'git checkout' instead of 'git branch -c' to set branch parents.

Updates #27494.

Change-Id: I42f012f5add8f31e41d077d752d8268aacbce8a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/445355
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-10-25 15:36:24 +00:00
Paul E. Murphy
f9bd1d0f11 runtime/internal/syscall: convert PPC64 Syscall6 to ABIInternal
This avoids a lot of stacking.

Change-Id: If5c5cf33335ffdcb7eecbd3f2db7858a415d817d
Reviewed-on: https://go-review.googlesource.com/c/go/+/443736
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
2022-10-25 15:23:37 +00:00
Bryan C. Mills
8749d12bb7 cmd/go: add Subversion support to the local vcstest server
With this change applied, 'go test cmd/go/...' passes
even with the IP routing for vcs-test.golang.org disabled
using 'ip route add blackhole $VCSTEST_IP/32'.

Fixes #27494.

Change-Id: I45651d2429c7fea7bbf693b2f129e260e1c59891
Reviewed-on: https://go-review.googlesource.com/c/go/+/427914
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-25 13:44:48 +00:00
Bryan C. Mills
71048daa2f cmd/go: reroute vcs-test.golang.org HTTPS requests to the test-local server
After this CL, the only test requests that should still reach
vcs-test.golang.org are for Subversion repos, which are not yet handled.

The interceptor implementation should also allow us to redirect other
servers (such as gopkg.in) fairly easily in a followup change if
desired.

For #27494.

Change-Id: I8cb85f3a7edbbf0492662ff5cfa779fb9b407136
Reviewed-on: https://go-review.googlesource.com/c/go/+/427254
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2022-10-25 13:22:22 +00:00
Bryan C. Mills
d5155f6192 cmd/go: redirect vcs-test.golang.org repo URLs to a test-local server
The new server reconstructs the vcs-test repos on the fly using
scripts that run the actual version-control binaries.

This allows those repos to be code-reviewed using our normal tools —
and, crucially, allows contributors to add new vcs-test contents
as part of a contributed CL.

It also prevents failures due to network errors reaching
vcs-test.golang.org (such as when developing offline), and allows us
to iterate on the repo contents without dealing with annoying and
unpredictable GCS caching behavior.

We can't quite turn down vcs-test.golang.org yet — this server doesn't
yet handle "go-import" metadata (and related authentication behaviors),
and doesn't serve Subversion repos.

But we're getting much closer!

For #27494.

Change-Id: I233fc718617aed287b0f7248bd8cfe1e5cebe96b
Reviewed-on: https://go-review.googlesource.com/c/go/+/421455
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2022-10-25 13:00:34 +00:00
Bryan C. Mills
55eaae452c os/exec: add the Cancel and WaitDelay fields
Fixes #50436.

Change-Id: I9dff8caa317a04b7b2b605f810b8f12ef8ca485d
Reviewed-on: https://go-review.googlesource.com/c/go/+/401835
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>
2022-10-25 03:34:36 +00:00
Bryan C. Mills
9fffcde118 cmd/go: fix script conditions that require cgo
This fixes a regression introduced in CL 419875
that causes features that require cgo to be tested
on the nocgo builders.

For #27494.

Change-Id: Iee61225c98c1275810256ab002a698fc4b42c053
Reviewed-on: https://go-review.googlesource.com/c/go/+/445235
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-10-25 00:18:38 +00:00
Bryan C. Mills
3617514de0 cmd/go: replace the 'addcrlf' script command with a more general 'replace' command
This allows the "reuse_git" test to avoid depending on exact JSON
blobs, which will be important when the URLs start referring to
test-local vcweb servers.

For #27494.

Change-Id: I22fde5110b3267b8fb9fb9c59fabc3b8a8b492c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/427094
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-10-24 21:26:14 +00:00
Bryan C. Mills
3f84a3f324 cmd/go/internal/script: define GOOS, GOARCH, and compiler conditions using suffixes
This replaces a large set of individual GOOS and GOARCH conditions
with a smaller set of more verbose conditions. On balance, the more
uniform structure and more concise documentation seem worth the
verbosity.

For #27494.

Change-Id: I73fdf9e7180a92cb1baf5d4631aeecb26ce15181
Reviewed-on: https://go-review.googlesource.com/c/go/+/420054
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-10-24 21:26:10 +00:00
Bryan C. Mills
4319231686 cmd/go: replace the '[exec:git]' condition with a '[git]' condition
This makes it more obvious that the condition is testing for something
beyond just the existence of a 'git' executable.

For #27494.

Change-Id: I7608b6c84f9f373292687b3a2066b0ded7deb6e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/421454
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-24 21:18:32 +00:00
Bryan C. Mills
a971904e10 cmd/go/internal/script: remove special-case escaping logic for $WORK
Previously, the script engine implicitly escaped the path in the
$WORK environment variable to be the literal string '$WORK', which
produces somewhat better error messages in case of failure.

However, for a general-purpose script engine that implicit behavior is
surprising, and it isn't really necessary.

For #27494.

Change-Id: Ic1d5b8801bbd068157315685539e7cc2795b3aa5
Reviewed-on: https://go-review.googlesource.com/c/go/+/426854
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-10-24 21:18:16 +00:00
Bryan C. Mills
151668c694 cmd/go: extract the TestScript engine into a standalone package
This change decouples the script engine from both cmd/go and the
testing package; I intend to reuse it in the replacement for the
vcs-test.golang.org server.

This change also adds a few new script commands:

	- 'echo' echoes its arguments, useful for verifying argument expansion.

	- 'cat' prints the contents of files, useful for debugging failing script tests.

	- 'help' displays information about script commands and conditions,
	  reducing the toil of maintaining lists in the README file.

The 'cmp' and 'cmpenv' commands now use internal/diff instead of their
own separate diff implementation.

The 'env' command now writes to the script log instead of the stdout
buffer. (This makes it more consistent with the behavior of other
synchronous builtins.)

The 'stale' command no longer logs output when a target is
unexpectedly non-stale. (However, the ouput of the 'stale' command is
not usually very useful anyway.)

The 'grep', 'stdout', and 'stderr' commands now display matching lines
(like Unix 'grep'), making their negation behavior more consistent
with running real commands on a command-line.

Likewise, the 'cmp' command now always displays differences. That
makes it useful with the '?' prefix to produce diffs for informational
purposes while debugging.

For #27494.

Change-Id: If49fd81d9b922d07c20618a8e2cef908191f9ef6
Reviewed-on: https://go-review.googlesource.com/c/go/+/419875
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-24 21:18:10 +00:00
Paul E. Murphy
bd6cd7db07 cmd/compile: fix PPC64 latelower enablement
The commit f841722853 needed an update for c0f27eb3d5. This
fixes the aforementioned commit.

Also, regenerate the lowering rules.

Change-Id: I2073d2e86af212dfe58bc832a1c04a8ef2a57621
Reviewed-on: https://go-review.googlesource.com/c/go/+/445155
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-10-24 19:40:03 +00:00
Joe Tsai
7f04b84162 time: optimize appendInt and appendNanos
The appendInt function previously performed a double pass
over the formatted integer. We can avoid the second pass
if we knew the exact length of formatted integer,
allowing us to directly serialize into the output buffer.

Rename formatNano to appendNano to be consistent with
other append-like functionality.

Performance:

	name               old time/op  new time/op  delta
	FormatRFC3339Nano  109ns ± 1%   72ns ± 1%    -34.06%  (p=0.000 n=10+10)

Change-Id: Id48f77eb4976fb1dcd6e27fb6a02d29cbf0c026a
Reviewed-on: https://go-review.googlesource.com/c/go/+/444278
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-10-24 19:23:32 +00:00
Paul E. Murphy
f841722853 cmd/compile: enable lateLower pass on PPC64
This allows new rules to be added which would otherwise
greatly overcomplicate the generic rules, like CC opcode
conversion or zero register simplification.

Change-Id: I1533f0fa07815aff99ed8ab890077bd22a3bfbf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/442595
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-10-24 18:59:50 +00:00
Roland Shoemaker
ffa03f6bac crypto/tls,crypto/x509: clarify certificate ownership
Clarify documentation in cases where certificates returned from
various methods are not owned by the caller, and as such should not
be modified.

Change-Id: I06bdc4cf0f686c3d5e8bbb76fc71f2a4bdb955e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/427155
Auto-Submit: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-24 17:35:57 +00:00
Robert Griesemer
5a3900b23c go/types, types2: implement alternative comparable semantics
This is an experiment to see the impact of a potential spec change:
As an exception to the rule that constraint satisfaction is the same
as interface implementation, if the flag Config.AltComparableSemantics
is set, an ordinary (non-type parameter) interface satisfies the
comparable constraint. (In go/types, the flag is not exported to
avoid changing the API.)

Disabled by default. Test files can set the flag by adding

// -altComparableSemantics

as the first line in the file.

For #52509.

Change-Id: Ib491b086feb5563920eaddefcebdacb2c5b72d61
Reviewed-on: https://go-review.googlesource.com/c/go/+/444635
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-10-24 16:41:29 +00:00
Paul E. Murphy
65f863529c runtime: fix usleep on linux/PPC64
The existing implementation fails to convert the remainder
microseconds to nanoseconds. This causes sysmon to consume
much more cpu, and generate lots of context switches.

We can also do a little better here to avoid division by a
constant. I used go to determine the magic numbers.

Fixes #56374

Change-Id: I2e37ec218b9027efab6db4634eed1504c0c1b3c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/444735
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-10-24 16:31:36 +00:00
qmuntal
decdad3537 doc/go1.20: go version supports non-executable Go binaries
Closes #48187

Change-Id: Ibb808654bab3b6602b8901423fd297ad1f6e6386
Reviewed-on: https://go-review.googlesource.com/c/go/+/442035
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
2022-10-24 15:56:26 +00:00
Filippo Valsorda
a1901f898b crypto/ed25519: implement Ed25519ph in Sign and VerifyWithOptions
Updates #31804

Change-Id: I5a48dfc57401576902674aff20b557e4a8ce8ab8
Reviewed-on: https://go-review.googlesource.com/c/go/+/373076
Reviewed-by: Filippo Valsorda <valsorda@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-10-24 12:11:20 +00:00
Wayne Zuo
7e72d384d6 internal/abi, internal/buildcfg: always enable register ABI on riscv64
In Go 1.19, we develop register ABI for riscv64, enabled by default as a
GOEXPERIMENT. We can turn it on all the time in Go 1.20.

Change-Id: Ie8e2ac8b8bd3ebddb0dc6d58a5599547fb440e03
Reviewed-on: https://go-review.googlesource.com/c/go/+/443555
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-10-24 03:45:54 +00:00
Wayne Zuo
2952fe4f16 cmd/compile: use correct type in riscv64 late lower pass
The right-hand side SLLI always contains valid content in the high 32 bits,
so we should use the 64 bit integer type. Using wrong type may lead to wrong
optimizations in cse pass.

Should fix x/text test failures.

Change-Id: I972dd913b8fb238d180bb12f8b1801adc8503fc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/443875
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: David Chase <drchase@google.com>
2022-10-24 03:45:10 +00:00
Johan Brandhorst-Satzkorn
85196fc982 cmd/internal/ssa: correct references to _gen folder
The gen folder was renamed to _gen in CL 435472, but references in code
and docs were not updated. This updates the references.

Change-Id: Ibadc0cdcb5bed145c3257b58465a8df370487ae5
Reviewed-on: https://go-review.googlesource.com/c/go/+/444355
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-23 17:42:11 +00:00
Michael Matloob
5b606a9d2b cmd/go: correct staleness for packages in modules
Packages in modules don't have a Target set for them, so the current
logic for determining staleness always reports them as stale. Instead it
should be reporting whether "go install" would do anything, and sholud
be false after a go install. If a package does not have a Target,
instead check to see whether we've cached its build artifact.

Change-Id: Ie7bdb234944353f6c2727bd8bf939cc27ddf3f18
Reviewed-on: https://go-review.googlesource.com/c/go/+/444619
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2022-10-21 20:57:57 +00:00
Matt Layher
d5efd0dd63 net/netip: add IPv6LinkLocalAllRouters and IPv6Loopback
Fixes #51766
Fixes #51777

Change-Id: I0510175c20c06442d78b2581cfe218e66be1c35b
Reviewed-on: https://go-review.googlesource.com/c/go/+/412475
Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
2022-10-21 20:14:41 +00:00
Than McIntosh
e43eebdab8 cmd/cover: fix buglets in counter insertion
This patch has a couple of minor fixes to new-style counter insertion
(noticed these problems while working on the fix for issue 56370).

First, make sure that the function registration sequence (writing of
nctrs, pkgid, funcid to counter var prolog) comes prior to the first
counter update (they were reversed up to this point, due to an
artifact of the way cmd/internal/edit operates).

Second, fix up "per function" counter insertion mode (an experimental
feature disabled by default that adds just a single counter to each
function as opposed to one per basic block), which was failing to
insert the single counter in the right place.

Change-Id: Icfb613ca385647f35c0e52da2da8edeb2a506ab7
Reviewed-on: https://go-review.googlesource.com/c/go/+/444835
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-10-21 19:42:51 +00:00
Than McIntosh
67403a30f6 cmd/cover: fix problem with race mode and inlining
This patch fixes a problem in which we can get a data race on a
coverage counter function registration sequence. The scenario is that
package P contains a function F that is built with coverage, then F is
inlined into some other package that isn't being instrumented. Within
F's exported function body counter updates were being done with
atomics, but the initial registration sequence was not, which had the
potential to trigger a race. Fix: if race mode is enabled and we're
using atomics for counter increments, also use atomics in the
registration sequence.

Fixes #56370.

Change-Id: If274b61714b90275ff95fc6529239e9264b0ab0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/444617
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-10-21 19:41:54 +00:00
Michael Matloob
99fcacfe9a cmd/go: don't print cached output for non-build list commands
If a user is running a go list command that wouldn't trigger a build
(for example if -export was passed), don't print the cached stdout
outputs for previous builds of the artifacts.

Fixes #56375

Change-Id: I1d3e6c01d0eb3dada941bb2783ce2ac69aa3d5d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/444836
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2022-10-21 19:37:23 +00:00
Nick Craig-Wood
9e7c5030d0 math/bits: note that functions here may be compiler intrinsics
It was noted in the go1.9 release notes that functions in math/bits
may be implemented by compiler intrinsics, but this never made it to
the documentation.

This change adapts the wording of the release notes and puts it in the
documentation for math/bits.

Change-Id: Ibeea88eaf7df10952cbe670885e910ac30b49d55
Reviewed-on: https://go-review.googlesource.com/c/go/+/444035
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-10-21 17:51:06 +00:00
Cherry Mui
867babe1b1 runtime: gofmt
Change-Id: Ib9bea9e42d8e99b83dc64450baf9fede15156514
Reviewed-on: https://go-review.googlesource.com/c/go/+/444615
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-10-21 16:23:01 +00:00
Park Zhou
2b21a27f82 go/scanner: use constant name rather than its value (cleanup)
Change-Id: I3fcd1683870f66a1d65e2acf0beaf1046e7f5446
Reviewed-on: https://go-review.googlesource.com/c/go/+/407535
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-10-21 15:01:19 +00:00
qmuntal
acfdaf06f5 runtime: skip TestVectoredHandlerExceptionInNonGoThread
windows-amd-2012 builder seems to have some problems handling
exception thrown in external C code which is affecting
TestVectoredHandlerExceptionInNonGoThread.
The issue is known and discussed in #49681.

This Cl skips the offending test on windows-amd-2012.

Change-Id: I7ca4353c9e531f0d75ac6a8dbd809acfa1f15bf9
Reviewed-on: https://go-review.googlesource.com/c/go/+/444616
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-21 14:47:46 +00:00
Paul E. Murphy
6f7e9e2307 crypto/sha256, cmd/internal/notsha256: improve PPC64 sha256
This minimizes addi usage inside vector heavy loops. This
results in a small performance uptick on P9 ppc64le/linux.
Likewise, cleanup some minor whitespace issues around comments.

The implementation from crypto/sha256 is also shared with notsha256.
It is copied, but preserves notsha256's go:build directives. They are
otherwise identical now. Previously, bootstrap restrictions required
workarounds to support XXLOR on older toolchains. This is not needed
anymore as the minimum bootstrap (1.17) compiler will support XXLOR.

name               old speed      new speed      delta
Hash8Bytes/New     28.8MB/s ± 0%  30.5MB/s ± 0%  +5.98%
Hash8Bytes/Sum224  29.5MB/s ± 0%  31.3MB/s ± 0%  +6.17%
Hash8Bytes/Sum256  29.5MB/s ± 0%  31.2MB/s ± 0%  +5.80%
Hash1K/New          287MB/s ± 0%   312MB/s ± 0%  +8.60%
Hash1K/Sum224       289MB/s ± 0%   312MB/s ± 0%  +7.99%
Hash1K/Sum256       289MB/s ± 0%   312MB/s ± 0%  +7.98%
Hash8K/New          313MB/s ± 0%   338MB/s ± 0%  +8.12%
Hash8K/Sum224       313MB/s ± 0%   338MB/s ± 0%  +8.20%
Hash8K/Sum256       313MB/s ± 0%   338MB/s ± 0%  +8.12%

Change-Id: Ib386d6306673b4e6553ee745ec2e1b53a9722df1
Reviewed-on: https://go-review.googlesource.com/c/go/+/441815
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Archana Ravindar <aravind5@in.ibm.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
2022-10-21 13:29:47 +00:00
Keith Randall
c75b10be0b runtime/race: add GOAMD64=v3 version of linux race .syso
Makes -race mode faster, in the 15% speedup range.

Update #53743

Change-Id: I735eb71902b41c924c9f885ded8f7a350a56b751
Reviewed-on: https://go-review.googlesource.com/c/go/+/444396
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-10-21 05:28:30 +00:00
Ian Lance Taylor
4c61e079c0 encoding/gob: support large slices in slice decode helpers
The slice decode helpers weren't aware of partially allocated slices.

Also add large slice support for []byte.

Change-Id: I5044587e917508887c7721f8059d364189831693
Reviewed-on: https://go-review.googlesource.com/c/go/+/443777
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-20 23:11:47 +00:00
Cherry Mui
4725c71b73 cmd/compile: copy blank parameter node when substituting function type
When a function type is copied (e.g. for substituting type
parameters), we make copies of its parameter ir.Name nodes, so
they are not shared with the old function type. But currently a
blank (_) identifier is not copied but shared. The parameter
node's frame offset is assigned (in ABI analysis) and then used in
the concurrent backend. Shared node can cause a data race. Make a
new blank parameter node to avoid sharing. (Unified IR does already
not have this problem. This fixes non-unified-IR mode.)

This seems to fix #55357.

Change-Id: Ie27f08e5589ac7d5d3f0d0d5de1a21e4fd2765c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/443158
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-10-20 22:16:41 +00:00
Keith Randall
8415ec8c98 cmd/compile: in compiler errors, print more digits for floats close to an int
Error messages currently print floats with %.6g, which means that if
you tried to convert something close to, but not quite, an integer, to
an integer, the error you get looks like "cannot convert 1 to type
int", when really you want "cannot convert 0.9999999 to type int".

Add more digits to floats when printing them, to make it clear that they
aren't quite integers. This helps for errors which are the result of not
being an integer. For other errors, it won't hurt much.

Fixes #56220

Change-Id: I7f5873af5993114a61460ef399d15316925a15a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/442935
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
2022-10-20 21:52:09 +00:00
qmuntal
160bb0e66b runtime: fix TestVectoredHandlerExceptionInNonGoThread
This test is failing on the windows-arm64-10 builder
https://build.golang.org/log/c161c86be1af83c349ee02c1b12eff5828818f50.

It is not failing on windows-arm64-11, so I guess it has something to
do with the compiler.

This CL simplifies the test so is easier to build.

Change-Id: I6e0e1cf237277628f8ebf892c70ab54cd0077680
Reviewed-on: https://go-review.googlesource.com/c/go/+/444438
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-10-20 18:45:28 +00:00
Joe Tsai
72c58fb771 time: implement strict RFC 3339 during marshal and unmarshal
We add strict checking to marshal and unmarshal methods,
rather than Parse to maintain compatibility in Parse behavior.
Also, the Time.Format method has no ability to report errors.

The Time.Marshal{Text,JSON} and Time.Unmarshal{Time,JSON} methods
are already documented as complying with RFC 3339, but have
edge cases on both marshal and unmarshal where it is incorrect.
The Marshal methods already have at least one check to comply
with RFC 3339, so it seems sensible to expand this to cover
all known violations of the specification.
This commit fixes all known edge cases for full compliance.

Two optimizations are folded into this change:

	1. parseRFC3339 is made generic so that it can operate
	   directly on a []byte as well as string.
	   This avoids allocating or redundant copying
	   when converting from string to []byte.

	2. When marshaling, we verify for correctness based
	   on the serialized output, rather than calling
	   attribute methods on the Time type. For example,
	   it is faster to check that the 5th byte is '-'
	   rather than check that Time.Year is within [0,9999],
	   since Year is a relatively expensive operation.

Performance:

	name            old time/op  new time/op  delta
	MarshalJSON     109ns ± 2%    99ns ± 1%   -9.43%  (p=0.000 n=10+10)
	UnmarshalText   158ns ± 4%   143ns ± 1%   -9.17%  (p=0.000 n=9+9)

Updates #54580
Updates #54568
Updates #54571

Change-Id: I1222e45a7625d1ffd0629be5738670a84188d301
Reviewed-on: https://go-review.googlesource.com/c/go/+/444277
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-20 16:29:38 +00:00