]> Cypherpunks repositories - gostls13.git/log
gostls13.git
7 months agosyscall: use SYS_EXIT_GROUP in CLONE_PIDFD feature check child
Michael Pratt [Wed, 2 Oct 2024 21:20:12 +0000 (17:20 -0400)]
syscall: use SYS_EXIT_GROUP in CLONE_PIDFD feature check child

Inside Google we have seen issues with QEMU user mode failing to wake a
parent waitid when this child exits with SYS_EXIT. This bug appears to
not affect SYS_EXIT_GROUP.

It is currently unclear if this is a general QEMU or specific to
Google's configuration, but SYS_EXIT and SYS_EXIT_GROUP are semantically
equivalent here, so we can use the latter here in case this is a general
QEMU bug.

For #68976.

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

7 months agoruntime: clear isSending bit earlier
Ian Lance Taylor [Wed, 2 Oct 2024 20:38:25 +0000 (13:38 -0700)]
runtime: clear isSending bit earlier

I've done some more testing of the new isSending field.
I'm not able to get more than 2 bits set. That said,
with this change it's significantly less likely to have even
2 bits set. The idea here is to clear the bit before possibly
locking the channel we are sending the value on, thus avoiding
some delay and some serialization.

For #69312

Change-Id: I8b5f167f162bbcbcbf7ea47305967f349b62b0f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/617497
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@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>

7 months agogo/types, types: always record a type for inner composite literals
Robert Griesemer [Wed, 2 Oct 2024 00:04:51 +0000 (17:04 -0700)]
go/types, types: always record a type for inner composite literals

Ensure that inner composite literals get a (possibly invalid) type
if something goes wrong with the enclosing composite literal.

Fixes #69092.

Change-Id: Ib1d2d529c4683ea3ab1799a818b43538e152ae8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/616616
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
7 months agoruntime/pprof: make TestBlockMutexProfileInlineExpansion stricter
Nick Ripley [Tue, 1 Oct 2024 17:51:09 +0000 (13:51 -0400)]
runtime/pprof: make TestBlockMutexProfileInlineExpansion stricter

While working on CL 611241 and CL 616375, I introduced a bug that wasn't
caught by any test. CL 611241 added more inline expansion at sample time
for block/mutex profile stacks collected via frame pointer unwinding.
CL 616375 then changed how inline expansion for those stacks is done at
reporting time. So some frames passed through multiple rounds of inline
expansion, and this lead to duplicate stack frames in some cases. The
stacks from TestBlockMutexProfileInlineExpansion looked like

sync.(*Mutex).Unlock
runtime/pprof.inlineF
runtime/pprof.inlineE
runtime/pprof.inlineD
runtime/pprof.inlineD
runtime.goexit

after those two CLs, and in particular after CL 616375. Note the extra
inlineD frame. The test didn't catch that since it was only looking for
a few frames in the stacks rather than checking the entire stacks.

This CL makes that test stricter by checking the entire expected stacks
rather than just a portion of the stacks.

Change-Id: I0acc739d826586e9a63a081bb98ef512d72cdc9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/617235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
7 months agocmd/go/internal/security: add -ftls-model to valid compiler flags
Michael Matloob [Tue, 1 Oct 2024 19:29:36 +0000 (15:29 -0400)]
cmd/go/internal/security: add -ftls-model to valid compiler flags

Allow -ftls-model to be passed in to a system compiler. It does not
allow arbitrary code execution. See
https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-ftls-model
for documentation for the -ftls-model flag.

Fixes #69711

Change-Id: I842a96832e6858e62c171401d13baa3391d6d00a
Reviewed-on: https://go-review.googlesource.com/c/go/+/617136
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agoruntime: don't acquirem() in vgetrandom unless necessary
Jason A. Donenfeld [Tue, 1 Oct 2024 20:19:23 +0000 (22:19 +0200)]
runtime: don't acquirem() in vgetrandom unless necessary

I noticed in pprof that acquirem() was a bit of a hotspot. It turns out
that we can use the same trick that runtime.rand() does, and only
acquirem if we're doing something non-nosplit -- in this case, getting a
new state -- but otherwise just do getg().m, which is safe because we're
inside runtime and don't call split functions.

cpu: 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
                     │   sec/op    │   sec/op     vs base               │
ParallelGetRandom-16   2.651n ± 4%   2.416n ± 7%  -8.87% (p=0.001 n=10)
                     │     B/s      │     B/s       vs base               │
ParallelGetRandom-16   1.406Gi ± 4%   1.542Gi ± 6%  +9.72% (p=0.001 n=10)

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

7 months agocmd/compile/internal/ssa: intrinsify atomic.Xchg8 on amd64
Rhys Hiltner [Mon, 19 Aug 2024 20:58:42 +0000 (13:58 -0700)]
cmd/compile/internal/ssa: intrinsify atomic.Xchg8 on amd64

For #68578

Change-Id: Ia9580579bfc4709945bfcf6ec3803d5d11812187
Reviewed-on: https://go-review.googlesource.com/c/go/+/606901
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agointernal/runtime/atomic: add Xchg8 for amd64
Rhys Hiltner [Mon, 19 Aug 2024 20:51:59 +0000 (13:51 -0700)]
internal/runtime/atomic: add Xchg8 for amd64

For #68578

Change-Id: Idecfdbb793f46560dd69287af9170c07cf4ee973
Reviewed-on: https://go-review.googlesource.com/c/go/+/606900
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
7 months agohash/maphash: add WriteComparable and Comparable
qiulaidongfeng [Wed, 25 Sep 2024 10:32:49 +0000 (10:32 +0000)]
hash/maphash: add WriteComparable and Comparable

Default, use  hash function in the runtime package.
If the build tag is purego or raw memory cannot be hash directly,
use reflect get each field to hash separately.

Fixes #54670

Change-Id: Ic968864c9c3c51883967d4f6dc24432385c7dc79
GitHub-Last-Rev: 5ae8a28834c8b809a52c74617e2a8530acec8095
GitHub-Pull-Request: golang/go#69166
Reviewed-on: https://go-review.googlesource.com/c/go/+/609761
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
7 months agosrc/net/http: remove ServeMux.patterns
Jonathan Amsterdam [Fri, 27 Sep 2024 17:46:56 +0000 (13:46 -0400)]
src/net/http: remove ServeMux.patterns

Remove an unexported field from ServeMux that was there only to support
some Google-internal packages. It is no longer needed.

Change-Id: I6a4d542c6c016f5a9f3d24d0c73f6ddd44c9562e
Reviewed-on: https://go-review.googlesource.com/c/go/+/616355
Reviewed-by: Chressie Himpel <chressie@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
7 months agosyscall: gofmt after CL 592078
Tobias Klauser [Wed, 2 Oct 2024 10:34:45 +0000 (12:34 +0200)]
syscall: gofmt after CL 592078

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

7 months agoall: use slices.Sorted(maps.Keys(m))
Tobias Klauser [Wed, 2 Oct 2024 11:00:17 +0000 (13:00 +0200)]
all: use slices.Sorted(maps.Keys(m))

Use slices.Sorted(maps.Keys(m)) to get a sorted slices of the keys in
a map.

Do not change packages built during bootstrap, as the bootstrap compiler
(currently 1.22.6) does not have the required maps and slices functions.

Change-Id: Ie35565d241fa14aca56b730a69af010127b659ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/617356
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>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>

7 months agoencoding/json: add omitzero option
Jes Cok [Tue, 1 Oct 2024 03:15:08 +0000 (03:15 +0000)]
encoding/json: add omitzero option

Fixes #45669

Change-Id: Ic13523c0b3acdfc5b3e29a717bc62fde302ed8fd
GitHub-Last-Rev: 57030f26b0062fa8eda21b3a73b7665deab88c76
GitHub-Pull-Request: golang/go#69622
Reviewed-on: https://go-review.googlesource.com/c/go/+/615676
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: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
7 months agotext/template: use correct verbs for reflect.Value
Jes Cok [Mon, 30 Sep 2024 15:04:36 +0000 (15:04 +0000)]
text/template: use correct verbs for reflect.Value

Fixes #69708.

Change-Id: I7a0347aff75cc8dad3f6c36966b1d03822a78dc9
GitHub-Last-Rev: fcc15513e48ceae68b846e1dff69b459defb2614
GitHub-Pull-Request: golang/go#69713
Reviewed-on: https://go-review.googlesource.com/c/go/+/616695
Auto-Submit: 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>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agospec: document that alias declarations can have type parameters with 1.24
Robert Griesemer [Tue, 1 Oct 2024 22:03:25 +0000 (15:03 -0700)]
spec: document that alias declarations can have type parameters with 1.24

For #46477.

Change-Id: Id02d8f67fe82228bab3f26b1cb4ebd6ee67c4634
Reviewed-on: https://go-review.googlesource.com/c/go/+/616816
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>

7 months agospec: clarify that identical structs must have identical field embeddings
Robert Griesemer [Mon, 30 Sep 2024 22:55:14 +0000 (15:55 -0700)]
spec: clarify that identical structs must have identical field embeddings

The existing prose for struct identity did only require that two structs
"have the same sequence of fields, and if corresponding fields have the
same names, and identical types, and identical tags" for the structs to
be identical.

The implementation (forever) has also required that two corresponding
fields are either both embedded or not embedded. This is arguably part
of a struct's structure but is not explicitly specified.

This CL makes a minor change to the prose to address that.

Fixes #69472.

Change-Id: Ifa4ca69717986675642a09d03ce683ba8235efcb
Reviewed-on: https://go-review.googlesource.com/c/go/+/616697
Reviewed-by: Rob Pike <r@golang.org>
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>

7 months agocmd/internal/obj: make asmidx error less cryptic
Austin Clements [Fri, 6 Sep 2024 11:19:18 +0000 (07:19 -0400)]
cmd/internal/obj: make asmidx error less cryptic

It's still pretty cryptic, but at least now instead of printing

    asm: asmidx: bad address 0/2067/2068

it will print

    asm: asmidx: bad address 0/BX/SP

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

7 months agocmd/cgo: add srcdir & trimpath docs, sort options
Ian Lance Taylor [Tue, 1 Oct 2024 16:57:52 +0000 (09:57 -0700)]
cmd/cgo: add srcdir & trimpath docs, sort options

Update the package docs:
* The -srcdir docs were accidentally lost in CL 68590.
* The -trimpath option was added in CL 266358 but not documented.
* The options were not sorted correctly.

Fixes #69730

Change-Id: I97320e0f4fb6aa47cb03d451f028d3d9d9b560f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/616699
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>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
7 months agonet: document possible networks that can be passed to Control
favonia [Tue, 1 Oct 2024 10:49:19 +0000 (05:49 -0500)]
net: document possible networks that can be passed to Control

Before this patch, the documentation of Dialer.Control and
ListenConfig.Control did not specify what networks would be
passed to the Control function other than the "tcp" case.
It was thus challenging to use the Control function to filter
out certain networks. This patch documents all known networks.

Fixes #69693

Change-Id: I2ab10d68c4e4fac66d51d2cc232f02cf3b305e89
Reviewed-on: https://go-review.googlesource.com/c/go/+/617055
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>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
7 months agocmd/cgo: document errno value semantics
Brian Palmer [Fri, 27 Sep 2024 20:09:11 +0000 (14:09 -0600)]
cmd/cgo: document errno value semantics

Added a section about errno values vs normal go
error value semantics, and checking the return
value of C functions for error before looking at
errno.

Fixes #63485

Change-Id: Id0132a9f11e4127f4adc14e010b7e17f57a0f7d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/616264
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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agotest: fix test issue 69434 for riscv64
Cuong Manh Le [Tue, 1 Oct 2024 09:50:04 +0000 (16:50 +0700)]
test: fix test issue 69434 for riscv64

CL 615915 simplified test for issue 69434, using gcflags maymorestack to
force stack moving, making program failed with invalid stack pointer.

However, it seems that this maymorestack is broken on riscv64. At least
gotip-linux-riscv64 is currently broken.

This CL fixes this problem by using the initial approach, growing stack
size big enough to force stack moving.

Updates #69434
Fixes #69714

Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Change-Id: I95255fba884a200f75bcda34d58e9717e4a952ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/616698
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
7 months agoruntime/pprof: add context to short stack panic
Michael Pratt [Tue, 1 Oct 2024 17:12:39 +0000 (13:12 -0400)]
runtime/pprof: add context to short stack panic

Over the years we've had various bugs in pprof stack handling resulting
in appendLocsForStack crashing because stk is too short for a cached
location. i.e., the cached location claims several inlined frames. Those
should always appear together in stk. If some frames are missing from
stk, appendLocsForStack.

If we find this case, replace the slice out of bounds panic with an
explicit panic that contains more context.

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

7 months agocmd/go: add GOAUTH mechanism for HTTP authentication
Sam Thanawalla [Tue, 13 Aug 2024 16:48:11 +0000 (16:48 +0000)]
cmd/go: add GOAUTH mechanism for HTTP authentication

This change adds a new environment variable GOAUTH which takes a semicolon-separated list of commands to run for authentication during go-import resolution and HTTPS module mirror protocol interactions.
This CL only supports netrc and off. Future CLs to follow will extend support to git and a custom authenticator command.

For #26232

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I6cfa4c89fd27a7a4e7d25c8713d191dc82b7e28a
Reviewed-on: https://go-review.googlesource.com/c/go/+/605256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
7 months agoall: use slices.Delete
Tobias Klauser [Tue, 1 Oct 2024 09:33:50 +0000 (11:33 +0200)]
all: use slices.Delete

Change-Id: Ifb6aa07b32127907cdc2df44b2dbddd6296775c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/616737
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agogo/parser, syntax: better error message for parameter missing type
Robert Griesemer [Mon, 30 Sep 2024 21:10:40 +0000 (14:10 -0700)]
go/parser, syntax: better error message for parameter missing type

Fixes #69506.

Change-Id: I18215e11f214b12d5f65be1d1740181e427f8817
Reviewed-on: https://go-review.googlesource.com/c/go/+/617015
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agoREADME.vendor: add note about GOROOT, recommend fresh go
Davis Goodin [Mon, 30 Sep 2024 17:08:24 +0000 (10:08 -0700)]
README.vendor: add note about GOROOT, recommend fresh go

Using a different build of Go (specifically, a different GOROOT) to
maintain the vendor directory doesn't always reproduce the same results.
This can result in unknowingly creating a vendor directory that isn't
able to build Go.

Add a note to README.vendor to point this out. Specifically, mention
that a mismatched GOROOT is an issue, and recommend using a fresh build
of Go to maintain the vendor directory.

Updates #69235

Change-Id: Id80c7607bf28bd76e43e1fdc672811c50f2bffb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/616815
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 months agocontext: link to context and structs blog post
Matt T. Proud [Sun, 29 Sep 2024 05:23:33 +0000 (05:23 +0000)]
context: link to context and structs blog post

This commit amends the package documentation for the context package
and links the https://go.dev/blog/context-and-structs where the package
documentation dissuades one against embedding a context into a struct.
This is to help close the gap in understanding why this otherwise
cryptic piece of guidance is provided. The other referenced blog
article now points to go.dev instead of golang.org.

Change-Id: I0844a57bde1c03b6dddd1dd2dab2d20557d791fb
GitHub-Last-Rev: 4b039fba90f385a6ca8e44e8a34fbc339dbc21f0
GitHub-Pull-Request: golang/go#69696
Reviewed-on: https://go-review.googlesource.com/c/go/+/616515
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agonet: use correct address family when testing for MPTCP support
Ian Lance Taylor [Fri, 27 Sep 2024 17:17:48 +0000 (10:17 -0700)]
net: use correct address family when testing for MPTCP support

Before this patch, on a system that only supports IPv6, we would
get EAFNOSUPPORT and decide that MPTCP might be available later.
The effect is that every socket tries to get MPTCP. If the system
does not support MPTCP, every socket call turns into two system calls.

Also avoid the uname if MPTCP is not supported.

For #56539

Change-Id: I628b44eda83b455f5493a9dd59076f1acea2f65b
Reviewed-on: https://go-review.googlesource.com/c/go/+/616335
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Matthieu Baerts <matttbe@kernel.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

7 months agoruntime, internal/syscall/unix: mark getrandom vDSO as non-escaping
Mateusz Poliwczak [Mon, 30 Sep 2024 18:01:10 +0000 (18:01 +0000)]
runtime, internal/syscall/unix: mark getrandom vDSO as non-escaping

Updates #66779
Updates #69577

Change-Id: I0dea5a30aab87aaa443e7e6646c1d07aa865ac1c
GitHub-Last-Rev: 1cea46deb345369346efb2cb320fae1644466322
GitHub-Pull-Request: golang/go#69719
Reviewed-on: https://go-review.googlesource.com/c/go/+/616696
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

7 months agoerrors: reference Go 1.13 article about errors
Matt T. Proud [Sat, 28 Sep 2024 14:25:38 +0000 (14:25 +0000)]
errors: reference Go 1.13 article about errors

This commit amends package errors' documentation to include a reference
to the https://go.dev/blog/go1.13-errors blog article. The motivation
is multi-fold, but chiefly the article includes good information about
error philosophy (e.g., when to wrap), and developers who have come to
Go in the intervening five years are likely not have seen this article
at all given the nature of blog publishing and post fanfare. The
material deserves a promotion in visibility.

Change-Id: Ia6f8307784521dd59de3a3d638dbc0a7fcd445e6
GitHub-Last-Rev: 20980dd5070cde495ebb08386ae7b4cd78ccc612
GitHub-Pull-Request: golang/go#69698
Reviewed-on: https://go-review.googlesource.com/c/go/+/616341
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
7 months agoruntime: use canonical wireguard-go repo for procyield() linkname usage
Jason A. Donenfeld [Mon, 30 Sep 2024 16:47:34 +0000 (18:47 +0200)]
runtime: use canonical wireguard-go repo for procyield() linkname usage

The source code quoted tailscale's development fork, which is only a
development fork. The canonical github url is actually
github.com/wireguard/wireguard-go, but that's really just a mirror of
git.zx2c4.com/wireguard-go, and in any case, the proper go package name
is golang.zx2c4.com/wireguard, so just use that.

Change-Id: Ifa63c1c538989b3fcebcf06d1c238469bc73724d
Reviewed-on: https://go-review.googlesource.com/c/go/+/616736
Auto-Submit: Jason Donenfeld <Jason@zx2c4.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agogo/ast: update (*File).Imports field in SortImports
Mateusz Poliwczak [Mon, 30 Sep 2024 16:29:40 +0000 (16:29 +0000)]
go/ast: update (*File).Imports field in SortImports

Fixes #69694

Change-Id: I7884d42482f4f9d17e7d050d7c7730f20948169d
GitHub-Last-Rev: ecd6efabaa43cc87e31e94002febc9ed4273125a
GitHub-Pull-Request: golang/go#69695
Reviewed-on: https://go-review.googlesource.com/c/go/+/616340
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
7 months agocrypto/internal/randutil: use math/rand/v2
Damien Neil [Fri, 27 Sep 2024 21:19:30 +0000 (14:19 -0700)]
crypto/internal/randutil: use math/rand/v2

Instead of using a select on a closed channel to generate one bit
of randomness, use math/rand/v2.

Change-Id: I36d294f17b9f5b437ca50e1c95da97bbe632c0a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/616475
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
7 months agocrypto/internal/cryptotest: fix typos in AEAD test comments
Davis Goodin [Fri, 27 Sep 2024 18:04:33 +0000 (11:04 -0700)]
crypto/internal/cryptotest: fix typos in AEAD test comments

Some comments that describe the behavior being tested don't match the
test logic.

Fix the comments to match test logic and documented behavior.

Change-Id: I065d9d9069fa00bb865209f48e112456384c2b9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/616338
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: 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: Michael Knyszek <mknyszek@google.com>
7 months agoruntime: align vgetrandom states to cache line
Jason A. Donenfeld [Sun, 29 Sep 2024 02:24:00 +0000 (04:24 +0200)]
runtime: align vgetrandom states to cache line

This prevents false sharing, which makes a large difference on machines
with several NUMA nodes, such as this dual socket server:

cpu: Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz
                      │    sec/op    │    sec/op     vs base                │
ParallelGetRandom-128   0.7944n ± 5%   0.4503n ± 0%  -43.31% (p=0.000 n=10)

                      │     B/s      │     B/s       vs base                │
ParallelGetRandom-128   4.690Gi ± 5%   8.272Gi ± 0%  +76.38% (p=0.000 n=10)

Change-Id: Id4421e9a4c190b38aff0be4c59e9067b0a38ccd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/616535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jason Donenfeld <Jason@zx2c4.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
7 months agocmd/go: exit non-zero if version -m is used with a non-Go file
qiulaidongfeng [Mon, 15 Apr 2024 13:19:48 +0000 (13:19 +0000)]
cmd/go: exit non-zero if version -m is used with a non-Go file

Fixes #66426

Change-Id: I5c65d5ae7863f90d654063d6385ffb6ec1308d7c
GitHub-Last-Rev: 114b30eb5531b924befb12fbda28cea4663d3608
GitHub-Pull-Request: golang/go#66443
Reviewed-on: https://go-review.googlesource.com/c/go/+/573295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
7 months agocmd/go: add Mercurial based version stamping for binaries
Sam Thanawalla [Wed, 28 Aug 2024 16:26:30 +0000 (16:26 +0000)]
cmd/go: add Mercurial based version stamping for binaries

This CL adds a local only VCS lookup for Mercurial.
It fixes a bug in pkg.go by passing in the repo directory to
the LookupLocal function instead of the module directory. It could be
the case that a binary is built in a subdirectory of the repo.

For: #50603
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: Ic36b5a361a8ba3b0ba1a6968cde5f5263c9c8dd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/609155
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
7 months agointernal/testlog: use atomic.Pointer instead of atomic.Value
Mateusz Poliwczak [Sat, 28 Sep 2024 16:50:03 +0000 (16:50 +0000)]
internal/testlog: use atomic.Pointer instead of atomic.Value

We know the type (*Interface), so we can use the generic atomic.Pointer.
This change also makes sure that concurrent use of SetLogger also
causes a panic, currently it races (Load, then Store).

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

7 months agonet: improve GODEBUG=netdns=1 debug messages
Mateusz Poliwczak [Fri, 27 Sep 2024 19:57:12 +0000 (19:57 +0000)]
net: improve GODEBUG=netdns=1 debug messages

Fixes #69680

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

7 months agonet,os: use os.LookupEnv instead of syscall.Getenv
Mateusz Poliwczak [Sat, 28 Sep 2024 16:20:58 +0000 (16:20 +0000)]
net,os: use os.LookupEnv instead of syscall.Getenv

The os package already has a function for retrieving an environment
variable with a ok boolean, we don't need to use syscall directly.

Change-Id: Ife873e7245261ec765b628e31a0e7a7bc4dff934
GitHub-Last-Rev: bc5f30bf56c87a94e0f17dd67a15aa4b2d7e3fd4
GitHub-Pull-Request: golang/go#69700
Reviewed-on: https://go-review.googlesource.com/c/go/+/616342
Reviewed-by: Michael Knyszek <mknyszek@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>
7 months agonet: improve documentation of netgo/netcgo build tags
Mateusz Poliwczak [Fri, 27 Sep 2024 19:20:58 +0000 (19:20 +0000)]
net: improve documentation of netgo/netcgo build tags

Updates #69680

Change-Id: If80d43da493cb035164ede4a2cadcbec5831feaf
GitHub-Last-Rev: b3853e9487da1006ecece9dd378e3de299d0b1da
GitHub-Pull-Request: golang/go#69682
Reviewed-on: https://go-review.googlesource.com/c/go/+/616262
Auto-Submit: 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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agoslices: prevent Clone keeping alive the array when cloning empty slices
Jorropo [Wed, 17 Jul 2024 12:15:32 +0000 (14:15 +0200)]
slices: prevent Clone keeping alive the array when cloning empty slices

Fixes #68488

Change-Id: I39aba22cdfe8ca0bbe69db7c64f1bca75fa067fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/598875
Reviewed-by: Keith Randall <khr@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@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: Ian Lance Taylor <iant@google.com>
7 months agoruntime: use vDSO for getrandom() on linux
Jason A. Donenfeld [Sun, 22 Sep 2024 01:45:29 +0000 (03:45 +0200)]
runtime: use vDSO for getrandom() on linux

Linux 6.11 supports calling getrandom() from the vDSO. It operates on a
thread-local opaque state allocated with mmap using flags specified by
the vDSO.

Opaque states are allocated in chunks, ideally ncpu at a time as a hint,
rounding up to as many fit in a complete page. On first use, a state is
assigned to an m, which owns that state, until the m exits, at which
point it is given back to the pool.

Performance appears to be quite good:

           │    sec/op    │   sec/op       vs base                 │
Read/4-16    222.45n ± 3%   27.13n   ± 6%  -87.80% (p=0.000 n=10)
           │     B/s      │      B/s       vs base                 │
Read/4-16    17.15Mi ± 3%   140.61Mi ± 6%  +719.82% (p=0.000 n=10)

Fixes #69577.

Change-Id: Ib6f44e8f2f3940c94d970eaada0eb566ec297dc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/614835
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Jason Donenfeld <Jason@zx2c4.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
7 months agotest: simplify issue 69434 test
Cuong Manh Le [Wed, 25 Sep 2024 18:37:07 +0000 (01:37 +0700)]
test: simplify issue 69434 test

Updates #69434

Change-Id: I780c5ed63561eb8fa998bb0e6cdc77a904ff29c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/615915
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agogo/types, types2: remove Checker.pos from types2 code - not needed anymore
Robert Griesemer [Fri, 27 Sep 2024 18:03:58 +0000 (11:03 -0700)]
go/types, types2: remove Checker.pos from types2 code - not needed anymore

In go/types, move field down in environment struct, rename it to
exprPos, and document use.

Updates #69673.

Change-Id: I355af1237f8cd731ad9706e6a5fce34b314978cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/616316
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
7 months agogo/types, types2: move go/types-only Scope methods into scopes2.go
Robert Griesemer [Fri, 27 Sep 2024 17:54:26 +0000 (10:54 -0700)]
go/types, types2: move go/types-only Scope methods into scopes2.go

Remove them them from types2.

Updates #69673.

Change-Id: I7843f6da1edf3a19f85c61706104d173e04088d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/616261
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
7 months agocmd/go: fix the accuracy of Mercurial vcs.* stamped data
Matt Harbison [Sat, 3 Aug 2024 00:06:30 +0000 (00:06 +0000)]
cmd/go: fix the accuracy of Mercurial vcs.* stamped data

There were a few Mercurial command line uses that could cause the wrong
data to be used:

* The log command needs '-r.' to specify the currently checked out commit
* HGPLAIN is needed to disable optional output on commands
* '-S' is needed to for the 'status' command to recurse into any subrepos

The most likely issue to be seen here was the use of '-l1' instead of
'-r.', which prints the most recent commit instead of the current checkout.
Since tagging in Mercurial creates a new commit, this basically means the
data was wrong for every tagged build.

This also adds an hgrc config file to the test, with config options to
keep the time and author values fixed.  It's what's used in the Mercurial
test harness to keep the commit hashes stable, and allows the tests here to
also match the time and the revision ID, to prevent regressing.

Fixes #63532

Change-Id: I5b9971ce87c83431ec77e4a002bdc33fcf393856
GitHub-Last-Rev: 62c9db0a28fee5881d0fe49f7bbb6e1653c7ff60
GitHub-Pull-Request: golang/go#63557
Reviewed-on: https://go-review.googlesource.com/c/go/+/535377
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
7 months agogo/types, types2: remove need for Scope.LookupParent from TestObjectString
Robert Griesemer [Fri, 27 Sep 2024 17:41:55 +0000 (10:41 -0700)]
go/types, types2: remove need for Scope.LookupParent from TestObjectString

Updates #69673.

Change-Id: I0ce5f009c1e95a2722a50d79a74fef83d2547b47
Reviewed-on: https://go-review.googlesource.com/c/go/+/616260
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agogo/types, types2: remove non-test uses of Scope.LookupParent
Robert Griesemer [Fri, 27 Sep 2024 17:24:16 +0000 (10:24 -0700)]
go/types, types2: remove non-test uses of Scope.LookupParent

This moves the implementation of Scope.LookupParent into
environment.lookupScope where it encapsulates the use of
the current environment's position. At least in types2,
that position can be removed, because it is never set.

With this, the type checker doesn't rely on position
information anymore for looking up objects during type
checking.

LookupParent is still called from tests and some go/types
code.

Updates #69673.

Change-Id: I7159ba95b71cf33cc3b16058aa19327e166224b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/616337
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

7 months agoRevert "cmd/go: relax the regular expression of TestScript/list_pkgconfig_error"
qiu laidongfeng2 [Fri, 27 Sep 2024 17:24:38 +0000 (17:24 +0000)]
Revert "cmd/go: relax the regular expression of TestScript/list_pkgconfig_error"

This reverts commit 906338f82fc6641e834964def3199ac25df93e94.

Reason for revert: break gotip-linux-loong64 builder.

Fixes #69651
Updates #68283

Change-Id: I909b52ed0fd999e21c00c1d9d80d7fe2fd4898a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/616336
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
7 months agogo/types, types2: replace 2 uses of Scope.LookupParent with Checker.lookup
Robert Griesemer [Fri, 27 Sep 2024 16:42:41 +0000 (09:42 -0700)]
go/types, types2: replace 2 uses of Scope.LookupParent with Checker.lookup

A step towards removing reliance on Scope.LookupParent.

Updates #69673.

Change-Id: I9fdd4b08ea600b531b90895ac779fdc580ff00e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/616259
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Commit-Queue: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
7 months agogo/types, types2: remove dependency on Scope.Contains in resolver
Robert Griesemer [Thu, 26 Sep 2024 23:56:45 +0000 (16:56 -0700)]
go/types, types2: remove dependency on Scope.Contains in resolver

In extremely rare cases of receiver base types of the form
C.foo where C refers to an `import "C"`, we needed Scope.Contains
to lookup the file scope containing the "C" import.
Replace the position-dependent Scope.Contains with an explicit
scope search that doesn't require a position.

Also, make the surrounding code match more closely between
go/types and types2.

Change-Id: Ic007108928dd8b382a06e2bbf09ef8bd6bd0ff36
Reviewed-on: https://go-review.googlesource.com/c/go/+/616256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
7 months agocmd/internal/obj/loong64: mark functions with small stacks NOSPLIT
Xiaolin Zhao [Wed, 25 Sep 2024 09:27:24 +0000 (17:27 +0800)]
cmd/internal/obj/loong64: mark functions with small stacks NOSPLIT

goos: linux
goarch: loong64
pkg: test/bench/go1
cpu: Loongson-3A6000 @ 2500.00MHz
                      │  bench.old  │             bench.new              │
                      │   sec/op    │   sec/op     vs base               │
BinaryTree17             7.728 ± 1%    7.703 ± 1%       ~ (p=0.345 n=15)
Fannkuch11               2.645 ± 0%    2.429 ± 0%  -8.17% (p=0.000 n=15)
FmtFprintfEmpty         35.89n ± 0%   35.83n ± 0%  -0.17% (p=0.000 n=15)
FmtFprintfString        59.48n ± 0%   59.45n ± 0%       ~ (p=0.280 n=15)
FmtFprintfInt           62.04n ± 0%   61.11n ± 0%  -1.50% (p=0.000 n=15)
FmtFprintfIntInt        97.74n ± 0%   96.56n ± 0%  -1.21% (p=0.000 n=15)
FmtFprintfPrefixedInt   116.7n ± 0%   116.6n ± 0%       ~ (p=0.975 n=15)
FmtFprintfFloat         204.5n ± 0%   203.2n ± 0%  -0.64% (p=0.000 n=15)
FmtManyArgs             456.2n ± 0%   454.6n ± 0%  -0.35% (p=0.000 n=15)
GobDecode               7.142m ± 1%   6.960m ± 1%  -2.55% (p=0.000 n=15)
GobEncode               8.172m ± 1%   8.081m ± 0%  -1.11% (p=0.001 n=15)
Gzip                    279.9m ± 0%   280.1m ± 0%  +0.05% (p=0.011 n=15)
Gunzip                  32.69m ± 0%   32.44m ± 0%  -0.79% (p=0.000 n=15)
HTTPClientServer        53.94µ ± 0%   53.68µ ± 0%  -0.48% (p=0.000 n=15)
JSONEncode              9.297m ± 0%   9.110m ± 0%  -2.01% (p=0.000 n=15)
JSONDecode              47.21m ± 0%   47.99m ± 2%  +1.66% (p=0.000 n=15)
Mandelbrot200           4.601m ± 0%   4.606m ± 0%  +0.11% (p=0.000 n=15)
GoParse                 4.666m ± 0%   4.664m ± 0%       ~ (p=0.512 n=15)
RegexpMatchEasy0_32     59.76n ± 0%   58.92n ± 0%  -1.41% (p=0.000 n=15)
RegexpMatchEasy0_1K     458.1n ± 0%   455.3n ± 0%  -0.61% (p=0.000 n=15)
RegexpMatchEasy1_32     59.36n ± 0%   60.25n ± 0%  +1.50% (p=0.000 n=15)
RegexpMatchEasy1_1K     557.7n ± 0%   566.0n ± 0%  +1.49% (p=0.000 n=15)
RegexpMatchMedium_32    803.0n ± 0%   783.7n ± 0%  -2.40% (p=0.000 n=15)
RegexpMatchMedium_1K    27.29µ ± 0%   26.54µ ± 0%  -2.76% (p=0.000 n=15)
RegexpMatchHard_32      1.388µ ± 2%   1.333µ ± 0%  -3.96% (p=0.000 n=15)
RegexpMatchHard_1K      40.91µ ± 0%   40.96µ ± 0%  +0.12% (p=0.001 n=15)
Revcomp                 474.7m ± 0%   474.2m ± 0%       ~ (p=0.325 n=15)
Template                77.13m ± 1%   75.70m ± 1%  -1.86% (p=0.000 n=15)
TimeParse               271.3n ± 0%   271.7n ± 0%  +0.15% (p=0.000 n=15)
TimeFormat              289.4n ± 0%   290.8n ± 0%  +0.48% (p=0.000 n=15)
geomean                 51.70µ        51.22µ       -0.92%

Change-Id: Ib71b60226251722ae828edb1d7d8b5a27f383570
Reviewed-on: https://go-review.googlesource.com/c/go/+/616098
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agocmd/internal/obj/riscv: rename the iIEncoding
Mark Ryan [Fri, 13 Sep 2024 07:33:03 +0000 (09:33 +0200)]
cmd/internal/obj/riscv: rename the iIEncoding

We rename it to iIIEncoding to reflect the fact that instructions
that use this encoding take two integer registers.  This change
will allow us to add a new encoding for I-type instructions that
take a single integer register.  This new encoding will be used for
instructions that modify CSRs.

Change-Id: Ic507d0020e18f6aa72353f4d3ffcd0e868261e7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/614355
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
7 months agoruntime: fix TestGdbAutotmpTypes on gdb version 15
Shulhan [Sat, 13 Jul 2024 05:18:04 +0000 (12:18 +0700)]
runtime: fix TestGdbAutotmpTypes on gdb version 15

On Arch Linux with gdb version 15.1, the test for TestGdbAutotmpTypes print
the following output,

----
~/src/go/src/runtime
$ go test -run=TestGdbAutotmpTypes -v
=== RUN   TestGdbAutotmpTypes
=== PAUSE TestGdbAutotmpTypes
=== CONT  TestGdbAutotmpTypes
    runtime-gdb_test.go:78: gdb version 15.1
    runtime-gdb_test.go:570: gdb output:
        Loading Go Runtime support.
        Target 'exec' cannot support this command.
        Breakpoint 1 at 0x46e416: file /tmp/TestGdbAutotmpTypes750485513/001/main.go, line 8.

        This GDB supports auto-downloading debuginfo from the following URLs:
          <https://debuginfod.archlinux.org>
        Enable debuginfod for this session? (y or [n]) [answered N; input not from terminal]
        Debuginfod has been disabled.
        To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
        [New LWP 355373]
        [New LWP 355374]
        [New LWP 355375]
        [New LWP 355376]

        Thread 1 "a.exe" hit Breakpoint 1, main.main () at /tmp/TestGdbAutotmpTypes750485513/001/main.go:8
        8       func main() {
        9               var iface interface{} = map[string]astruct{}
        All types matching regular expression "astruct":

        File runtime:
                []main.astruct
                bucket<string,main.astruct>
                hash<string,main.astruct>
                main.astruct
                typedef hash<string,main.astruct> * map[string]main.astruct;
                typedef noalg.[8]main.astruct noalg.[8]main.astruct;
                noalg.map.bucket[string]main.astruct
    runtime-gdb_test.go:587: could not find []main.astruct; in 'info typrs astruct' output
!!! FAIL
exit status 1
FAIL    runtime 0.273s
$
----

In the back trace for "File runtime", each output lines does not end with
";" anymore, while in test we check the string with it.

While at it, print the expected string with "%q" instead of "%s" for
better error message.

Fixes #67089

Change-Id: If6019ee68c0d8e495c920f98568741462c7d0fd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/598135
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
7 months agoruntime: if stop/reset races with running timer, return correct result
Ian Lance Taylor [Sat, 7 Sep 2024 00:19:34 +0000 (17:19 -0700)]
runtime: if stop/reset races with running timer, return correct result

The timer code is careful to ensure that if stop/reset is called
while a timer is being run, we cancel the run. However, the code
failed to ensure that in that case stop/reset returned true,
meaning that the timer had been stopped. In the racing case
stop/reset could see that t.when had been set to zero,
and return false, even though the timer had not and never would fire.

Fix this by tracking whether a timer run is in progress,
and using that to reliably detect that the run was cancelled,
meaning that stop/reset should return true.

Fixes #69312

Change-Id: I78e870063eb96650638f12c056e32c931417c84a
Reviewed-on: https://go-review.googlesource.com/c/go/+/611496
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.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@golang.org>

7 months agocmd/go: don't print dynimport link error messages
Ian Lance Taylor [Thu, 26 Sep 2024 04:03:54 +0000 (21:03 -0700)]
cmd/go: don't print dynimport link error messages

When using the -x or -n option, we were printing the external
linker error messages from producing the dynimport file.
This was confusing because those linker errors are unimportant and
ignored; only the linker exit status matters, and failure doesn't
drop the build.

Change cmd/go -x to not print the error messages, and to instead
print the linker command line with a notation of whether the
link succeeded or failed.

Fixes #68743

Change-Id: Ie3cc58d2d6a7d33d7baa6f1273b4fb5a7deee7e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/615916
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>

7 months agotext/template: support range-over-int
qiulaidongfeng [Wed, 25 Sep 2024 12:20:06 +0000 (20:20 +0800)]
text/template: support range-over-int

Fixes #66107

Change-Id: I19b466e3fb17557cf4f198b7fd8c13e774d854b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/615095
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agounique: clarify concurrent use of Make and Handle.Value
Michael Anthony Knyszek [Thu, 26 Sep 2024 19:44:00 +0000 (19:44 +0000)]
unique: clarify concurrent use of Make and Handle.Value

Fixes #69637.

Change-Id: Ie612b4df50f42f2786b22fb7a756949530f9178e
Reviewed-on: https://go-review.googlesource.com/c/go/+/616235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agounique,internal/concurrent: add some more tests
Michael Anthony Knyszek [Thu, 19 Sep 2024 15:43:14 +0000 (15:43 +0000)]
unique,internal/concurrent: add some more tests

One is a test of unsafe.String usage, which was broken before CL 610738
was merged.

The other is trying to improve coverage of "near collision" scenarios in
the HashTrieMap where only the last few bits differ. This is intended to
catch off-by-one errors in iterating down the tree.

For #69534.

Change-Id: I3f302e148e81269a50e93b5edf83cafc2d291098
Reviewed-on: https://go-review.googlesource.com/c/go/+/614475
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
7 months agonet/http: use sync.OnceFunc, sync.OnceValue
apocelipes [Thu, 26 Sep 2024 08:23:13 +0000 (08:23 +0000)]
net/http: use sync.OnceFunc, sync.OnceValue

Use sync.OnceFunc and sync.OnceValue to simplify the code.

Change-Id: Ie47e0444c2b9d3260f6ef94cdc6ee8ee5bcf9f71
GitHub-Last-Rev: 520afbec2a392d73dfd9697035804be7c7cc8b77
GitHub-Pull-Request: golang/go#69634
Reviewed-on: https://go-review.googlesource.com/c/go/+/616037
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>
Reviewed-by: David Chase <drchase@google.com>
7 months agohash/crc32,hash/crc64: use sync.OnceFunc
apocelipes [Thu, 26 Sep 2024 08:08:07 +0000 (08:08 +0000)]
hash/crc32,hash/crc64: use sync.OnceFunc

Use sync.OnceFunc to simplify the code and to reduce global variables.

Change-Id: I7676339177e082c5be93dcf8121e379a6a7de912
GitHub-Last-Rev: f796c49260ad19c33b616c9543b99f7f425dc2fe
GitHub-Pull-Request: golang/go#69633
Reviewed-on: https://go-review.googlesource.com/c/go/+/615920
Reviewed-by: David Chase <drchase@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: Ian Lance Taylor <iant@google.com>
7 months agocmd/cgo: add missing args for fatalf
Jes Cok [Sun, 22 Sep 2024 03:41:38 +0000 (03:41 +0000)]
cmd/cgo: add missing args for fatalf

Change-Id: I56b40a9d2ff85fdbc0d170aec686f1868176e068
GitHub-Last-Rev: 9424faf0f8e1fa7c63ae3195f255e7f112444871
GitHub-Pull-Request: golang/go#69578
Reviewed-on: https://go-review.googlesource.com/c/go/+/614556
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Zxilly Chou <zxilly@outlook.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
7 months agointernal/zstd: optimize skipFrame by using io.CopyN
aimuz [Wed, 25 Sep 2024 14:25:58 +0000 (14:25 +0000)]
internal/zstd: optimize skipFrame by using io.CopyN

Replaced the manual byte skipping logic with io.CopyN
to improve performance and reduce memory allocation.
This change simplifies the code by directly discarding
the bytes read, enhancing readability and efficiency.

Change-Id: Id11496d072fb554c394947d08e63616ca48ecab4
GitHub-Last-Rev: dc5f836cc76ea1355effa49a665b9091a888541b
GitHub-Pull-Request: golang/go#69619
Reviewed-on: https://go-review.googlesource.com/c/go/+/615716
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>
Reviewed-by: Carlos Amedee <carlos@golang.org>
7 months agoruntime: properly compute whether PC is inside vDSO pages
Jason A. Donenfeld [Wed, 25 Sep 2024 23:14:18 +0000 (01:14 +0200)]
runtime: properly compute whether PC is inside vDSO pages

The old calculation just looked whether PC was within a page of a vDSO
symbol. This doesn't work because the vDSO .text might span two whole
pages, with trampolines and such redirecting PC around between them.

This manifests itself with the new vDSO getrandom() function, where on
PowerPC, the trampoline is quite far away from the actual C function it
jumps into. The effect is that the signal handler doesn't know it's
interrupting a vDSO call and forgets to restore g to R30, resulting in a
crash.

Fix this by storing the start and end of the LOAD section from the
program headers. We could be more specific and parse out the .text
section, but PT_LOAD is good enough and appears to work well.

Change-Id: I3cf16955177eedb51e28b3b1a0191b32c3327a42
Reviewed-on: https://go-review.googlesource.com/c/go/+/616015
Auto-Submit: Jason Donenfeld <Jason@zx2c4.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agocmd/link/internal/ld: fix error print in decodetypeGcprog
zhangjian [Sat, 7 Sep 2024 14:04:00 +0000 (14:04 +0000)]
cmd/link/internal/ld: fix error print in decodetypeGcprog

Change-Id: Ifbd33881280d88c00df9b2c4e20f0127aca55799
GitHub-Last-Rev: 5b42bc612c82344f386b7f77043655cbe09eba77
GitHub-Pull-Request: golang/go#69336
Reviewed-on: https://go-review.googlesource.com/c/go/+/610563
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agogo/types: compute effective Go version independent of token.Pos
Alan Donovan [Mon, 16 Sep 2024 22:50:52 +0000 (18:50 -0400)]
go/types: compute effective Go version independent of token.Pos

Previously, the Checker.allowVersion method would use a token.Pos
to try to infer which file of the current package the checker
was "in". This proved fragile when type-checking syntax that
had been modified or synthesized and whose positions were invalid.

This change records the effective version in the checker state
(checker.environment.version). Just like other aspects of the
environment, the version changes from one file to the next
and must be saved and restored with each check.later closure.

Similarly, declInfo captures and temporarily reinstates
the effective version when checking each object.

+ Test of position independence in go/types and types2
+ Test of panic avoidance in go/types

Fixes golang/go#69477
Fixes golang/go#69338

Change-Id: Ic06f9d88151c64a4f7848f8942d08e3c312cdd6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/613735
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agocmd/go: relax the regular expression of TestScript/list_pkgconfig_error
qiulaidongfeng [Wed, 18 Sep 2024 13:42:40 +0000 (13:42 +0000)]
cmd/go: relax the regular expression of TestScript/list_pkgconfig_error

Fixes #68283

Change-Id: Ia6af550f0fc232e4ae6f7ea96370138e958aaca2
GitHub-Last-Rev: 206ce8b0d9309e09c7b482d3e0f42a8f47474936
GitHub-Pull-Request: golang/go#68324
Reviewed-on: https://go-review.googlesource.com/c/go/+/596935
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
7 months agocmd/compile: generalize struct load/store
Cuong Manh Le [Thu, 5 Sep 2024 07:56:43 +0000 (14:56 +0700)]
cmd/compile: generalize struct load/store

The SSA backend currently only handle struct with up to 4 fields. Thus,
there are different operations corresponding to number fields of the
struct.

This CL generalizes these with just one OpStructMake, allow struct types
with arbitrary number of fields.

However, the ssa.MaxStruct is still kept as-is, and future CL will
increase this value to optimize large structs.

Updates #24416

Change-Id: I192ffbea881186693584476b5639394e79be45c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/611075
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: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
7 months agoos: ignore SIGSYS in checkPidfd
cions [Tue, 24 Sep 2024 01:27:40 +0000 (01:27 +0000)]
os: ignore SIGSYS in checkPidfd

In Android version 11 and earlier, pidfd-related system calls
are not allowed by the seccomp policy, which causes crashes due
to SIGSYS signals.

Fixes #69065

Change-Id: Ib29631639a5cf221ac11b4d82390cb79436b8657
GitHub-Last-Rev: aad6b3b32c81795f86bc4a9e81aad94899daf520
GitHub-Pull-Request: golang/go#69543
Reviewed-on: https://go-review.googlesource.com/c/go/+/614277
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agocmd/dist: enforce the lowest bootstrap version
qiulaidongfeng [Tue, 24 Sep 2024 12:53:21 +0000 (12:53 +0000)]
cmd/dist: enforce the lowest bootstrap version

The go1.24 release notes say that go1.22.6 is the
minimum bootstraps required,
the go team also use go1.22.6 bootstraps in testing,
so if there's a problem with using an older version,
automated testing won't uncover it.

Now enforce this in dist to avoid
release notes that do not match reality, which can be confusing.

For #64751

Change-Id: Icd2f8a47b2bbb2d7c3dab9be9a228f43b9630063
GitHub-Last-Rev: 425cd7f03c09ca5e4017d5a70a71fe8cf56d63e5
GitHub-Pull-Request: golang/go#69168
Reviewed-on: https://go-review.googlesource.com/c/go/+/609762
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: 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>
7 months agointernal/syscall/unix: allow calling getrandom(..., 0, ...)
Jason A. Donenfeld [Tue, 24 Sep 2024 01:06:38 +0000 (03:06 +0200)]
internal/syscall/unix: allow calling getrandom(..., 0, ...)

Calling getrandom() with a zero length is actually valid and useful:

- Calling getrandom(..., 0, 0) will block until the RNG is initialized.
- Calling getrandom(..., 0, GRND_NONBLOCK) will query whether the RNG
  is initialized.

So instead of short circuiting execution for these circumstances, pass
this through to the syscall.

Change-Id: I15178f087908a2d8be6c020a1ef800cc0a074742
Reviewed-on: https://go-review.googlesource.com/c/go/+/615315
Run-TryBot: Jason Donenfeld <Jason@zx2c4.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Jason Donenfeld <Jason@zx2c4.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agoall: fix typos of possessive its
Brad Fitzpatrick [Wed, 25 Sep 2024 03:41:28 +0000 (20:41 -0700)]
all: fix typos of possessive its

(I noticed the one mistake in hashtriemap.go and figured I'd clean up
others.)

Change-Id: I4ade424b400056f161bc6c9c2838ba1f96b1f6bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/615675
Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 months agocmd/go: support both .netrc and _netrc in windows
Sam Thanawalla [Tue, 20 Aug 2024 20:14:59 +0000 (20:14 +0000)]
cmd/go: support both .netrc and _netrc in windows

For #66832

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I58e20fe0b8e38dd9383d1df334acaa3a2abad756
Reviewed-on: https://go-review.googlesource.com/c/go/+/607237
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>

7 months agocrypto/rsa: move PSS hash override above boring block
Roland Shoemaker [Thu, 19 Sep 2024 16:20:56 +0000 (09:20 -0700)]
crypto/rsa: move PSS hash override above boring block

The SignPSS hash override happened after the boringcrypto block, meaning
if a boringcrypto user passed a hash in the PSSOptions which did not
match the hash argument, it wouldn't be overriden. This change moves the
check above the boring block to make sure the override is honored.

Thanks to Quim Muntal of Microsoft for spotting this issue.

Change-Id: I05082a84ccb1863798ac6eae7a15cf4d1e59f12d
Reviewed-on: https://go-review.googlesource.com/c/go/+/614276
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: David Chase <drchase@google.com>
7 months agoruntime: fix GoroutineProfile stacks not getting null terminated
Felix Geisendörfer [Fri, 30 Aug 2024 06:17:19 +0000 (08:17 +0200)]
runtime: fix GoroutineProfile stacks not getting null terminated

Fix a regression introduced in CL 572396 causing goroutine stacks not
getting null terminated.

This bug impacts callers that reuse the []StackRecord slice for multiple
calls to GoroutineProfile. See https://github.com/felixge/fgprof/issues/33
for an example of the problem.

Add a test case to prevent similar regressions in the future. Use null
padding instead of null termination to be consistent with other profile
types and because it's less code to implement. Also fix the
ThreadCreateProfile code path.

Fixes #69243

Change-Id: I0b9414f6c694c304bc03a5682586f619e9bf0588
Reviewed-on: https://go-review.googlesource.com/c/go/+/609815
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
7 months agoruntime: fix MutexProfile missing root frames
Felix Geisendörfer [Sat, 7 Sep 2024 11:44:09 +0000 (13:44 +0200)]
runtime: fix MutexProfile missing root frames

Fix a regression introduced in CL 598515 causing runtime.MutexProfile
stack traces to omit their root frames.

In most cases this was merely causing the `runtime.goexit` frame to go
missing. But in the case of runtime._LostContendedRuntimeLock, an empty
stack trace was being produced.

Add a test that catches this regression by checking for a stack trace
with the `runtime.goexit` frame.

Also fix a separate problem in expandFrame that could cause
out-of-bounds panics when profstackdepth is set to a value below 32.
There is no test for this fix because profstackdepth can't be changed at
runtime right now.

Fixes #69335

Change-Id: I1600fe62548ea84981df0916d25072c3ddf1ea1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/611615
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Nick Ripley <nick.ripley@datadoghq.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agocmd/go: add support for go get -u tool
Conrad Irwin [Sun, 11 Feb 2024 04:51:12 +0000 (21:51 -0700)]
cmd/go: add support for go get -u tool

Change-Id: I14d20c6c77d0d0a83cb547d954ba7f244166bc43
Reviewed-on: https://go-review.googlesource.com/c/go/+/563176
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>
7 months agoall: enable alias type parameters GOEXPERIMENT by default
Tim King [Thu, 5 Sep 2024 23:22:50 +0000 (16:22 -0700)]
all: enable alias type parameters GOEXPERIMENT by default

For #68778

Change-Id: I4b39f84665262251ca014d3f5fe74b2fd434d51e
Reviewed-on: https://go-review.googlesource.com/c/go/+/613236
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Commit-Queue: Tim King <taking@google.com>
Reviewed-by: David Chase <drchase@google.com>
7 months agoruntime: print fatal messages without interleaving
Keith Randall [Tue, 24 Sep 2024 22:11:54 +0000 (15:11 -0700)]
runtime: print fatal messages without interleaving

Grab the print lock around the set of prints we use to report
fatal errors. This ensures that each fatal error gets reported
atomically instead of interleaved with other fatal errors.

Fixes #69447

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

7 months agogo/types, types2: move Checker.indexedElts into literals.go where it belongs
Robert Griesemer [Tue, 24 Sep 2024 21:08:28 +0000 (14:08 -0700)]
go/types, types2: move Checker.indexedElts into literals.go where it belongs

The function is only used by Checker.compositeLit.
Also, now its go/types source can be gerated from the types2 source.
No other code changes.

Change-Id: I88b7ad371d809a5d9bf8e635d9e003ba0a71ab78
Reviewed-on: https://go-review.googlesource.com/c/go/+/615635
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

7 months agogo/types, types2: implement underIs, coreType, coreString via typeset iterator
Robert Griesemer [Thu, 19 Sep 2024 22:20:30 +0000 (15:20 -0700)]
go/types, types2: implement underIs, coreType, coreString via typeset iterator

Remove remaining underIs methods and call underIs function instead.

Change-Id: Ic98430d3a56b85f6f4b35c4508c4c67dafbfa3f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/614240
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>

7 months agoruntime: disable epipe check for wasm platform
Zxilly [Sun, 22 Sep 2024 19:04:36 +0000 (19:04 +0000)]
runtime: disable epipe check for wasm platform

Pipe operation seems impossible for wasm build

Fixes #59099

Change-Id: Ibb526693dce4e867dabd92e5ace38a1adf18f401
GitHub-Last-Rev: d7dc3362717f4ddae2c026016812008d25783f4f
GitHub-Pull-Request: golang/go#69583
Reviewed-on: https://go-review.googlesource.com/c/go/+/614935
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: David Chase <drchase@google.com>
7 months agocmd/compile: small cleanups to rewrite rule helpers
khr@golang.org [Thu, 19 Sep 2024 18:16:19 +0000 (11:16 -0700)]
cmd/compile: small cleanups to rewrite rule helpers

Change-Id: I50a19bd971176598bf8e4ef86ec98f008abe245c
Reviewed-on: https://go-review.googlesource.com/c/go/+/615198
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@google.com>
7 months agocmd/compile: use generics for isPowerOfTwo predicates
khr@golang.org [Thu, 19 Sep 2024 17:06:55 +0000 (10:06 -0700)]
cmd/compile: use generics for isPowerOfTwo predicates

Change-Id: I097b53e9f13de6ff6eb18ae2261842b097f26390
Reviewed-on: https://go-review.googlesource.com/c/go/+/615197
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
7 months agocmd/compile: simplify naming for arm64 bitfield accessors
khr@golang.org [Mon, 5 Aug 2024 18:22:07 +0000 (11:22 -0700)]
cmd/compile: simplify naming for arm64 bitfield accessors

They are already methods on an arm64-specific type, so they don't
need to have arm64-specific names.

Change-Id: I2be29907f9892891d88d52cced043ca248aa4e08
Reviewed-on: https://go-review.googlesource.com/c/go/+/615196
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
7 months agogo/types, types2: introduce typeset iterators
Robert Griesemer [Thu, 19 Sep 2024 21:55:36 +0000 (14:55 -0700)]
go/types, types2: introduce typeset iterators

Preparation for removing the existing non-standard iterators
(is, underIs). Note that we cannot use typeset iterators in
range-over-func because the bootstrap compiler doesn't have
access to it yet.

While at it, move underIs from expr.go to under.go
and adjust some doc strings in typset.go to match
prevailing style in that file.

Change-Id: Iecd014eeb5b3fca56a807381c148c5f7a29bfb78
Reviewed-on: https://go-review.googlesource.com/c/go/+/614239
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Commit-Queue: Robert Griesemer <gri@google.com>

7 months agogo/types, types2: check that alias type arguments satisfy constraints
Robert Griesemer [Mon, 23 Sep 2024 20:02:16 +0000 (13:02 -0700)]
go/types, types2: check that alias type arguments satisfy constraints

Fixes #69576.

Change-Id: I8fc077970276977dd89fc2dd3867f2765d52e54e
Reviewed-on: https://go-review.googlesource.com/c/go/+/615275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

7 months agocmd/go: add support for go get -tool
Conrad Irwin [Wed, 24 Jul 2024 05:11:10 +0000 (23:11 -0600)]
cmd/go: add support for go get -tool

Running `go get -tool example.com/m1` will add a tool line to your mod
file and add any missing dependencies.

Running `go get -tool example.com/m1@none` will drop the tool line from
your mod file.

For golang/go#48429

Change-Id: I07b4776f1f55eff588d08cb6649d94cc42a729d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/563175
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
7 months agogo/types, types2: follow-up on comment in CL 615195
Robert Griesemer [Tue, 24 Sep 2024 17:57:49 +0000 (10:57 -0700)]
go/types, types2: follow-up on comment in CL 615195

Restate deferred call for readability.

Change-Id: I3725535b18fa4f1887e6c1976f8784e092b8f965
Reviewed-on: https://go-review.googlesource.com/c/go/+/615535
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
7 months agocmd/go: add tools to "all"
Conrad Irwin [Fri, 19 Jul 2024 03:37:57 +0000 (21:37 -0600)]
cmd/go: add tools to "all"

Packages referenced by tool lines in go.mod files will now be included
in the module graph for the new "tool" package pattern and the "all"
package pattern.

For golang/go#48429

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

7 months agogo/types, types2: print type parameters for Alias tyoes
Robert Griesemer [Mon, 23 Sep 2024 17:46:41 +0000 (10:46 -0700)]
go/types, types2: print type parameters for Alias tyoes

Like for Named types, print type parameters for Alias types.

Add test case for Alias object string to existing test.
To make the test work, factor out the mechanism to set
GOEXPERIMENT=aliastypeparams at test time and use it
for this test as well.

No test case for un-instantiated generic type Alias type
string: there's no existing test framework, the code is
identical as for Named types, and these strings only appear
in tracing output. Tested manually.

Change-Id: I476d04d0b6a7c18b79be1d34a9e3e072941df83f
Reviewed-on: https://go-review.googlesource.com/c/go/+/615195
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agocmd/go: prevent git from fetching during local only mode
Sam Thanawalla [Mon, 9 Sep 2024 17:12:02 +0000 (17:12 +0000)]
cmd/go: prevent git from fetching during local only mode

Since we added a local context to git lookups, we need to be more
careful about fetching from remote.
We should not fetch when we are stamping a binary because that could
slow down builds.

For #50603
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I81a719b7609e8d30b32ffb3c12a05074c5fd0c22
Reviewed-on: https://go-review.googlesource.com/c/go/+/611916
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
7 months agoreflect: slightly improve iter tests
Jes Cok [Thu, 23 May 2024 15:17:52 +0000 (23:17 +0800)]
reflect: slightly improve iter tests

Change-Id: Ia0e3d668a2435b2ee72e1c641092445902168e4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/587875
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agocrypto/internal/nistec: fix p256Select (PPC64) and p256SelectAffine (PPC64/s390x)
Paul E. Murphy [Tue, 27 Aug 2024 19:44:16 +0000 (14:44 -0500)]
crypto/internal/nistec: fix p256Select (PPC64) and p256SelectAffine (PPC64/s390x)

They are constant time, but some constants were incorrect. This
resulting in reading beyond the tables.

I've added linux specific tests which verify these functions are not
reading beyond the limits of their table.

Thank you Sun Yimin, @emmansun for catching this bug and suggesting
corrected constants.

Fixes #69080

Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power10,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9

Change-Id: Id37e0e22b2278ea20adaa1c84cbb32c3f20d4cf7
Reviewed-on: https://go-review.googlesource.com/c/go/+/608816
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Archana Ravindar <aravinda@redhat.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agonet,net/netip: implement the encoding.(Binary|Text)Appender
apocelipes [Fri, 20 Sep 2024 06:38:58 +0000 (06:38 +0000)]
net,net/netip: implement the encoding.(Binary|Text)Appender

Implement the encoding.TextAppender interface for "net.IP".

Implement the encoding.(Binary|Text)Appender interfaces for
"netip.Addr", "netip.AddrPort" and "netip.Prefix".

"net.IP.MarshalText" also gets some performance improvements:

                          │     old      │                 new                 │
                          │    sec/op    │   sec/op     vs base                │
IPMarshalText/IPv4-8         66.06n ± 1%   14.55n ± 1%  -77.97% (p=0.000 n=10)
IPMarshalText/IPv6-8        117.00n ± 1%   63.18n ± 1%  -46.00% (p=0.000 n=10)
IPMarshalText/IPv6_long-8    137.8n ± 1%   111.3n ± 1%  -19.27% (p=0.000 n=10)
geomean                      102.1n        46.77n       -54.21%

                          │    old     │                   new                   │
                          │    B/op    │    B/op     vs base                     │
IPMarshalText/IPv4-8        32.00 ± 0%    0.00 ± 0%  -100.00% (p=0.000 n=10)
IPMarshalText/IPv6-8        48.00 ± 0%    0.00 ± 0%  -100.00% (p=0.000 n=10)
IPMarshalText/IPv6_long-8   96.00 ± 0%   48.00 ± 0%   -50.00% (p=0.000 n=10)

                          │    old     │                   new                   │
                          │ allocs/op  │ allocs/op   vs base                     │
IPMarshalText/IPv4-8        2.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)
IPMarshalText/IPv6-8        2.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)
IPMarshalText/IPv6_long-8   2.000 ± 0%   1.000 ± 0%   -50.00% (p=0.000 n=10)

All exported types in the standard library that implement the
"encoding.(Binary|Text)Marshaler" now also implement the
"encoding.(Binary|Text)Appender".

Fixes #62384

Change-Id: I7d3da8c5736a1ab9c54b9ac4bd2fbf850f9d1bd0
GitHub-Last-Rev: 5d27854725d957dd89d2ddc4342ca97999d10cb2
GitHub-Pull-Request: golang/go#69022
Reviewed-on: https://go-review.googlesource.com/c/go/+/607520
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agoencoding/asn1: unmarshal bool values correctly dealing with the ANY type
Jes Cok [Sat, 29 Jun 2024 18:46:12 +0000 (02:46 +0800)]
encoding/asn1: unmarshal bool values correctly dealing with the ANY type

Fixes #68241

Change-Id: I1ee81aa50c2f39f535ad27309e855f19acb2f2ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/595796
Auto-Submit: 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>
Reviewed-by: Roland Shoemaker <roland@golang.org>
7 months agotext/template/parse: use correct line number in error after comment
yincong [Sun, 22 Sep 2024 08:05:02 +0000 (08:05 +0000)]
text/template/parse: use correct line number in error after comment

Fixes #69526

Change-Id: I42467ddec02e91f24bce87185bf8d7f16f8811b0
GitHub-Last-Rev: 039a5b6884aa65f34cecbfcd127861a703a048da
GitHub-Pull-Request: golang/go#69532
Reviewed-on: https://go-review.googlesource.com/c/go/+/614375
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
7 months agofmt: fix incorrect doc comment
wanggang [Sat, 21 Sep 2024 03:02:47 +0000 (03:02 +0000)]
fmt: fix incorrect doc comment

I noticed that the comment incorrectly stated 'WriteString implemented WriteString', it should be 'implemented io.StringWriter' instead.

Change-Id: I844a8c805e5f0c32b5aea68c4bba6982f6fcc8a7
GitHub-Last-Rev: a0d93b6e9d3c2a508d1f3c0ce23e98274ec421fb
GitHub-Pull-Request: golang/go#69546
Reviewed-on: https://go-review.googlesource.com/c/go/+/614575
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Rob Pike <r@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
7 months agoos: skip TestReadlink sub-tests requiring symlinks when not enough
qmuntal [Fri, 20 Sep 2024 14:51:50 +0000 (16:51 +0200)]
os: skip TestReadlink sub-tests requiring symlinks when not enough
permissions are held

Some of the TestReadlink sub-tests require os.Symlink to succeed.
If the user doesn't have enough permissions to create symlinks, then
there is no point in running the test.

Change-Id: I06ec7e3ddf0016e804667bba0ee6ebe6baa01872
Reviewed-on: https://go-review.googlesource.com/c/go/+/614655
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>