1
0
mirror of https://github.com/golang/go synced 2024-11-23 03:50:03 -07:00
Commit Graph

54519 Commits

Author SHA1 Message Date
doujiang24
f9ee56145b cmd/compile: print readable function name in error message
i.e.
from "function %!s(*Node=0xc0003b48c0) cannot have ABI wrappers", to "function xxFunctionName cannot have ABI wrappers".

Change-Id: I83cfdf1916e82ab1455db8032153d9cdae85250d
GitHub-Last-Rev: 87b077653f
GitHub-Pull-Request: golang/go#56428
Reviewed-on: https://go-review.googlesource.com/c/go/+/445516
Auto-Submit: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-10-26 19:11:37 +00:00
Zeke Lu
29674d87e6 flag: clarify that the main func at pkg.go.dev is part of a testing suite
flag.Example() has this comment:

    ... one must execute, typically at the start of main (not init!):
      flag.Parse()
    We don't run it here because this is not a main function

This example function will be renamed to "main" at pkg.go.dev, which
makes the comment confusing.
See https://pkg.go.dev/flag#example-package.

This change modify the comment to clarify this situation.

Change-Id: I17357fdaaefe54791fff8fbbf6a33003af207f88
GitHub-Last-Rev: eeea8ce39c
GitHub-Pull-Request: golang/go#56411
Reviewed-on: https://go-review.googlesource.com/c/go/+/445315
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-26 18:59:00 +00:00
Russ Cox
2a2b163bb9 crypto/x509: respect GODEBUG changes for allowing SHA1 certificates
This allows programs that want SHA1 support to call os.Setenv at startup
instead of insisting that users set the environment variable themselves.

For #41682.
Fixes #56436.

Change-Id: Idcb96212a1d8c560e1dd8eaf7c80b6266f16431e
Reviewed-on: https://go-review.googlesource.com/c/go/+/445496
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2022-10-26 16:35:20 +00:00
Russ Cox
3afba3124d all: remove uses of rand.Seed
As of CL 443058, rand.Seed is not necessary to call,
nor is it a particular good idea.

For #54880.

Change-Id: If9d70763622c09008599db8c97a90fcbe285c6f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/445395
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-10-26 16:24:57 +00:00
Robert Griesemer
51af904456 go/types, types2: use correct shift value when typechecking constant shift
Fixes #56425.

Change-Id: Ieae3fdb5326d4b6f6ec1cdcd579051559e34b35b
Reviewed-on: https://go-review.googlesource.com/c/go/+/445515
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2022-10-26 14:34:44 +00:00
Bryan C. Mills
49abdbccde cmd/go/internal/script: use the Cancel and WaitDelay fields for subprocesses
The Cancel and WaitDelay fields recently added to exec.Cmd are
intended to support exactly the sort of cancellation behavior that we
need for script tests. Use them, and simplify the cmd/go tests
accordingly.

The more robust implementation may also help to diagose recurring test
hangs (#50187).

For #50187.
Updates #27494.

Change-Id: I7817fca0dd9a18e18984a252d3116f6a5275a401
Reviewed-on: https://go-review.googlesource.com/c/go/+/445357
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-26 14:08:16 +00:00
Wayne Zuo
939f9fd64a runtime/internal/syscall: use ABIInternal for Syscall6 on riscv64
Change-Id: Iceed0f55038c87f261b60309e025132142946364
Reviewed-on: https://go-review.googlesource.com/c/go/+/443557
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Wayne Zuo <wdvxdr@golangcn.org>
2022-10-26 05:51:33 +00:00
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