]> Cypherpunks repositories - gostls13.git/log
gostls13.git
4 months agocmd/go: drop fips140 build ID hacks
Russ Cox [Tue, 17 Dec 2024 15:40:41 +0000 (10:40 -0500)]
cmd/go: drop fips140 build ID hacks

We were trying to keep all binaries stale in fips140 mode
so that every build would write and leave behind a fips.o
in the work directory for use by validating labs.
That breaks various staleness checks, including the one
in cmd/dist during GOFIPS140=latest ./make.bash.

Revert the fips140 hack. Validating labs will still be able
to find the fips.o when building against a clean cache.

Add the default godebug to the link hash though,
so that it is clear that GOFIPS140=latest
and GOFIPS140=off binaries have different hashes.
(The only effect is the default GODEBUG setting.)
They already had different hashes, because the
default GODEBUG ends up in p.Internal.BuildInfo,
and that gets hashed in a "modinfo" line,
but better to be explicit.

Fixes #70873.

Change-Id: I49a38c180208098c2b6720facef48f4e96d44c54
Reviewed-on: https://go-review.googlesource.com/c/go/+/637116
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agocmd/go: fix two-step toolchain upgrade through go install, GOTOOLCHAIN
Russ Cox [Wed, 18 Dec 2024 20:42:48 +0000 (15:42 -0500)]
cmd/go: fix two-step toolchain upgrade through go install, GOTOOLCHAIN

If we do one upgrade because of a go install target's go.mod file,
we still might need a second upgrade to implement the GOTOOLCHAIN
minimum. Instead of allowing a two-step switch (which we were
cutting off anyway), skip the first step and go straight to the
GOTOOLCHAIN min upgrade.

Fixes #69051.

Change-Id: I16f060f473574d8b8f84c55fae2fd0cdabc8aa19
Reviewed-on: https://go-review.googlesource.com/c/go/+/637496
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agocmd/dist: skip fips140test in exe mode on Android
Cherry Mui [Wed, 18 Dec 2024 16:28:18 +0000 (11:28 -0500)]
cmd/dist: skip fips140test in exe mode on Android

Android does not support non-PIE linking. Skip the test.

Change-Id: I53071538c82f1e1f96eed1a2619f92eacd18d263
Reviewed-on: https://go-review.googlesource.com/c/go/+/637495
Run-TryBot: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

4 months agoweak: improve grammar in doc comments
Michal Bohuslávek [Wed, 18 Dec 2024 12:32:37 +0000 (13:32 +0100)]
weak: improve grammar in doc comments

Change-Id: I577b8a6bf2b7d899cc7ff7211c73549c90db9d94
Reviewed-on: https://go-review.googlesource.com/c/go/+/637355
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 months agocrypto/ecdsa: fix condition for fips140=only check
Mauri de Souza Meneguzzo [Wed, 18 Dec 2024 16:19:24 +0000 (16:19 +0000)]
crypto/ecdsa: fix condition for fips140=only check

Fixes #70894

Change-Id: I78c9f2e46006ffc5f1d2886218f8aaaf3f1b59eb
GitHub-Last-Rev: 11f0b452f57aacc40139eab557a8bed1386ad07b
GitHub-Pull-Request: golang/go#70904
Reviewed-on: https://go-review.googlesource.com/c/go/+/637455
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: David Chase <drchase@google.com>
4 months agocrypto/tls: normalize spelling of "ClientHello" in comments
Filippo Valsorda [Tue, 17 Dec 2024 19:47:17 +0000 (20:47 +0100)]
crypto/tls: normalize spelling of "ClientHello" in comments

Change-Id: I2b62fb37ae390c42682354eaa2a9d03159563b6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/637179
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: David Chase <drchase@google.com>
4 months agocrypto/pbkdf2: update RFC reference in package doc
Filippo Valsorda [Tue, 17 Dec 2024 19:39:24 +0000 (20:39 +0100)]
crypto/pbkdf2: update RFC reference in package doc

Now that it's published, we don't need to explain how we diverge from
the old one.

Change-Id: If2c22e89dd1b9fc531a363b5fb7b1eb5720eb84e
Reviewed-on: https://go-review.googlesource.com/c/go/+/637215
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agocmd/go,crypto: reject using Go+BoringCrypto and fips140 together
Filippo Valsorda [Tue, 17 Dec 2024 18:57:54 +0000 (19:57 +0100)]
cmd/go,crypto: reject using Go+BoringCrypto and fips140 together

The combination is untested and nonsensical. Both are solutions to the
same problem.

For #69536

Change-Id: I95cc3baaf03b64ce08096e304e311a29e9577385
Reviewed-on: https://go-review.googlesource.com/c/go/+/637177
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: David Chase <drchase@google.com>
4 months agotesting: support B.Context and F.Context
Ian Lance Taylor [Tue, 17 Dec 2024 23:31:10 +0000 (15:31 -0800)]
testing: support B.Context and F.Context

CL 603959 added T.Context for #36532.

The discussion on the proposal only mentions t.Context.
However, the implementation of CL 603959 also added B.Context and F.Context.
They were added to the API listing, and B.Context was mentioned in
the release notes.

Unfortunately, the new B.Context and F.Context methods always
returned nil, rather than a context.Context value.

This change adds a working implementation of B.Context and F.Context.

For #36532
Fixes #70866

Change-Id: I8a44e6649fb658e4f641ffb7efd08b4374f578ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/637236
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
4 months agodebug/elf: adjust version API per issue discussion
Ian Lance Taylor [Tue, 17 Dec 2024 19:31:17 +0000 (11:31 -0800)]
debug/elf: adjust version API per issue discussion

This updates the new version API for the discussion on #63952.

Note that the current tests do not have symbols with hidden versions.
Leaving that for later.

For #63952

Change-Id: I1ad4b1e485429a216ba8e5b68f7f4299d120628f
Reviewed-on: https://go-review.googlesource.com/c/go/+/637235
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>

4 months agocrypto/internal/fips140/aes/gcm: use aes.EncryptBlockInternal on ppc64x and s390x
Filippo Valsorda [Tue, 17 Dec 2024 16:55:01 +0000 (17:55 +0100)]
crypto/internal/fips140/aes/gcm: use aes.EncryptBlockInternal on ppc64x and s390x

Left them out of CL 636775 because I did a search by reference, which
does not span architectures.

Fixes crypto/cipher.TestFIPSServiceIndicator failure on ppc64x and s390x.

For #69536

Change-Id: I34b49705a7099066e8c3871a7a34b394a9298e98
Reviewed-on: https://go-review.googlesource.com/c/go/+/637175
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agocrypto/internal/fips140: add Name and Version
Filippo Valsorda [Mon, 16 Dec 2024 16:44:21 +0000 (17:44 +0100)]
crypto/internal/fips140: add Name and Version

Per ISO/IEC 19790:2012, Section 7.4.3.1.

> A cryptographic module shall [04.12] provide the following services to
> operators.
>
> a) Show module’s versioning information. The cryptographic module
> shall [04.13] output the name or module identifier and the versioning
> information that can be correlated with a validation record (e.g.
> hardware, software and/or firmware versioning information)."

For #69536

Change-Id: I8061f64e4ae60a4666f6abd892cb1301d6bf2452
Reviewed-on: https://go-review.googlesource.com/c/go/+/636558
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agocmd, go: fix some typos
wangshuo [Tue, 17 Dec 2024 12:50:44 +0000 (12:50 +0000)]
cmd, go: fix some typos

Change-Id: I0fd54ae5294eb4ef30cdef05adb8825f69077b14
GitHub-Last-Rev: ccfa48cbe4525dc2bd60e9ac7e2c150e480ba13f
GitHub-Pull-Request: golang/go#70823
Reviewed-on: https://go-review.googlesource.com/c/go/+/635915
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agobytes, strings: add cross-references in docstrings
Oleksandr Redko [Tue, 17 Dec 2024 17:05:23 +0000 (19:05 +0200)]
bytes, strings: add cross-references in docstrings

For newly funcs SplitSeq, SplitAfterSeq, FieldsSeq, FieldsFuncSeq.

Updates #61901.

Change-Id: I3c97bfd9c2250de68aaea348c82a05635ee797af
Reviewed-on: https://go-review.googlesource.com/c/go/+/637176
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agocmd/go/internal/help: use secure link to swig.org
Oleksandr Redko [Tue, 17 Dec 2024 18:14:16 +0000 (20:14 +0200)]
cmd/go/internal/help: use secure link to swig.org

Change-Id: Ifd315128ceeddf92bc16647869c3ace77ed1f430
Reviewed-on: https://go-review.googlesource.com/c/go/+/637195
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agosyscall, internal/syscall/unix: fix fstatat on linux/mips64
Damien Neil [Tue, 3 Dec 2024 20:22:49 +0000 (12:22 -0800)]
syscall, internal/syscall/unix: fix fstatat on linux/mips64

On linux/mips64, the syscall.Stat_t struct does not match the
kernel version of the struct. Functions that operate on a Stat_t
translate between it and the kernel struct.

The fstatat function was not doing this translation.
Make it do so.

Export a syscall.Fstatat on mips64 for usage by
internal/syscall/unix. Perhaps we should just do this on all
architectures, but this is the smaller change for now.

Fixes #70659

Change-Id: I38e36473689be25861953b418c9abc5b270a7bcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/633280
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
4 months agospec: explain function invocation and passing of parameters more precisely
Robert Griesemer [Thu, 12 Dec 2024 19:31:49 +0000 (11:31 -0800)]
spec: explain function invocation and passing of parameters more precisely

- Describe that function invocation allocates space for a functions'
  variables.
- Explain parameter passing in terms of assignments.

Change-Id: Ia693d73a570f7d1aa2ac05e6095b4e602e4e9bf2
Reviewed-on: https://go-review.googlesource.com/c/go/+/635800
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Rob Pike <r@golang.org>
4 months agogo/build: streamline the crypto package graph in TestDependencies
Filippo Valsorda [Mon, 16 Dec 2024 14:52:47 +0000 (15:52 +0100)]
go/build: streamline the crypto package graph in TestDependencies

Change-Id: I975243b4897d5161b839f142afbd2a46bfa1fab0
Reviewed-on: https://go-review.googlesource.com/c/go/+/636555
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
4 months agogo/build: remove nonexistent package from TestDependencies
qmuntal [Mon, 16 Dec 2024 10:07:02 +0000 (11:07 +0100)]
go/build: remove nonexistent package from TestDependencies

crypto/internal/boring/fips140tls is not a package in the Go standard
library, so it should not be listed in TestDependencies.

Change-Id: I6476da397b0204fcbd0a11b27a29112fca4b6023
Reviewed-on: https://go-review.googlesource.com/c/go/+/636415
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
4 months agocrypto/rsa: revert minimum GenerateKey size to 32 bits
Filippo Valsorda [Mon, 16 Dec 2024 16:33:50 +0000 (17:33 +0100)]
crypto/rsa: revert minimum GenerateKey size to 32 bits

No point in causing breakage even with GODEBUG=rsa1024min=0.

Change-Id: I923254a8c8afaca77be551b19e3555c44ebdbb67
Reviewed-on: https://go-review.googlesource.com/c/go/+/636557
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
4 months agocrypto/cipher: block non-AES CTR and CBC in fips140=only mode
Filippo Valsorda [Mon, 16 Dec 2024 18:30:58 +0000 (19:30 +0100)]
crypto/cipher: block non-AES CTR and CBC in fips140=only mode

Somehow I had missed these.

For #69536

Change-Id: I5e60b6f052bbfb707742ad15f663517c6c5f68d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/636795
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
4 months agocrypto/internal/fips140/aes: mark AES-ECB as not approved
Filippo Valsorda [Mon, 16 Dec 2024 18:24:20 +0000 (19:24 +0100)]
crypto/internal/fips140/aes: mark AES-ECB as not approved

NIST SP 800-131Ar3 ipd, scheduled for publication in 2025Q1, marks
AES-ECB as disallowed for encryption, and legacy use for decryption.

There are apparently no details on how the transition is going to work,
so to avoid surprises we just mark direct use of the Block as
non-approved.

We need to use Encrypt from higher level modes without tripping the
service indicator. Within the aes package, we just use the internal
function. For the gcm package we could do something more clever, but
this deep into the freeze, just make an exported function that we commit
to use nowhere else.

I could not figure out a decent way to block ECB on GODEBUG=fips140=only.

For #69536

Change-Id: I972a4b5da8efd0a0ab68d7dd509bec73aa2d6b68
Reviewed-on: https://go-review.googlesource.com/c/go/+/636775
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agocmd/go/testdata/script: update test_flags for new test output
Michael Matloob [Fri, 13 Dec 2024 22:33:16 +0000 (17:33 -0500)]
cmd/go/testdata/script: update test_flags for new test output

With CL 635856, an error for a package missing go files is now caught at
load time rather than at build time, so it's reported differently.
Update the test to check for the correct output unbreak the builders.

For #70820

Change-Id: I91fcac17961635b9a92782caa58c9a6f057a7e02
Reviewed-on: https://go-review.googlesource.com/c/go/+/637115
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agofmt, strconv: document that exponent is always two digits
Ian Lance Taylor [Mon, 16 Dec 2024 23:38:43 +0000 (15:38 -0800)]
fmt, strconv: document that exponent is always two digits

Except for %b where it is only one.

Fixes #70862

Change-Id: Ic423a799b73bfa534f4083f6544bb9cd639fef06
Reviewed-on: https://go-review.googlesource.com/c/go/+/636915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

4 months agocmd/link: update runtime dependency list
Cherry Mui [Mon, 16 Dec 2024 22:06:35 +0000 (17:06 -0500)]
cmd/link: update runtime dependency list

There have been a number of internal packages that the runtime
package depends on. Update the list. We should stop using a hard-
coded list.

Change-Id: I6f9338d6690d955b8200f3301addd0e133a1bfe2
Reviewed-on: https://go-review.googlesource.com/c/go/+/636478
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
4 months agocmd/go: don't create test actions for incomplete packages
Michael Matloob [Fri, 13 Dec 2024 22:33:16 +0000 (17:33 -0500)]
cmd/go: don't create test actions for incomplete packages

If a package is incomplete, don't create the actions for building and
testing it. Instead report the errors for the package's dependencies
and report a setup failed error (similar to what we'd to for a load
error when producing the test packages). This produces similar errors to
what were produced by load.CheckPackageErrors while still produing the
test failure actions per package under test.

(I wasn't sure what to do about the last test case in test_setup_error.
I think it should be treated the same as other load errors?)

Fixes #70820

Change-Id: Ie95e3c158c50ed35a1f27237ef3db40502719993
Reviewed-on: https://go-review.googlesource.com/c/go/+/635856
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
4 months agoruntime: usleep in TestWeakToStrongMarkTermination
Michael Anthony Knyszek [Fri, 13 Dec 2024 23:18:59 +0000 (23:18 +0000)]
runtime: usleep in TestWeakToStrongMarkTermination

There's a subtle bug in this test (big surprise): time.Sleep allocates,
so the time.Sleep(100*time.Millisecond) before unblocking gcMarkDone
might itself end up in gcMarkDone.

Work around this by using usleep here instead.

Fixes #70532.

Change-Id: I4c642ebb12f737cdb0d79ccff64b6059fc3d8b34
Reviewed-on: https://go-review.googlesource.com/c/go/+/636155
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agotesting: don't measure cleanup time after B.Loop
Austin Clements [Fri, 13 Dec 2024 02:18:44 +0000 (21:18 -0500)]
testing: don't measure cleanup time after B.Loop

B.Loop resets the timer on the first iteration so that setup code
isn't measured, but it currently leaves the timer running after the
last iteration, meaning that cleanup code will still be measured. Fix
this by stopping the timer when B.Loop returns false to indicate the
end of the benchmark.

Updates #61515

Change-Id: I0e0502cb2ce3c24cf872682b88d74e8be2c4529b
Reviewed-on: https://go-review.googlesource.com/c/go/+/635898
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
4 months agotesting: improve B.Loop test
Austin Clements [Fri, 13 Dec 2024 02:17:04 +0000 (21:17 -0500)]
testing: improve B.Loop test

This moves the B.Loop test from package testing_test to package
testing, where it can check on more of the internals of the benchmark
state.

Updates #61515.

Change-Id: Ia32d7104526125c5e8a1e35dab7660008afcbf80
Reviewed-on: https://go-review.googlesource.com/c/go/+/635897
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
4 months agotesting: improve b.Loop example
Austin Clements [Thu, 12 Dec 2024 23:19:43 +0000 (18:19 -0500)]
testing: improve b.Loop example

The current b.Loop example doesn't focus on the basic usage of b.Loop.
Replace this with a new example that uses (slightly) more realistic
things to demonstrate the most salient points of b.Loop.

We also move the example into an example file so that we can write a
real Benchmark function and a real function to be benchmarks, which
makes this much closer to what a user would actually write.

Updates #61515.

Change-Id: I4d830b3bfe3eb3cd8cdecef469fea0541baebb43
Reviewed-on: https://go-review.googlesource.com/c/go/+/635896
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agotesting: improve B.Loop docs, use B.Loop in examples
Austin Clements [Thu, 12 Dec 2024 20:43:37 +0000 (15:43 -0500)]
testing: improve B.Loop docs, use B.Loop in examples

This updates the testing documentation to frame B.Loop as the
canonical way to write benchmarks. We retain documentation on b.N
benchmarks because people will definitely continue to see them (and
write them), but it's demoted to clearly second class.

This also attempts to clarify and refine the B.Loop documentation
itself.

Updates #61515
Fixes #70787

Change-Id: If5123435bfe3a5883a753119ecdf7bbc41afd499
Reviewed-on: https://go-review.googlesource.com/c/go/+/635895
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Caleb Spare <cespare@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>

4 months agocmd/go: drop FailedBuild field if gotestjsonbuildtext=1
Austin Clements [Fri, 13 Dec 2024 20:36:47 +0000 (15:36 -0500)]
cmd/go: drop FailedBuild field if gotestjsonbuildtext=1

go test -json has two new effects in Go 1.24: it implies go build
-json, and it adds a FailedBuild field in test events. For
compatibility, CL 629335 added gotestjsonbuildtext=1, which disables
the implicit go build -json, but that CL didn't affect the FailedBuild
field. In principle this shouldn't matter because it's just another
JSON field, but just so we don't have to worry about some intermediate
behavior, this CL makes gotestjsonbuildtext=1 disable the FailedBuild
field as well.

Updates #62067
Updates #70402

Change-Id: I006d1ea0468980ee2564495324e8b4ed082898af
Reviewed-on: https://go-review.googlesource.com/c/go/+/635899
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
4 months agocmd/link: make dwarf name slice index self-describing
Michael Pratt [Fri, 13 Dec 2024 20:05:27 +0000 (15:05 -0500)]
cmd/link: make dwarf name slice index self-describing

cmd/compile/internal/dwarfgen.createComplexVar does it this way, which
has the nice property of documenting the expected prefix.

This is primarily for newtype, since defgotype checks for the prefix
immediately prior, but I changed both for consistency.

Change-Id: I49fa7c6166bdcbd19aaf91fe3dc20537080afcfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/635177
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>

4 months agocrypto/ecdsa: fix s390x assembly with P-521
Filippo Valsorda [Fri, 13 Dec 2024 15:59:20 +0000 (16:59 +0100)]
crypto/ecdsa: fix s390x assembly with P-521

I had incorrectly assumed that the blocksize was always the same as the
curve field size. This is true of P-256 and P-384, but not P-521.

Fixes #70660
Fixes #70771

Change-Id: Idb6b510fcd3dd42d9b1e6cf42c1bb92e0ce8bd07
Reviewed-on: https://go-review.googlesource.com/c/go/+/636015
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
4 months agocrypto/internal/cryptotest: skip TestAllocations on s390x
Filippo Valsorda [Fri, 13 Dec 2024 16:16:44 +0000 (17:16 +0100)]
crypto/internal/cryptotest: skip TestAllocations on s390x

TestXAESAllocations fails like #70448, and crypto/rand's fails in FIPS
mode. We can't keep chasing these without even a LUCI builder.

Updates #67307

Change-Id: I5d0edddf470180a321dec55cabfb018db62eb940
Reviewed-on: https://go-review.googlesource.com/c/go/+/636055
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
4 months agofmt: add more function and allocation tests
thepudds [Tue, 19 Sep 2023 18:44:08 +0000 (14:44 -0400)]
fmt: add more function and allocation tests

This is part of a series of CLs that aim to reduce how often interface
arguments escape for the print functions in fmt.

Currently, method values are one of two reasons reflect.Value.Interface
always escapes its reflect.Value.

Our later CLs modify behavior around method values, so we add some tests
of function formatting (including method values) to help reduce the
chances of breaking behavior later.

We also add in some allocation tests focused on interface arguments for
the print functions. These currently do not show any improvements
compared to Go 1.21.

These tests were originally in a later CL in our stack (CL 528538),
but we split them out into this CL and moved them earlier in the stack.

Updates #8618

Change-Id: Iec51abc3b7f86a2711e7497fc2fb7a678b9f8f73
Reviewed-on: https://go-review.googlesource.com/c/go/+/529575
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
4 months agoruntime: migrate missing map linkname allowlists
Michael Pratt [Fri, 13 Dec 2024 15:26:50 +0000 (10:26 -0500)]
runtime: migrate missing map linkname allowlists

The swissmap implementation forgot to copy some of the linkname
allowlists from the old implementation. Copy them from map_noswiss.go.
Some were missing linkname entirely; others were linknamed but missing
the hall of shame comment.

For #54766.

Change-Id: Icc715384123e73d868b4cb729ab639abcd6bbfd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/635995
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agospec: align EBNF rules consistently (cosmetic change)
Robert Griesemer [Thu, 12 Dec 2024 19:28:09 +0000 (11:28 -0800)]
spec: align EBNF rules consistently (cosmetic change)

Change-Id: Ib1b14b8880c6de5606f7f425a5fc1c8749d8a4b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/635799
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

4 months agosyscall: on freebsd-386 only update written for certain errors
Ian Lance Taylor [Thu, 12 Dec 2024 22:07:13 +0000 (14:07 -0800)]
syscall: on freebsd-386 only update written for certain errors

Testing on the freebsd-386 gomote seems to show that sendfile returns
a non-zero number of bytes written even when it returns EINVAL.
This confuses the caller. Change the Go code to only return non-zero
on success or EINTR or EAGAIN, which are the only cases where the
man page says that sendfile updates the number of bytes.

For #70763

Change-Id: Icc04e6286b5b29a2029237711d50fe4973234f0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/635815
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

4 months agonet: fix example function name for IP.To4
Oleksandr Redko [Thu, 12 Dec 2024 18:08:35 +0000 (20:08 +0200)]
net: fix example function name for IP.To4

Change-Id: Ia9a2c3a9f53792173cd1fb9f8e1a078fe3444945
Reviewed-on: https://go-review.googlesource.com/c/go/+/635136
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
4 months agocmd/internal/obj: disallow linknamed access to builtin symbols
Cherry Mui [Thu, 12 Dec 2024 19:31:45 +0000 (14:31 -0500)]
cmd/internal/obj: disallow linknamed access to builtin symbols

Currently, a symbol reference is counted as a reference to a
builtin symbol if the name matches a builtin. Usually builtin
references are generated by the compiler. But one could manually
write one with linkname. Since the list of builtin functions are
subject to change from time to time, we don't want users to depend
on their names. So we don't count a linknamed reference as a
builtin reference, and instead, count it as a named reference, so
it is checked by the linker.

Change-Id: Id3543295185c6bbd73a8cff82afb8f9cb4fd6f71
Reviewed-on: https://go-review.googlesource.com/c/go/+/635755
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agocmd/link: block new standard library linknames
Cherry Mui [Thu, 12 Dec 2024 18:03:49 +0000 (13:03 -0500)]
cmd/link: block new standard library linknames

In Go 1.24 we added a number of new linknames for standard library
internal uses. Add them to the linker's blocklist to keep them
internal.

Change-Id: Ibb7fa095506c161604e978ae196a7cf248475b2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/635676
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
4 months agobuiltin: document clear is a no-op if its argument's value is nil
apocelipes [Thu, 12 Dec 2024 09:45:09 +0000 (09:45 +0000)]
builtin: document clear is a no-op if its argument's value is nil

Just like the builtin function delete's comment does.

Change-Id: Id94a3aaa03c7b09594bae2b1af901d9060d9e255
GitHub-Last-Rev: 30cbebca96d9099f67a7dfc7650357aa19d6b810
GitHub-Pull-Request: golang/go#70801
Reviewed-on: https://go-review.googlesource.com/c/go/+/635535
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>

4 months agointernal/poll: in SendFile treat ENOTSUP like EOPNOTSUPP
Ian Lance Taylor [Wed, 11 Dec 2024 22:02:28 +0000 (14:02 -0800)]
internal/poll: in SendFile treat ENOTSUP like EOPNOTSUPP

Fixes #70763

Change-Id: Ifb79b5b0529f7977df0fe1b59d224b8b31df2c9b
Reviewed-on: https://go-review.googlesource.com/c/go/+/635396
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

4 months agocmd/cgo: use full prototype for main in C code
Ian Lance Taylor [Wed, 11 Dec 2024 04:05:06 +0000 (20:05 -0800)]
cmd/cgo: use full prototype for main in C code

Avoids pedantic errors from modern C compilers.

Fixes #70769

Change-Id: Ibe0d9960e998eb0346b97d7bd69eb7de0d0e6c60
Reviewed-on: https://go-review.googlesource.com/c/go/+/635095
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agodebug/elf: adjust version API per issue discussion
Ian Lance Taylor [Wed, 11 Dec 2024 03:48:11 +0000 (19:48 -0800)]
debug/elf: adjust version API per issue discussion

This updates the new version API for the discussion on #63952.

This change reveals that in fact none of the tests set the
VERSYM_HIDDEN bit. The code before this CL set the hidden flag
for symbols that appear in DynamicVersionNeed, but that is not
an accurate representation of the ELF. The readelf program
does print undefined symbols that way (with a single '@'),
but that doesn't mean that the hidden flag is set.
Leaving tests with the hidden bit set for later.

For #63952

Change-Id: Ida60831e0c9922dfc10f10c7a64bc76a2b197537
Reviewed-on: https://go-review.googlesource.com/c/go/+/635079
Reviewed-by: Austin Clements <austin@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
4 months agocrypto: use provided random Reader in FIPS mode
Filippo Valsorda [Wed, 11 Dec 2024 13:50:00 +0000 (14:50 +0100)]
crypto: use provided random Reader in FIPS mode

This removes the difference in behavior between FIPS mode on and off.

Instead of the sentinel type we could have moved the Reader to the
drbg package and checked for equality, but then we would have locked the
crypto/rand.Reader implementation to the one in the FIPS module (which
we might have to support for years).

In internal/ed25519.GenerateKey we remove the random parameter entirely,
since that function is not actually used by crypto/ed25519.GenerateKey,
which instead commits to being deterministic.

Fixes #70772

Change-Id: Ic1c7ca2c1cd59eb9cd090a8b235c0ce218921ac5
Reviewed-on: https://go-review.googlesource.com/c/go/+/635195
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agolog/slog: make DiscardHandler example package-level
Jonathan Amsterdam [Wed, 11 Dec 2024 19:38:57 +0000 (14:38 -0500)]
log/slog: make DiscardHandler example package-level

Fixes #70782.

Change-Id: I8e8b763040bd10147eb7d1a30ac0774e28f90911
Reviewed-on: https://go-review.googlesource.com/c/go/+/635217
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
4 months agocmd/go: add more tests for GOAUTH's user provided authenticator
Sam Thanawalla [Wed, 11 Dec 2024 15:41:05 +0000 (15:41 +0000)]
cmd/go: add more tests for GOAUTH's user provided authenticator

For #26232
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I4b6eb63d4c1d71983e1ae764a6a38744a5f01317
Reviewed-on: https://go-review.googlesource.com/c/go/+/635255
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
4 months agonet/http: document zero value of Protocols
Damien Neil [Wed, 11 Dec 2024 17:49:36 +0000 (09:49 -0800)]
net/http: document zero value of Protocols

For #67814

Change-Id: I182e9c7e720493adb9d2384336e757dace818525
Reviewed-on: https://go-review.googlesource.com/c/go/+/635335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Austin Clements <austin@google.com>
4 months agocmd/compile: update broken link
Ian Lance Taylor [Wed, 11 Dec 2024 16:59:04 +0000 (08:59 -0800)]
cmd/compile: update broken link

Fixes #70778

Change-Id: Ie5ed53aa39446beb0316eb134cc705ea06b37435
Reviewed-on: https://go-review.googlesource.com/c/go/+/635295
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agonet: avoid unnecessary interface lookup fetching all interface addresses
Antonio Ojea [Wed, 11 Dec 2024 15:03:59 +0000 (15:03 +0000)]
net: avoid unnecessary interface lookup fetching all interface addresses

InterfaceAddrs returns a list of the system's unicast interface addresses.

In order to do so, the function reuses the existing helpers and
list first all addresses with the netlink call RTM_GETADDR, then
all interfaces with RTM_GETLINK, and later it merge both lists
(each address references an interface).

However, the list of interfaces and addresses are obtained at
different times and there can be inconsistencies and, if an
address references an interface that is not present in the list
of interfaces, the function fails with an error.

Since the function InterfaceAddress is only about the system
addresses, there is no need to list all the interfaces, and we can
obtain the list of addresses directly from the netlink call RTM_GETADDR.
There is no need to correlate this list with the list of interfaces, as
the OS is the source of truth and should be the one providing the
consistency between addresses and interfaces.

Fixes #51934

Change-Id: I3b816e8146b1c07fdfe1bf6af338f001ef75734f
Reviewed-on: https://go-review.googlesource.com/c/go/+/635196
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

4 months agointernal/goos: fix bug in gengoos.go
zfdx123 [Wed, 11 Dec 2024 04:17:11 +0000 (04:17 +0000)]
internal/goos: fix bug in gengoos.go

CL 601357 mistakenly added an extra period.

Change-Id: I54db621663797f094059a4eb86bf5d9626fa59d6
GitHub-Last-Rev: c756e0a82427c44b00bd88547dc40bf88c85fc1f
GitHub-Pull-Request: golang/go#70733
Reviewed-on: https://go-review.googlesource.com/c/go/+/634517
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
4 months agocmd/internal/objfile: break out dissassemblers to another package
Cherry Mui [Tue, 10 Dec 2024 17:00:10 +0000 (12:00 -0500)]
cmd/internal/objfile: break out dissassemblers to another package

Currently, cmd/internal/objfile provides dissassembly routines for
various architectures, which depend on dissassemblers from x/arch.
cmd/internal/objfile is imported in tools that need dissassembly
(objdump, pprof) and tools that don't need dissassembly (nm,
addr2line). Adding/improving disassembly support for more
architectures can cause binary size increase, and for some tools
(nm, addr2line) it is not necessary.

This CL breaks out dissassembly routines to a different package,
which is only imported in tools that need dissassembly. Other
tools can depend on cmd/internal/objfile without the disassembly
code from x/arch.

This reduces binary sizes for those tools. On darwin/arm64,

                                 old         new
cmd/addr2line                  4554418     3648882   -20%
cmd/addr2line (-ldflags=-w)    3464626     2641650   -24%
cmd/nm                         4503874     3616722   -20%
cmd/nm (-ldflags=-w)           3430594     2609490   -24%

For #70699.

Change-Id: Ie45d5d5c5500c5f3882e8b3c4e6eb81f0d815292
Reviewed-on: https://go-review.googlesource.com/c/go/+/634916
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
4 months agosyscall: remove a wrong comment in Clearenv
Kir Kolyshkin [Tue, 10 Dec 2024 20:10:13 +0000 (12:10 -0800)]
syscall: remove a wrong comment in Clearenv

The comment being removed was added by commit ff3173849e
(which predates Gerrit and Rietveld, so no CL link), and
at the time it made sense.

Since CL 148370043 (and up to the current implementation of Clearenv)
the env map, which is populated by copyenv, is actually used, so the
comment is no longer valid.

It is also misleading, so it's best to remove it.

Change-Id: I8bd2e8bca6262759538e5bcbd396f0c71cca6a4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/635078
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

4 months agoreflect: consistently document when value must be settable
Ian Lance Taylor [Wed, 11 Dec 2024 00:10:27 +0000 (16:10 -0800)]
reflect: consistently document when value must be settable

Fixes #70760

Change-Id: Ia00723698b7e502fa2c63f8f1dbe1143af22e0a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/634799
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>

4 months agoruntime: avoid panic in expired synctest timer chan read
Damien Neil [Tue, 10 Dec 2024 17:49:45 +0000 (09:49 -0800)]
runtime: avoid panic in expired synctest timer chan read

When reading from time.Timer.C for an expired timer using
a fake clock (in a synctest bubble), the timer will not
be in a heap. Avoid a spurious panic claiming the timer
moved between synctest bubbles.

Drop the panic when a bubbled goroutine reads from a
non-bubbled timer channel: We allow bubbled goroutines
to access non-bubbled channels in general.

Fixes #70741

Change-Id: I27005e46f4d0067cc6846d234d22766d2e05d163
Reviewed-on: https://go-review.googlesource.com/c/go/+/634955
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agohtml/template: escape script tags in JS errors case insensitively
Roland Shoemaker [Mon, 9 Dec 2024 19:53:32 +0000 (11:53 -0800)]
html/template: escape script tags in JS errors case insensitively

Thanks to Juho Forsén of Mattermost for reporting this issue.

Fixes #70740

Change-Id: I1a49b199dee91cd2bb4df5b174aaa958dc040c18
Reviewed-on: https://go-review.googlesource.com/c/go/+/634696
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
4 months agocrypto/internal/fips140/ecdsa: fix reseed_counter check for HMAC_DRBG_Generate_algorithm
Tom Thorogood [Tue, 10 Dec 2024 12:52:49 +0000 (23:22 +1030)]
crypto/internal/fips140/ecdsa: fix reseed_counter check for HMAC_DRBG_Generate_algorithm

SP 800-90A Rev. 1 10.1.2.5 step 7 requires
reseed_counter = reseed_counter + 1
as the final step before returning SUCCESS.

This increment of reseedCounter was missing, meaning the reseed interval
check at the start of Generate wasn't actually functional.

Given how it's used, and that it has a reseed interval of 2^48, this
condition will never actually occur but the check is still required by
the standard.

For #69536

Change-Id: I314a7eee5852e6d0fa1a0a04842003553cd803e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/634775
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 months agoruntime: make special offset a uintptr
Michael Anthony Knyszek [Mon, 9 Dec 2024 19:21:48 +0000 (19:21 +0000)]
runtime: make special offset a uintptr

Currently specials try to save on space by only encoding the offset from
the base of the span in a uint16. This worked fine up until Go 1.24.
- Most specials have an offset of 0 (mem profile, finalizers, etc.)
- Cleanups do not care about the offset at all, so even if it's wrong,
  it's OK.
- Weak pointers *do* care, but the unique package always makes a new
  allocation, so the weak pointer handle offset it makes is always zero.

With Go 1.24 and general weak pointers now available, nothing is
stopping someone from just creating a weak pointer that is >64 KiB
offset from the start of an object, and this weak pointer must be
distinct from others.

Fix this problem by just increasing the size of a special and making the
offset a uintptr, to capture all possible offsets. Since we're in the
freeze, this is the safest thing to do. Specials aren't so common that I
expect a substantial memory increase from this change. In a future
release (or if there is a problem) we can almost certainly pack the
special's kind and offset together. There was already a bunch of wasted
space due to padding, so this would bring us back to the same memory
footprint before this change.

Also, add tests for equality of basic weak interior pointers. This
works, but we really should've had tests for it.

Fixes #70739.

Change-Id: Ib49a7f8f0f1ec3db4571a7afb0f4d94c8a93aa40
Reviewed-on: https://go-review.googlesource.com/c/go/+/634598
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Commit-Queue: Michael Knyszek <mknyszek@google.com>

4 months agoruntime: remove datadog-agent from prof labels hall of shame
Paul Cacheux [Sun, 8 Dec 2024 20:45:48 +0000 (21:45 +0100)]
runtime: remove datadog-agent from prof labels hall of shame

github.com/DataDog/datadog-agent has stopped using runtime_setProfLabel
and runtime_getProfLabel, remove them from the hall of shame.

Updates #67401

Change-Id: I4a66c5e70397d43d7f064aeae5bad064e168316f
Reviewed-on: https://go-review.googlesource.com/c/go/+/634476
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
4 months agoweak: align weak.Pointer documentation with runtime.AddCleanup
Michael Anthony Knyszek [Sat, 7 Dec 2024 02:58:00 +0000 (02:58 +0000)]
weak: align weak.Pointer documentation with runtime.AddCleanup

In hindsight, I think the "advice" I wrote is a bit heavy-handed and
better suited for something like the GC guide. Listing the use-cases
seems good, and all the possible things that go wrong seems to do the
trick in terms of deterrence, like it does with finalizers.

Also, include some points I missed, like the tiny allocator warning and
the fact that weak pointers are not guaranteed to ever return nil.

Also, a lot of this actually shouldn't have been in the package docs.
Many of the warnings only apply to weak pointers, but not other data
structures that may live in this package in the future, like weak-keyed
maps.

Change-Id: Id245661540ffd93de4b727cd272284491d085c1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/634376
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

4 months agobufio: make the description of Peek's behavior better
Petr Osetrov [Fri, 6 Dec 2024 21:51:36 +0000 (21:51 +0000)]
bufio: make the description of Peek's behavior better

Previously, based on the description, it was not obvious that Peek could
change the buffer. It may have been mistakenly assumed that Peek would
always return an error if n is greater than b.Buffered().

Change-Id: I095006dd2ba1c2138bb193396cb24e2dda42d771
GitHub-Last-Rev: 9d48f8ac81f46d5b8f4a1885af28cbccd1747c3b
GitHub-Pull-Request: golang/go#70712
Reviewed-on: https://go-review.googlesource.com/c/go/+/634175
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
4 months agocmd/go: document the build cache as safe for concurrent use
Sean Liao [Mon, 2 Dec 2024 18:32:36 +0000 (18:32 +0000)]
cmd/go: document the build cache as safe for concurrent use

Fixes #26677

Change-Id: I2ca0408503000ccaddb0bd1fd359381ddd4fb699
Reviewed-on: https://go-review.googlesource.com/c/go/+/632895
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
4 months agolib/wasm: provide fs.constants.O_DIRECTORY definition
Dmitri Shuralyov [Sat, 7 Dec 2024 22:48:27 +0000 (17:48 -0500)]
lib/wasm: provide fs.constants.O_DIRECTORY definition

CL 606658 added a constants.Get("O_DIRECTORY").Int() call at init time,
which panics in browsers because O_DIRECTORY is undefined. It needs to
be a JavaScript number to avoid that.

Fixes #70723.

Change-Id: I727240bd25b47401d14a5e1a364d460708803f1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/634455
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Zxilly Chou <zhouxinyu1001@gmail.com>
4 months agoruntime: improve AddCleanup documentation
Austin Clements [Sat, 7 Dec 2024 01:43:16 +0000 (20:43 -0500)]
runtime: improve AddCleanup documentation

Steer people from SetFinalizer to AddCleanup. Address some of the
*non*-constraints on AddCleanup. Add some of the subtlety from the
SetFinalizer documentation to the AddCleanup documentation.

Updates #67535.
Updates #70425.

Change-Id: I8d13b756ca866051b8a5c19327fd5a76f5e0f3d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/634318
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>

4 months agocmd/go: document c-shared buildmode for building WASI library/reactor
Cherry Mui [Thu, 5 Dec 2024 18:01:32 +0000 (13:01 -0500)]
cmd/go: document c-shared buildmode for building WASI library/reactor

For #65199.

Change-Id: Icd3ec7cf25c2d381401686333c8aeed8013b3fbd
Reviewed-on: https://go-review.googlesource.com/c/go/+/633418
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agoruntime: add note that Callers never returns an entry PC
Michael Pratt [Fri, 6 Dec 2024 20:37:34 +0000 (15:37 -0500)]
runtime: add note that Callers never returns an entry PC

The presence of a pc > entry check in CallersFrame implies we might
actually see pc == entry, when in reality Callers will never return such
a PC. This check is actually just a safety check for avoid reporting
completely nonsensical from bad input.

all.bash reports two violations to this invariant:

TestCallersFromWrapper, which explicitly constructs a CallersFrame input
with an entry PC.

runtime/pprof.printStackRecord, which passes pprof stacks to
CallersFrame (technically not a valid use of CallersFrames!).
runtime/pprof.(*Profile).Add can add the entry PC of
runtime/pprof.lostProfileEvent to samples.

(CPU profiles do lostProfileEvent + 1. I will send a second CL to fix
Add.)

Change-Id: Iac2a2f0c15117d4a383bd84cddf0413b2d7dd3ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/634315
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 months agocmd/internal/goobj: add missing symbol align field in top level doc
Paul Cacheux [Fri, 6 Dec 2024 13:06:36 +0000 (14:06 +0100)]
cmd/internal/goobj: add missing symbol align field in top level doc

Fix the documentation of the symbol's align field that is present in the
code but not in the top level documentation

Change-Id: I753f2379b22487899ceee8ebc9c2e659d74ea986
Reviewed-on: https://go-review.googlesource.com/c/go/+/633777
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

4 months agoencoding/base64, encoding/base32: add doc details to DecodeString and AppendDecode
Dmytro Yeroshkin [Fri, 6 Dec 2024 15:49:52 +0000 (15:49 +0000)]
encoding/base64, encoding/base32: add doc details to DecodeString and AppendDecode

Currently only Encoding.Decode has the information that `\r` and
`\n` are ignored. However, this also applies to the other decoding
methods. Since this is not intuitive behavior, we should add this
information to the other impacted methods.

Change-Id: I6f71fe1f4280fe75f2694a3cc1b759652eb8b8c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/634215
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Chris Ingram <chrisingram@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Truc Le <trucleduc@google.com>
4 months agocmd/go: add tool meta-pattern to go help packages
Conrad Irwin [Sun, 1 Dec 2024 05:08:44 +0000 (22:08 -0700)]
cmd/go: add tool meta-pattern to go help packages

For #48429

Change-Id: I6932853c3156a68d099a749431d15d2c37785649
Reviewed-on: https://go-review.googlesource.com/c/go/+/632555
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agocmd/go: report tool errors in go list all
Conrad Irwin [Fri, 6 Dec 2024 05:25:14 +0000 (22:25 -0700)]
cmd/go: report tool errors in go list all

Before tools there was no way to directly import a package in another
module, and so missing packages were always marked as "all" due to being
dependencies of a package in a main module.

Tools break that assumption, and so to report errors in tool packages
correctly we need to mark packages as being in "all" even if they do not
exist.

Fixes #70582

Change-Id: I3273e0ec7910894565206de77986f5c249a5658c
Reviewed-on: https://go-review.googlesource.com/c/go/+/634155
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
4 months agocmd/go: use AppendPath(OrigEnv) as env for tool executable
Michael Matloob [Tue, 26 Nov 2024 01:29:11 +0000 (20:29 -0500)]
cmd/go: use AppendPath(OrigEnv) as env for tool executable

Before this change, when go tool wass used to start a tool defined in a
go.mod tool directive, it used the environment the go command was
running in. The issue with doing that is that the go command sets
various environment variables from the computed environment when
invoking a subcommand. That is used to standardise the environment for
the various tools invoked by the go command, but it is not the
expectatation of tools invoked by the go command, especially since those
environment variables may change the behavior of the tool run. Instead
use the same environment we use in go run to start the executable: the
original environment (with minor modifications) saved before we start
explicitly setting the envornment, with GOROOT/bin added to the path so
that sub commands that run the go tool use the proper go tool binary.

Fixes #70544

Change-Id: Ifbf0040a2543113638eec7232323eb9de1d61529
Reviewed-on: https://go-review.googlesource.com/c/go/+/631836
Reviewed-by: Conrad Irwin <conrad.irwin@gmail.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agoall: update vendored dependencies [generated]
Michael Anthony Knyszek [Thu, 5 Dec 2024 21:52:49 +0000 (21:52 +0000)]
all: update vendored dependencies [generated]

The Go 1.24 RC is due for next week. This is a time to once again update
all golang.org/x/... module versions that contribute packages to the
std and cmd modules in the standard library to latest master versions.

For #36905.

[git-generate]
go install golang.org/x/build/cmd/updatestd@latest
go install golang.org/x/tools/cmd/bundle@latest
updatestd -goroot=$(pwd) -branch=master

Change-Id: If4fd03a18590ff3b6e701a9698370c57c69979c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/634041
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
4 months agocmd/go: consistently use DefaultExecName for executable name
Michael Matloob [Thu, 5 Dec 2024 20:31:39 +0000 (15:31 -0500)]
cmd/go: consistently use DefaultExecName for executable name

go tool, go run, and the executable caching logic have all used
path.Base of a package's import path to set the name of the executable
produced. But the base name for a package name that's the same as a
module name ending in a major version is just that major version, which
is not very useful. For go build and go install, we use
load.DefaultExecName as the name of the binary which will select the
second to last element of the import path as the name of the executable
produced. This change changes go tool, go run, and the executable
caching logic to all use DefaultExecName consistently to pick the name
of the executable.

Change-Id: I8e615bbc6a4f9cc4549165c31954fab181d63318
Reviewed-on: https://go-review.googlesource.com/c/go/+/634039
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Conrad Irwin <conrad.irwin@gmail.com>
4 months agocmd/go: add -modfile and -modcacherw to go tool
Conrad Irwin [Sun, 1 Dec 2024 06:22:49 +0000 (23:22 -0700)]
cmd/go: add -modfile and -modcacherw to go tool

When adding support for module tools, we added the ability for `go tool`
to edit the module cache. For users with `GOFLAGS=-modcacherw` this
could have led to a situation where some of the files in the mod cache
were unexpectedly not deletable.

We also allow -modfile so that people can select which module they are
working in when looking for tools.

We still do not support arbitrary build flags for tools with `go tool`.
If you want those, use `go run` or `go build`, etc. instead.

Updates #48429

Change-Id: Ic3c56bb8b6ba46114196465ca6ee2dcb08b9dcc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/632575
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 months agotesting: fix divide by zero when benchmark is faster than OS's clock resolution
Jorropo [Fri, 6 Dec 2024 05:51:04 +0000 (06:51 +0100)]
testing: fix divide by zero when benchmark is faster than OS's clock resolution

I did not added a test because `benchmark_test.go` is `package testing_test`
and I don't care to change that because calling predictN is not testing the
thing I would want to test.

Ideally we would run benchmark in a VM with a highjacked clocksource that never
marches forward, or using faketime but that looks fairly involved for a quickie
fix.

Fixes #70709

Change-Id: I8b4d697aff7cba33da388cb0ae8e2c2b550b9690
Reviewed-on: https://go-review.googlesource.com/c/go/+/633419
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
4 months agocmd/compile: update default PGO profile
Cherry Mui [Thu, 5 Dec 2024 16:39:07 +0000 (11:39 -0500)]
cmd/compile: update default PGO profile

Since last time the default.pgo profile is collected, there has
been a lot of development in the compiler. It's time to refresh
the compiler's PGO profile.

Profile collected by running the cmd/compile/profile.sh script on
the gotip-linux-arm64_c4ah72-perf_vs_release gomote.

Benchmark results on Linux/AMD64:

         │   nopgo.txt   │              old.txt               │              new.txt               │
         │    sec/op     │   sec/op     vs base               │   sec/op     vs base               │
Template     112.0m ± 1%   109.7m ± 1%  -2.10% (p=0.000 n=20)   110.3m ± 1%  -1.55% (p=0.001 n=20)
Unicode      99.39m ± 0%   94.94m ± 0%  -4.49% (p=0.000 n=20)   94.33m ± 1%  -5.10% (p=0.000 n=20)
GoTypes      544.9m ± 0%   535.0m ± 1%  -1.80% (p=0.000 n=20)   535.1m ± 0%  -1.78% (p=0.000 n=20)
Compiler     96.23m ± 1%   90.86m ± 1%  -5.58% (p=0.000 n=20)   90.84m ± 1%  -5.60% (p=0.000 n=20)
SSA           3.403 ± 1%    3.273 ± 0%  -3.81% (p=0.000 n=20)    3.247 ± 0%  -4.57% (p=0.000 n=20)
Flate        71.55m ± 0%   70.09m ± 1%  -2.04% (p=0.000 n=20)   70.03m ± 1%  -2.13% (p=0.000 n=20)
GoParser     131.5m ± 1%   129.9m ± 1%  -1.19% (p=0.000 n=20)   129.4m ± 0%  -1.56% (p=0.000 n=20)
Reflect      275.5m ± 1%   268.6m ± 1%  -2.50% (p=0.000 n=20)   268.1m ± 1%  -2.70% (p=0.000 n=20)
Tar          131.6m ± 1%   128.4m ± 1%  -2.37% (p=0.000 n=20)   128.8m ± 1%  -2.07% (p=0.000 n=20)
XML          153.7m ± 1%   150.3m ± 1%  -2.26% (p=0.000 n=20)   149.7m ± 1%  -2.66% (p=0.000 n=20)
geomean      200.3m        194.7m       -2.82%                  194.4m       -2.98%

On Linux/ARM64:

         │   nopgo.txt   │              old.txt               │              new.txt               │
         │    sec/op     │   sec/op     vs base               │   sec/op     vs base               │
Template     82.38m ± 1%   80.52m ± 0%  -2.26% (p=0.000 n=20)   80.07m ± 1%  -2.81% (p=0.000 n=20)
Unicode      76.28m ± 0%   72.72m ± 0%  -4.66% (p=0.000 n=20)   72.40m ± 1%  -5.09% (p=0.000 n=20)
GoTypes      420.7m ± 0%   412.5m ± 0%  -1.95% (p=0.000 n=20)   408.1m ± 1%  -3.00% (p=0.000 n=20)
Compiler     69.85m ± 1%   67.40m ± 1%  -3.50% (p=0.000 n=20)   66.73m ± 1%  -4.47% (p=0.000 n=20)
SSA           2.846 ± 0%    2.733 ± 0%  -3.96% (p=0.000 n=20)    2.707 ± 0%  -4.90% (p=0.000 n=20)
Flate        49.14m ± 1%   47.87m ± 0%  -2.58% (p=0.000 n=20)   47.53m ± 1%  -3.26% (p=0.000 n=20)
GoParser     97.44m ± 1%   94.96m ± 1%  -2.55% (p=0.000 n=20)   94.75m ± 1%  -2.76% (p=0.000 n=20)
Reflect      210.5m ± 0%   205.2m ± 0%  -2.50% (p=0.000 n=20)   202.5m ± 0%  -3.78% (p=0.000 n=20)
Tar          97.75m ± 1%   95.72m ± 1%  -2.07% (p=0.000 n=20)   94.68m ± 1%  -3.13% (p=0.000 n=20)
XML          112.6m ± 0%   110.0m ± 0%  -2.33% (p=0.000 n=20)   108.7m ± 1%  -3.49% (p=0.000 n=20)
geomean      150.2m        145.9m       -2.84%                  144.6m       -3.67%

For #60234.

Change-Id: Ie1abc019339252cd9441a1fb1eab33a29c1dc11c
Reviewed-on: https://go-review.googlesource.com/c/go/+/634037
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: David Chase <drchase@google.com>
4 months agocmd/internal/objabi, internal/runtime: increase nosplit limit on OpenBSD
Damien Neil [Mon, 2 Dec 2024 20:45:55 +0000 (12:45 -0800)]
cmd/internal/objabi, internal/runtime: increase nosplit limit on OpenBSD

OpenBSD is bumping up against the nosplit limit, and openbsd/ppc64
is over it. Increase StackGuardMultiplier on OpenBSD, matching AIX.

Change-Id: I61e17c99ce77e1fd3f368159dc4615aeae99e913
Reviewed-on: https://go-review.googlesource.com/c/go/+/632996
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
4 months agocrypto/hkdf: add package doc comment
Ian Lance Taylor [Thu, 5 Dec 2024 23:44:26 +0000 (15:44 -0800)]
crypto/hkdf: add package doc comment

For #61477

Change-Id: I3d3ebf573a21f1f56edfffb3fea53c0b5cbfccd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/634095
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>

4 months agodoc/next: delete
Gopher Robot [Thu, 5 Dec 2024 21:25:20 +0000 (21:25 +0000)]
doc/next: delete

The release note fragments have been merged and added
as _content/doc/go1.24.md in x/website in CL 634056.

For #68545.

Change-Id: I7b3840df01b8c3699681c0cd21a16af70f74d31d
Reviewed-on: https://go-review.googlesource.com/c/go/+/634057
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 months agoapi: promote next to go1.24
Gopher Robot [Thu, 5 Dec 2024 21:15:57 +0000 (21:15 +0000)]
api: promote next to go1.24

Change-Id: Iddede5cbbc7c6cb4335194719b69f49f1d8cd662
Reviewed-on: https://go-review.googlesource.com/c/go/+/634055
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
4 months agotesting: improve documentation, examples, release notes for
Junyang Shao [Wed, 4 Dec 2024 20:11:18 +0000 (20:11 +0000)]
testing: improve documentation, examples, release notes for

testing.b.Loop.

This CL added documentation of the no-inlining semantic of b.Loop, with
a concrete example. This CL also tries to improve the release note to be
more descriptive.

Fixes #61515

Change-Id: I1e13cc92d5d6bdbf40fb44f44475e249747b807f
Reviewed-on: https://go-review.googlesource.com/c/go/+/633536
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
4 months agocmd/compile: document wasmexport directive, update permitted types for wasmimport
Cherry Mui [Thu, 5 Dec 2024 17:04:35 +0000 (12:04 -0500)]
cmd/compile: document wasmexport directive, update permitted types for wasmimport

For #65199, #66984.

Change-Id: I9b651a00265fa7d3438d8a73ff04ddca7c4bed99
Reviewed-on: https://go-review.googlesource.com/c/go/+/633776
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 months agocmd/go/testdata/script: skip EndSequence entries in build_trimpath_cgo
Michael Matloob [Tue, 3 Dec 2024 21:23:18 +0000 (16:23 -0500)]
cmd/go/testdata/script: skip EndSequence entries in build_trimpath_cgo

The TestScript/build_trimpath_cgo test for cmd/go has been accessing a
nil pointer when it tries to look up LineEntry.File.Name on a line entry
with EndSequence set to true. The doc for EndSequence specifies that if
EndSequence is set, only it and the Address field are meaningful. Skip
the entries with EndSequence set when building the set of files.

Fixes #70669

Change-Id: I421a2a9348e727e3ac4a3d42baa4d206cfbc047b
Reviewed-on: https://go-review.googlesource.com/c/go/+/633038
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@golang.org>
4 months agodoc/next: introduce module tools
Conrad Irwin [Sun, 1 Dec 2024 05:13:52 +0000 (22:13 -0700)]
doc/next: introduce module tools

Fixes #48429

Change-Id: Ie1954fc3bedd7d36cafaf3835b6c3a92326393f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/632556
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 months agocrypto/internal/fips140/bigmod: add more //go:norace annotations
Russ Cox [Thu, 5 Dec 2024 03:08:35 +0000 (22:08 -0500)]
crypto/internal/fips140/bigmod: add more //go:norace annotations

//go:norace does not carry over when a function is inlined.
Add //go:norace to functions that inline loops over Nat words.
Improves race tests, also asan, msan.

These are with -race:

goos: darwin
goarch: arm64
pkg: crypto/internal/fips140/bigmod
cpu: Apple M3 Pro
                  │     old      │                 new                 │
                  │    sec/op    │   sec/op     vs base                │
ModAdd-12            172.4n ± 3%   117.9n ± 3%  -31.62% (p=0.000 n=20)
ModSub-12            147.1n ± 2%   111.4n ± 3%  -24.27% (p=0.000 n=20)
NewModulus-12       12.966µ ± 1%   9.743µ ± 2%  -24.86% (p=0.000 n=20)
MontgomeryRepr-12   1305.5n ± 1%   986.3n ± 0%  -24.45% (p=0.000 n=20)
MontgomeryMul-12    1304.0n ± 1%   976.8n ± 0%  -25.10% (p=0.000 n=20)
ModMul-12            2.893µ ± 1%   2.055µ ± 3%  -28.97% (p=0.000 n=20)
ExpBig-12            2.784m ± 0%   2.789m ± 0%   +0.17% (p=0.008 n=20)
Exp-12               3.468m ± 0%   2.620m ± 0%  -24.45% (p=0.000 n=20)
geomean              7.930µ        6.073µ       -23.41%

pkg: crypto/rsa
                             │      old      │                 new                  │
                             │    sec/op     │    sec/op     vs base                │
DecryptPKCS1v15/2048-12         1.795m ±  1%   1.175m ±  1%  -34.52% (p=0.000 n=20)
DecryptPKCS1v15/3072-12         3.836m ±  2%   2.647m ±  0%  -31.01% (p=0.000 n=20)
DecryptPKCS1v15/4096-12         7.316m ±  0%   5.437m ±  0%  -25.68% (p=0.000 n=20)
EncryptPKCS1v15/2048-12         45.85µ ±  1%   34.78µ ±  0%  -24.15% (p=0.000 n=20)
DecryptOAEP/2048-12             1.793m ±  2%   1.188m ±  1%  -33.76% (p=0.000 n=20)
EncryptOAEP/2048-12             55.11µ ±  1%   43.91µ ±  1%  -20.32% (p=0.000 n=20)
SignPKCS1v15/2048-12            1.797m ±  2%   1.193m ±  0%  -33.62% (p=0.000 n=20)
VerifyPKCS1v15/2048-12          45.16µ ±  1%   34.51µ ±  0%  -23.57% (p=0.000 n=20)
SignPSS/2048-12                 1.826m ±  2%   1.213m ±  0%  -33.55% (p=0.000 n=20)
VerifyPSS/2048-12               53.25µ ±  1%   42.40µ ±  1%  -20.36% (p=0.000 n=20)
GenerateKey/2048-12             323.7m ± 33%   209.0m ± 17%  -35.43% (p=0.000 n=20)
ParsePKCS8PrivateKey/2048-12   105.26µ ±  0%   94.74µ ±  0%   -9.99% (p=0.000 n=20)
geomean                         792.5µ         574.3µ        -27.53%

Change-Id: I1f1986cf2bac126d7346799b08b17d356b28d956
Reviewed-on: https://go-review.googlesource.com/c/go/+/633995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
4 months agodoc/next: add release notes for Wasm changes
Cherry Mui [Thu, 5 Dec 2024 16:35:37 +0000 (11:35 -0500)]
doc/next: add release notes for Wasm changes

Document wasmexport and WASI reactor/library mode. Also document
that we now permit more types for wasmimport.

Fixes #65199.
Updates #66984.
For #68545.

Change-Id: Id26a8c9496650cd154daed679b82223af1848eea
Reviewed-on: https://go-review.googlesource.com/c/go/+/634036
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 months agocmd/go: drop -v from go help get
Sean Liao [Thu, 28 Nov 2024 16:23:53 +0000 (16:23 +0000)]
cmd/go: drop -v from go help get

Fixes #37301

Change-Id: I6d6ac818a73b907638f62d56bd5a7f00a6e6a5ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/632178
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
4 months agoembed: document exclusions more explicitly
Sean Liao [Wed, 4 Dec 2024 21:56:45 +0000 (21:56 +0000)]
embed: document exclusions more explicitly

Fixes #45197
Fixes #45744

Change-Id: Ic221da1b652f693c7aa37287932c0a8726f46765
Reviewed-on: https://go-review.googlesource.com/c/go/+/633815
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agodoc/next: add linker change release notes
Cherry Mui [Wed, 4 Dec 2024 22:24:54 +0000 (17:24 -0500)]
doc/next: add linker change release notes

Document that we now generate GNU build ID or Mach-O UUID by
default, and the related flags to disable or override it.

Fixes #68678.
Fixes #70586.
For #68545.

Change-Id: Ic79f3c05aab8a5032ba6983b8c72eeb4202bfe84
Reviewed-on: https://go-review.googlesource.com/c/go/+/633875
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 months agoweak: fix subheading syntax in package doc
thepudds [Thu, 5 Dec 2024 04:36:17 +0000 (23:36 -0500)]
weak: fix subheading syntax in package doc

Go doc comments only support one level of heading.

Change-Id: I458f211bc7547a0676a59fdcb72f52ca480bf184
Reviewed-on: https://go-review.googlesource.com/c/go/+/633881
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 months agoweak: massage package docs a little bit
Michael Anthony Knyszek [Wed, 4 Dec 2024 19:33:26 +0000 (19:33 +0000)]
weak: massage package docs a little bit

This is an attempt to clarify the "advice" section of the package docs a
little bit and encourage a specific style of use for weak structures.
It's not perfect, but it's something.

Change-Id: Id84b76d207619cc2e78439c5c903ec9575199734
Reviewed-on: https://go-review.googlesource.com/c/go/+/633675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

4 months agodoc/next: add release notes for runtime and sync
Michael Anthony Knyszek [Wed, 4 Dec 2024 19:22:51 +0000 (19:22 +0000)]
doc/next: add release notes for runtime and sync

Also, move the weak package heading to the end; it currently overlaps
with 1-osroot.md in the sort order.

For #68545.

Change-Id: Ia26ae511eaab7c8762e42d1593ac2197d25bbadb
Reviewed-on: https://go-review.googlesource.com/c/go/+/633599
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

4 months agomath/bits: update reference to debruijn paper
Sean Liao [Wed, 4 Dec 2024 21:50:30 +0000 (21:50 +0000)]
math/bits: update reference to debruijn paper

The old link no longer works.

Fixes #70684

Change-Id: I8711ef7d5721bf20ef83f5192dd0d1f73dda6ce1
Reviewed-on: https://go-review.googlesource.com/c/go/+/633775
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agocmd/go/internal/cache: always check error from stat in markUsed
Michael Matloob [Tue, 3 Dec 2024 20:09:41 +0000 (15:09 -0500)]
cmd/go/internal/cache: always check error from stat in markUsed

markUsed was not checking that the error from os.Stat was nil before
trying to access the FileInfo entry returned by it. Instead, always
check the error and return false if it's non-nil (usually because the
file does not exist). This can happen if an index entry exists in the
cache, but the output entry it points to does not. markUsed is called at
different points for the index entry and for the output entry, so it's
possible for the index entry to be marked used, and then for another go
process to trim the cache, deleting the output entry.  I'm not sure how
likely that is, or if this is what has been triggering the user observed
instances of #70600, but it's enough for a test case.

Fixes #70600

Change-Id: Ia6be14b4a56736d06488ccf93c3596fff8159f22
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/633037
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agobufio: document Reader must be created with New functions
Sean Liao [Tue, 3 Dec 2024 21:19:24 +0000 (21:19 +0000)]
bufio: document Reader must be created with New functions

Fixes #37347

Change-Id: Id642dbe7e52933f8d6cf7116c3c27ddb74efba9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/633315
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 months agosync/atomic: add missing leak tests for And & Or
Jorropo [Wed, 4 Dec 2024 03:50:29 +0000 (04:50 +0100)]
sync/atomic: add missing leak tests for And & Or

Theses tests were forgot because when CL 462298 was originally written
And & Or atomics were not available in go.
Git were smart enough to rebase over And's & Or's addition.
After most reviews and before merging it were pointed I should
make theses new intrinsics noescape.
When doing this last minute addition I forgot to add tests.

Change-Id: I457f98315c0aee91d5743058ab76f256856cb782
Reviewed-on: https://go-review.googlesource.com/c/go/+/633416
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agomath/rand/v2: replace <= 0 with == 0 for Uint function docs
Jorropo [Wed, 4 Dec 2024 12:07:08 +0000 (13:07 +0100)]
math/rand/v2: replace <= 0 with == 0 for Uint function docs

This harmonize the docs with (*Rand).Uint* functions.
And it make it clearer, I wasn't sure if it would try to interpret
the uint as a signed number somehow, it does not pull any surprises
make that clear.

Change-Id: I5a87a0a5563dbabfc31e536e40ee69b11f5cb6cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/633535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
4 months agoruntime: remove "hall of shame" comment from public documentation
Alexey Palazhchenko [Wed, 4 Dec 2024 03:19:08 +0000 (03:19 +0000)]
runtime: remove "hall of shame" comment from public documentation

See https://pkg.go.dev/runtime@go1.23.4#FuncForPC

The updated comment uses the same format as bytes.Repeat and math.Float32bits.

Change-Id: Idfbc38645e6b0f03fb07f294c4c79b997d9a01a1
GitHub-Last-Rev: 00fa155c75fb625be84edeadff49276e6cddc42c
GitHub-Pull-Request: golang/go#70671
Reviewed-on: https://go-review.googlesource.com/c/go/+/633475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>