]> Cypherpunks repositories - gostls13.git/log
gostls13.git
11 months agogo/ast: fix bug handling the result of yield in Preorder
Rob Findley [Thu, 16 May 2024 14:08:12 +0000 (14:08 +0000)]
go/ast: fix bug handling the result of yield in Preorder

Once yield returns false, ast.Preorder must not call yield on any more
nodes. Even after the function passed to ast.Inspect returns false, it
may be invoked again with a non-nil node. Therefore, we must explicitly
truncate the inspection.

For #66339

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

11 months agolog/slog: handle times with undefined UnixNanos
Jonathan Amsterdam [Thu, 16 May 2024 12:14:52 +0000 (08:14 -0400)]
log/slog: handle times with undefined UnixNanos

slog tries to represent a time.Time without allocations, which involves
storing its UnixNanos value. But UnixNanos is undefined for some valid
times. Provide a fallback representation for those times by storing them
in the `any` field of `Value`.

Fixes #65902.

Change-Id: I736c739a92f77d7b1122ea0831524acdd2c4703f
Reviewed-on: https://go-review.googlesource.com/c/go/+/585519
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
11 months agonet/http: simplify HTTP/1 request cancelation
Damien Neil [Sat, 2 Dec 2023 00:26:14 +0000 (16:26 -0800)]
net/http: simplify HTTP/1 request cancelation

HTTP requests have three separate user cancelation signals:

Transport.CancelRequest
Request.Cancel
Request.Context()

In addition, a request can be canceled due to errors.

The Transport keeps a map of all in-flight requests,
with an associated func to run if CancelRequest is
called. Confusingly, this func is *not* run if
Request.Cancel is closed or the request context expires.

The map of in-flight requests is also used to communicate
between roundTrip and readLoop. In particular, if readLoop
reads a response immediately followed by an EOF, it may
send racing signals to roundTrip: The connection has
closed, but also there is a response available.
This race is resolved by readLoop communicating through
the request map that this request has successfully
completed.

This CL refactors all of this.

In-flight requests now have a context which is canceled
when any of the above cancelation events occurs.

The map of requests to cancel funcs remains, but is
used strictly for implementing Transport.CancelRequest.
It is not used to communicate information about the
state of a request.

Change-Id: Ie157edc0ce35f719866a0a2cb0e70514fd119ff8
Reviewed-on: https://go-review.googlesource.com/c/go/+/546676
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
11 months agoarchive/zip: treat truncated EOCDR comment as an error
Damien Neil [Tue, 14 May 2024 21:39:10 +0000 (14:39 -0700)]
archive/zip: treat truncated EOCDR comment as an error

When scanning for an end of central directory record,
treat an EOCDR signature with a record containing a truncated
comment as an error. Previously, we would skip over the invalid
record and look for another one. Other implementations do not
do this (they either consider this a hard error, or just ignore
the truncated comment). This parser misalignment allowed
presenting entirely different archive contents to Go programs
and other zip decoders.

Fixes #66869

Change-Id: I94e5cb028534bb5704588b8af27f1e22ea49c7c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/585397
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 months agodoc: make symbol links simpler for relnotes
Jes Cok [Thu, 16 May 2024 14:47:59 +0000 (22:47 +0800)]
doc: make symbol links simpler for relnotes

Change-Id: Ie8ff3d1d1398618b9a229aa3cb1ef2deaa58c3d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/586056
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

11 months agocmd/go/internal/envcmd: fix showing GODEBUG env value
Michael Matloob [Thu, 16 May 2024 14:51:49 +0000 (10:51 -0400)]
cmd/go/internal/envcmd: fix showing GODEBUG env value

It was accidently dropped in CL 563137

For #34208

Change-Id: I0aea93fda6260f07bc662dea92d1eabb26f82ca0
Reviewed-on: https://go-review.googlesource.com/c/go/+/586095
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
11 months agoruntime/debug: eliminate temporary variadicity from SetCrashOutput
Alan Donovan [Wed, 15 May 2024 21:41:56 +0000 (17:41 -0400)]
runtime/debug: eliminate temporary variadicity from SetCrashOutput

Updates #67182

Change-Id: I33fc8c515f4a9d120262ba30f61aea80ede5e9f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/585420
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
11 months agocmd/go: add -changed to query for non-defaults in the env
qiulaidongfeng [Thu, 9 May 2024 22:11:00 +0000 (22:11 +0000)]
cmd/go: add -changed to query for non-defaults in the env

Fixes #34208

Change-Id: I8ec2d96262dcd7cbf870f6173690143c54190722
GitHub-Last-Rev: 6543df4784cff1ba5751dc9885ef502e69679118
GitHub-Pull-Request: golang/go#65655
Reviewed-on: https://go-review.googlesource.com/c/go/+/563137
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
11 months agocmd/vendor/golang.org/x/telemetry: update to 9ff3ad9
Alan Donovan [Wed, 15 May 2024 21:39:28 +0000 (17:39 -0400)]
cmd/vendor/golang.org/x/telemetry: update to 9ff3ad9

Updates #67182

Change-Id: I76b312ccbd1ea98eb2f4e3beec9e8b42e633ea5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/585819
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 months agodoc/README.md: mention adding the proposal issue
Jonathan Amsterdam [Thu, 9 May 2024 18:09:32 +0000 (14:09 -0400)]
doc/README.md: mention adding the proposal issue

Inform users that every accepted proposal should be mentioned
in the release notes to avoid generating a TODO.

Also, clarify instructions for the release team.

For #64169.

Change-Id: I03921739af31fc93f4b5808b2c7c98e28ad3da11
Reviewed-on: https://go-review.googlesource.com/c/go/+/584615
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 months agocrypto/x509: add text and binary marshal methods to OID
Mateusz Poliwczak [Wed, 15 May 2024 17:36:53 +0000 (17:36 +0000)]
crypto/x509: add text and binary marshal methods to OID

Fixes #66249

Change-Id: I5973a19a087a35ad951e8a220d3e6e4456c7577f
GitHub-Last-Rev: 921ca8bd0c08687bb727dbfb0890c3355eebe95b
GitHub-Pull-Request: golang/go#66599
Reviewed-on: https://go-review.googlesource.com/c/go/+/575295
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>

11 months agocmd/compile: add test case for using Alias types
Cuong Manh Le [Fri, 1 Mar 2024 16:54:39 +0000 (23:54 +0700)]
cmd/compile: add test case for using Alias types

CL 579935 disabled usage of Alias types in the compiler, and tracks
the problem with issue #66873. The test case in #65893 passes now
with the current tip. This CL adds a test case to ensure there is no
regression once Alias types are enabled for the compiler.

Updates #66873
Fixes #65893

Change-Id: I51b51bb13ca59549bc5925dd95f73da40465556d
Reviewed-on: https://go-review.googlesource.com/c/go/+/568455
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>

11 months agomath/rand/v2: use max builtin in tests
Tobias Klauser [Wed, 15 May 2024 09:04:10 +0000 (11:04 +0200)]
math/rand/v2: use max builtin in tests

Change-Id: I6d0050319c66fb62c817206e646e1a9449dc444c
Reviewed-on: https://go-review.googlesource.com/c/go/+/585715
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.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>

11 months agoruntime: always update stack bounds on cgocallback
Michael Pratt [Thu, 9 May 2024 20:54:41 +0000 (16:54 -0400)]
runtime: always update stack bounds on cgocallback

callbackUpdateSystemStack contains a fast path to exit early without
update if SP is already within the g0.stack bounds.

This is not safe, as a subsequent call may have new stack bounds that
only partially overlap the old stack bounds. In this case it is possible
to see an SP that is in the old stack bounds, but very close to the
bottom of the bounds due to the partial overlap. In that case we're very
likely to "run out" of space on the system stack.

We only need to do this on extra Ms, as normal Ms have precise bounds
defined when we allocated the stack.

TSAN annotations are added to x_cgo_getstackbounds because bounds is a
pointer into the Go stack. The stack can be reused when an old thread
exits and a new thread starts, but TSAN can't see the synchronization
there. This isn't a new case, but we are now calling more often.

Fixes #62440.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I5389050494987b7668d0b317fb92f85e61d798ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/584597
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 months agocmd/go/internal/script: Fix build tags of isETXTBSY
Hiroaki Nakamura [Wed, 15 May 2024 08:57:05 +0000 (17:57 +0900)]
cmd/go/internal/script: Fix build tags of isETXTBSY

syscall.ETXTBSY is only meaningful on Unix platforms, not on Windows.

Fixes #67356

Change-Id: I1b13292d821d61d820b396e08be9a4dd1683e843
Reviewed-on: https://go-review.googlesource.com/c/go/+/585695
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>
Reviewed-by: Michael Matloob <matloob@golang.org>
11 months agonet/http, reflect: rename Test function names
Jes Cok [Wed, 15 May 2024 22:49:49 +0000 (06:49 +0800)]
net/http, reflect: rename Test function names

To be consistent with other tests.

Change-Id: Ibea1d3bf57a295f024e05173d17112ce46a4f0bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/585895
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: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

11 months agocmd/go: don't start upload until after toolchain selection
Michael Matloob [Mon, 13 May 2024 18:59:02 +0000 (14:59 -0400)]
cmd/go: don't start upload until after toolchain selection

Run telemetry.Start (without the upload) first thing so we can increment
counters in toolchain selection. Then run telemetry.StartWithUpload
after toolchain selection so we don't start the upload until after
toolchain selection has happened so we don't start something heavyweight
before selection.

Change-Id: Ia8979175a163265c3e29f6cb11a4ada4714d1d95
Reviewed-on: https://go-review.googlesource.com/c/go/+/585419
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
11 months agogo/ast: add Preorder go1.23 iterator
Alan Donovan [Mon, 11 Mar 2024 21:16:44 +0000 (17:16 -0400)]
go/ast: add Preorder go1.23 iterator

This CL adds a new function Preorder that makes it
easier to iterate over the nodes of a syntax tree.
In particular, break, continue, and return retain
their usual continuations.

Fixes #66339

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

11 months agogo/types, types2: factor out type parameter access into genericType
Robert Griesemer [Thu, 25 Apr 2024 23:10:22 +0000 (16:10 -0700)]
go/types, types2: factor out type parameter access into genericType

Also, remove types2.Signature.SetTypeParams as it is not used
and does not exist in go/types.

Change-Id: I16c3ae988988d3735907e9c6c56e8626497ea405
Reviewed-on: https://go-review.googlesource.com/c/go/+/581817
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>
Reviewed-by: Robert Findley <rfindley@google.com>
11 months agogo/types, types2: add Alias.{TypeParams, SetTypeParams, TypeArgs, Origin}
Robert Griesemer [Tue, 7 May 2024 16:38:28 +0000 (09:38 -0700)]
go/types, types2: add Alias.{TypeParams, SetTypeParams, TypeArgs, Origin}

Fixes #67143.

Change-Id: I8bf9c2559f95d3d6a40874454208ae074b68875c
Reviewed-on: https://go-review.googlesource.com/c/go/+/583757
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
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>

11 months agocmd/vendor/golang.org/x/telemetry: update to ac8fed8
Alan Donovan [Wed, 15 May 2024 19:06:14 +0000 (15:06 -0400)]
cmd/vendor/golang.org/x/telemetry: update to ac8fed8

Updates #67182

Change-Id: I14f6a35491e3a58fff2f33285bd13ac706668df6
Reviewed-on: https://go-review.googlesource.com/c/go/+/585818
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
11 months agoruntime/debug: add SetCrashOutput(...CrashOptions) parameter
Alan Donovan [Wed, 15 May 2024 18:55:19 +0000 (14:55 -0400)]
runtime/debug: add SetCrashOutput(...CrashOptions) parameter

This is a placeholder for future options (e.g. JSON).

The parameter is temporarily variadic to avoid breaking
x/telemetry (see CL 585378), but I plan to remove
the "..." later this week.

Updates #67182

Change-Id: I3f6f39455d852f92902f8e3f007d3093cbe555db
Reviewed-on: https://go-review.googlesource.com/c/go/+/585557
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
11 months agogo/types, types2: add additional documentation for Underlying
Rob Findley [Tue, 14 May 2024 19:19:48 +0000 (19:19 +0000)]
go/types, types2: add additional documentation for Underlying

The concept of an underlying type has become more complicated with the
addition of TypeParam and Alias types. Update the documentation to
clarify that it strips off Named, TypeParam, and Alias types, and to
reference the spec.

Fixes #65774

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

11 months agocmd/link: disallow pull-only linknames
Cherry Mui [Tue, 14 May 2024 04:01:49 +0000 (00:01 -0400)]
cmd/link: disallow pull-only linknames

As mentioned in CL 584598, linkname is a mechanism that, when
abused, can break API integrity and even safety of Go programs.
CL 584598 is a first step to restrict the use of linknames, by
implementing a blocklist. This CL takes a step further, tightening
up the restriction by allowing linkname references ("pull") only
when the definition side explicitly opts into it, by having a
linkname on the definition (possibly to itself). This way, it is at
least clear on the definition side that the symbol, despite being
unexported, is accessed outside of the package. Unexported symbols
without linkname can now be actually private. This is similar to
the symbol visibility rule used by gccgo for years (which defines
unexported non-linknamed symbols as C static symbols).

As there can be pull-only linknames in the wild that may be broken
by this change, we currently only enforce this rule for symbols
defined in the standard library. Push linknames are added in the
standard library to allow things build.

Linkname references to external (non-Go) symbols are still allowed,
as their visibility is controlled by the C symbol visibility rules
and enforced by the C (static or dynamic) linker.

Assembly symbols are treated similar to linknamed symbols.

This is controlled by -checklinkname linker flag, currently not
enabled by default. A follow-up CL will enable it by default.

Change-Id: I07344f5c7a02124dbbef0fbc8fec3b666a4b2b0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/585358
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
11 months agocmd/compile: disallow linkname referring to instantiations
Cherry Mui [Wed, 15 May 2024 02:34:58 +0000 (22:34 -0400)]
cmd/compile: disallow linkname referring to instantiations

Linknaming an instantiated generic symbol isn't particularly
useful: it doesn't guarantee the instantiation exists, and the
instantiated symbol name may be subject to change. Checked with a
large code corpus, currently there is no occurrance of linkname
to an instantiated generic symbol (or symbol with a bracket in its
name). This also suggests that it is not very useful. Linkname is
already an unsafe mechanism. We don't need to allow it to do more
unsafe things without justification.

Change-Id: Ifaa20c98166b28a9d7dc3290c013c2b5bb7682e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/585458
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
11 months agoruntime: make convTstring write barrier unreachable from throw
Alan Donovan [Thu, 9 May 2024 22:16:59 +0000 (18:16 -0400)]
runtime: make convTstring write barrier unreachable from throw

CL 581215 changed 'throw' so that instead of print(s) it called
a more complicated function, printpanicval, that statically
appeared to have convTstring in its call graph, even though this
isn't dynamically reachable when called with a string argument.

However, this caused the link-time static callgraph test to point
out that throw (which is called in nowritebarrierrec contexts
such as markgc) reaches a write barrier.

The solution is to inline and specialize the printpanicval
function for strings; it reduces to printindented.

Thanks to mpratt for pointing out that the reachability
check is on the fully lowered code, and is thus sensitive
to optimizations such as inlining.
I added an explanatory comment on the line that generates
the error message to help future users confused as I was.

Fixes golang/go#67274

Change-Id: Ief110d554de365ce4c09509dceee000cbee30ad9
Reviewed-on: https://go-review.googlesource.com/c/go/+/584617
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
11 months agocmd/go/internal/modload: compute direct in workspace mode
Michael Matloob [Thu, 18 Apr 2024 22:04:54 +0000 (18:04 -0400)]
cmd/go/internal/modload: compute direct in workspace mode

The Requirements structure, which represents the root level requirements
of the module graph also has a 'direct' field which contains the set of
direct dependencies of a module.

Before this change, in workspace mode, the direct field was not set on
the Requirements structure. This change sets direct in the two places
it's needed: when initializing Requirements from the workspace's mod
files and when updating Requirements based on imports.

When initializing Requirements from the workspace's mod files, this
change will use the 'indirect' comments in those mod files to record the
set of direct modules passed to the Requirements.

There is a loop in updateRequirements where we consider the imports of
the packages we loaded from the main module to make sure that all those
imported packages' modules are required.  The loop also updates direct
for each of those modules (which have at least one package directly
imported by the main modules).  Before this change, in the workspace
case we continued early from the loop and didn't proceed to the code
where direct is computed. This change fixes that.

Fixes #66789

Change-Id: I2b497fbf28c2197e8ba8e8ca5314c1a720f16364
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/580256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
11 months agocmd/compile, cmd/internal: fine-grained fiddling with loop alignment
David Chase [Tue, 2 Apr 2024 15:12:44 +0000 (11:12 -0400)]
cmd/compile, cmd/internal: fine-grained fiddling with loop alignment

This appears to be useful only on amd64, and was specifically
benchmarked on Apple Silicon and did not produce any benefit there.
This CL adds the assembly instruction `PCALIGNMAX align,amount`
which aligns to `align` if that can be achieved with `amount`
or fewer bytes of padding. (0 means never, but will align the
enclosing function.)

Specifically, if low-order-address-bits + amount are
greater than or equal to align; thus, `PCALIGNMAX 64,63` is
the same as `PCALIGN 64` and `PCALIGNMAX 64,0` will never
emit any alignment, but will still cause the function itself
to be aligned to (at least) 64 bytes.

Change-Id: Id51a056f1672f8095e8f755e01f72836c9686aa3
Reviewed-on: https://go-review.googlesource.com/c/go/+/577935
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
11 months agocmd/compile/internal/noder: enable type aliases in type checker
Matthew Dempsky [Wed, 15 May 2024 05:22:34 +0000 (22:22 -0700)]
cmd/compile/internal/noder: enable type aliases in type checker

This CL fixes an initialization loop during IR construction, that
stems from IR lacking first-class support for aliases. As a
workaround, we avoid publishing alias declarations until the RHS type
expression has been constructed.

Thanks to gri@ for investigating while I was out.

Fixes #66873.

Change-Id: I11e0d96ea6c357c295da47f44b6ec408edef89b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/585399
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>

11 months agorun.bash: rm bumping open files soft limit
Kir Kolyshkin [Wed, 15 May 2024 01:09:04 +0000 (18:09 -0700)]
run.bash: rm bumping open files soft limit

Since CL 393354 this should no longer be necessary.

Change-Id: Ie9a7f779515aaf8b40a4f0083ba680f7b0231f04
Reviewed-on: https://go-review.googlesource.com/c/go/+/585576
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: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

11 months agocmd/internal/obj/x86: make SEH symbols content-addressable
Cherry Mui [Wed, 15 May 2024 01:40:51 +0000 (21:40 -0400)]
cmd/internal/obj/x86: make SEH symbols content-addressable

Currently, the SEH symbol is defined as an aux symbol of the
function symbol, without adding to ctxt.Data. Each function has
its own SEH symbol. As there are a lot of duplications of the
SEH symbol contents, currently a Go object file may contain many
copies of identical SEH symbols. They are deduplicated at link
time. But it does make the linker do redundant work, and make it
hard to reason about the SEH symbol writing in the object file
writer, and its resolution in the linker. In fact, in the object
file writer, the same SEH symbol may be added to the ctxt.defs
multiple times (as it is the aux of multiple function symbols),
which is not expected.

In fact, "aux symbol" is just a mechanism to associate auxiliary
data to another symbol. The auxiliary data symbol itself can be an
ordinary data symbol, even a content-addressable symbol. Define
the SEH symbol as a conntent-addressable symbol and add it to
ctxt.Data. This way there is only one definition of each unique
SEH symbol, which can be the aux of many functions.

While here, add a check to ensure that we add a symbol at most
once to the defs list.

Change-Id: Ie7a0cf02ca114060423e025931b30de97ca330fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/585656
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
11 months agocmd/internal/obj: print symbol index at -S=3
Cherry Mui [Wed, 15 May 2024 01:39:30 +0000 (21:39 -0400)]
cmd/internal/obj: print symbol index at -S=3

When the compiler or assembler's -S flag is set to 3 or higher,
print the symbol index, for debugging.

Change-Id: Ia7a42b0c017105ef12fd97b3e52de0e155b0cf2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/585655
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
11 months agocmd/compile,cmd/asm: on PPC64, generate compares against constant 0
Paul E. Murphy [Mon, 13 May 2024 16:56:42 +0000 (11:56 -0500)]
cmd/compile,cmd/asm: on PPC64, generate compares against constant 0

Merge the handling of CMPx r,r,cr and CMPx r,i,cr when assembling.

This prevents generating machine code like cmpd rx,r0 when cmpdi rx,0
is preferred. The preferred form can be fused on Power10 for faster
execution of some instruction sequences.

Likewise, update a common case to use $0 instead of R0 to take
advantage of this.

Change-Id: If2549ca25a5f7d23001885ad444c70d829b3b066
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
Reviewed-on: https://go-review.googlesource.com/c/go/+/585137
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 months agocmd/go: add support for godebug lines in go.mod and go.work
Russ Cox [Thu, 9 May 2024 00:41:38 +0000 (20:41 -0400)]
cmd/go: add support for godebug lines in go.mod and go.work

The fact that the go line sets both the language version and the
GODEBUG compatibility version can be a problem, especially since
the go line is also required to be â‰¥ the go lines of any required
dependency modules.

This change adds a new 'godebug' line to go.mod and go.work
to allow setting the GODEBUG values for the entire module.

It also adds a new meta-value default=go1.21 that means
take the defaults from Go 1.21 no matter what the go line says.

These were discussed in proposal #65573.

Fixes #65573.

Change-Id: I91746322a10178370ed1015ce5278372a024c824
Reviewed-on: https://go-review.googlesource.com/c/go/+/584476
Auto-Submit: Russ Cox <rsc@golang.org>
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>
11 months agocmd/compile/internal/ssa: combine more shift and masking on PPC64
Paul E. Murphy [Wed, 1 May 2024 20:03:34 +0000 (15:03 -0500)]
cmd/compile/internal/ssa: combine more shift and masking on PPC64

Investigating binaries, these patterns seem to show up frequently.

Change-Id: I987251e4070e35c25e98da321e444ccaa1526912
Reviewed-on: https://go-review.googlesource.com/c/go/+/583302
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
11 months agodoc/godebug: correct gotypealias=1 deprecation
Russ Cox [Tue, 14 May 2024 19:27:33 +0000 (15:27 -0400)]
doc/godebug: correct gotypealias=1 deprecation

Per the note earlier in the page, GODEBUGs are maintained for a
minimum of two years (four Go releases). Not said but certainly
implied is that they are maintained for four Go releases from the
point where people started needing to use them.

Since people would start needing gotypesalias=0 in Go 1.23,
it can be removed in Go 1.27.

Change-Id: Ifad63a1fff63c3f96f2ee192ca74bd1ce8bdb61f
Reviewed-on: https://go-review.googlesource.com/c/go/+/585457
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
11 months agosyscall: skip TestAmbientCapsUserns when restricted, document
Michael Stapelberg [Tue, 14 May 2024 08:54:40 +0000 (10:54 +0200)]
syscall: skip TestAmbientCapsUserns when restricted, document

fixes golang/go#67088

Change-Id: I42e7a8d02b161187772f147e3e136ab6e0f71d7f
Reviewed-on: https://go-review.googlesource.com/c/go/+/585059
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
11 months agonet/http: avoid panic when writing 100-continue after handler done
Damien Neil [Tue, 14 May 2024 16:55:11 +0000 (09:55 -0700)]
net/http: avoid panic when writing 100-continue after handler done

When a request contains an "Expect: 100-continue" header,
the first read from the request body causes the server to
write a 100-continue status.

This write caused a panic when performed after the server handler
has exited. Disable the write when cleaning up after a handler
exits.

This also fixes a bug where an implicit 100-continue could be
sent after a call to WriteHeader has sent a non-1xx header.

This change drops tracking of whether we've written a
100-continue or not in response.wroteContinue. This tracking
was used to determine whether we should consume the remaining
request body in chunkWriter.writeHeader, but the discard-the-body
path was only taken when the body was already consumed.
(If the body is not consumed, we set closeAfterReply, and we
don't consume the remaining body when closeAfterReply is set.
If the body is consumed, then we may attempt to discard the
remaining body, but there is obviously no body remaining.)

Fixes #53808

Change-Id: I3542df26ad6cdfe93b50a45ae2d6e7ef031e46fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/585395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
11 months agocmd/compile/internal/ssa: print output on failure in TestFmaHash
Cherry Mui [Tue, 14 May 2024 16:49:39 +0000 (12:49 -0400)]
cmd/compile/internal/ssa: print output on failure in TestFmaHash

When the test fails to run the command, print the error message
to help debug.

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

11 months agodatabase/sql: reordering fields to reduce struct sizes
apocelipes [Tue, 14 May 2024 09:42:57 +0000 (09:42 +0000)]
database/sql: reordering fields to reduce struct sizes

There are 16 bytes reduced.

Change-Id: I33ca96fd22002b3111f0462c3029d70df48adb6e
GitHub-Last-Rev: 8df56a9655ef261be3ff9403491cbbe1ebda1ec0
GitHub-Pull-Request: golang/go#67055
Reviewed-on: https://go-review.googlesource.com/c/go/+/581935
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

11 months agointernal/poll: use internal/byteorder
Tobias Klauser [Tue, 14 May 2024 11:49:35 +0000 (13:49 +0200)]
internal/poll: use internal/byteorder

Change-Id: Ied768b8b675281b340f91f4ac6f688594be8bf4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/585118
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
11 months agosyscall: use internal/byteorder
Tobias Klauser [Tue, 14 May 2024 11:48:21 +0000 (13:48 +0200)]
syscall: use internal/byteorder

Change-Id: I798729a6095494e9d0bd18d6b7d4372910056218
Reviewed-on: https://go-review.googlesource.com/c/go/+/585117
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
11 months agoos: use internal/byteorder
Tobias Klauser [Tue, 14 May 2024 11:22:07 +0000 (13:22 +0200)]
os: use internal/byteorder

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

11 months agocmd: add telemetry for commands in cmd
Michael Matloob [Mon, 13 May 2024 18:59:02 +0000 (14:59 -0400)]
cmd: add telemetry for commands in cmd

This change modifies the commands in cmd to open counter files,
increment invocations counters and to increment counters for the names
of the flags that were passed in.

cmd/pprof and cmd/vet are both wrappers around tools defined in other
modules which do their own flag processing so we can't directly
increment flag counters right after flags are parsed. For those two
commands we wait to increment counters until after the programs have
returned.

cmd/dist is built with the bootstrap go so it can't depend on telemetry
yet. We can add telemetry support to it once 1.23 is the minimum
bootstrap version.

For #58894

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

11 months agocmd: pull in golang.org/x/telemetry@7d78a97
Michael Matloob [Tue, 14 May 2024 18:48:52 +0000 (14:48 -0400)]
cmd: pull in golang.org/x/telemetry@7d78a97

Commands run:
    go get golang.org/x/telemetry@7d78a97
    go mod tidy
    go mod vendor

Change-Id: Iea0fbe11bcc69fac35fba0ee3d02cd14344a3ee9
Reviewed-on: https://go-review.googlesource.com/c/go/+/585455
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
11 months agocmd/vendor: pull in x/mod/modfile godebug changes
Russ Cox [Thu, 9 May 2024 00:41:33 +0000 (20:41 -0400)]
cmd/vendor: pull in x/mod/modfile godebug changes

go get golang.org/x/mod@c0bdc7bd
go mod tidy
go mod vendor

Pulls in CL 584300.

For #65573.

Change-Id: Ia8ec86e2ee049b911fcf09d57f83972786b0470d
Reviewed-on: https://go-review.googlesource.com/c/go/+/584475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
11 months agotime: more flake removal in asynctimerchan test
Russ Cox [Tue, 14 May 2024 17:21:22 +0000 (13:21 -0400)]
time: more flake removal in asynctimerchan test

Trying to write a test for the corner cases in the old async timer chan
implementation may have been a mistake, especially since this isn't
going to be the default timer chan implementation anymore.
But let's try one more time to fix the test.

I reproduced the remaining builder failures on my Mac laptop
by overloading the CPU in one window and then running 48 instances
of the flaky test in loops using 'stress' in another window.

It turns out that, contrary to my understanding of async timers
and therefore contrary to what the test expected, it is technically
possible for

t := time.NewTicker(1)
t.Reset(1000*time.Hour)
<-t.C
<-t.C

to observe two time values on t.C, as opposed to blocking forever.

We always expect the first time value, since the ticker goes off
immediately (after 1ns) and sends that value into the channel buffer.
To get the second value, the ticker has to be in the process of
going off (which it is doing constantly anyway), and the timer
goroutine has to be about to call sendTime and then get rescheduled.
Then t.Reset and the first <-t.C have to happen.
Then the timer goroutine gets rescheduled and can run sendTime's
non-blocking send on t.C, which finds an empty buffer and writes
a value.

This is unlikely, of course, but it definitely happens. This program
always panics in just a second or two on my laptop:

package main

import (
"os"
"time"
)

func main() {
os.Setenv("GODEBUG", "asynctimerchan=1")
for  {
go func() {
t := time.NewTicker(1)
t.Reset(1000*time.Hour)
<-t.C
select {
case <-t.C:
panic("two receives")
case <-time.After(1*time.Second):
}
}()
}
}

Because I did not understand this nuance, the test did not expect it.

This CL rewrites the test to expect that possibility. I can no longer
make the test fail under 'stress' on my laptop.

For #66322.

Change-Id: I15c75d2c6f24197c43094da20d6ab55306a0a9f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/585359
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 months agodoc: add relnote fragment on stack slot merging
Than McIntosh [Wed, 24 Apr 2024 18:53:45 +0000 (18:53 +0000)]
doc: add relnote fragment on stack slot merging

Add a blurb to the toolchain section talking about stack slot merging.

Updates #62737.

Change-Id: I26193a6a381c95ff5d79ce80b77c10c7561d00cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/581439
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
11 months agocmd/link/internal/ld: clean tmpdir obj timestamps
Than McIntosh [Tue, 14 May 2024 14:59:03 +0000 (14:59 +0000)]
cmd/link/internal/ld: clean tmpdir obj timestamps

This patch changes the Go linker to "clean" (reset to Unix epoch) the
timestamps on object files copied to the tmpdir that is presented to
the external linker or archive tool. The intent is to improve build
reproducibility on Darwin, where later versions of xcode seem to want
to incorporate object file timestamps into the hash used for the final
build ID (which precludes the possibility of having reproducible Go
builds). Credit for this idea goes to Cherry (see
https://github.com/golang/go/issues/64947#issuecomment-1887667189).

Updates #64947.

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

11 months agoencoding/base32: use correct length for unpadded buffer in Read
Niklas Ott [Wed, 24 Apr 2024 13:22:52 +0000 (15:22 +0200)]
encoding/base32: use correct length for unpadded buffer in Read

If unpadded content was passed, in some occassions content was omitted,
because the division result was floored. Ceiling it makes sure all
content is always read.

Fixes #65166

Change-Id: I1d8ee7ef436080483ed8f0e615b70a1013455f92
Reviewed-on: https://go-review.googlesource.com/c/go/+/581415
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 months agonet/netip: fix TestInlining after CL 585057
Tobias Klauser [Tue, 14 May 2024 06:56:12 +0000 (08:56 +0200)]
net/netip: fix TestInlining after CL 585057

Addr.AsSlice is not inlinable on all architectures.

Fixes #67354

Change-Id: Ibaf7daa2e1188a05952f8df3c84255436b29478d
Reviewed-on: https://go-review.googlesource.com/c/go/+/585058
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
11 months agointernal/chacha8rand: use internal/byteorder
Mateusz Poliwczak [Sun, 12 May 2024 06:32:11 +0000 (06:32 +0000)]
internal/chacha8rand: use internal/byteorder

Change-Id: Ia5bcaba47da949583a720ca3506d6bd9e3794824
GitHub-Last-Rev: 1ed3dad2bf43df5526572f7fdc4c3b02ab977a01
GitHub-Pull-Request: golang/go#67320
Reviewed-on: https://go-review.googlesource.com/c/go/+/584996
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
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>

11 months agonet/netip: test that Addr.AsSlice is inlineable
Tobias Klauser [Mon, 13 May 2024 16:00:46 +0000 (18:00 +0200)]
net/netip: test that Addr.AsSlice is inlineable

CL 584995 made Addr.AsSlice inlineable as a side effect. Make sure we
don't regress.

Updates #56136

Change-Id: Ib5f77a430db66ffe45c4cbb264da7a401945fec9
Reviewed-on: https://go-review.googlesource.com/c/go/+/585057
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
11 months agonet/netip: replace != nil with != "" in comment
Mateusz Poliwczak [Mon, 13 May 2024 13:01:17 +0000 (13:01 +0000)]
net/netip: replace != nil with != "" in comment

Change-Id: Ie204f90e51c210efe520a075b917c6178e109676
GitHub-Last-Rev: 9ca21ff92fbce5b60b904cdaf1e32632dbcdd0c6
GitHub-Pull-Request: golang/go#67341
Reviewed-on: https://go-review.googlesource.com/c/go/+/585155
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 months agonet/netip: combine import groups
Tobias Klauser [Mon, 13 May 2024 15:59:12 +0000 (17:59 +0200)]
net/netip: combine import groups

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

11 months agoslices: fix punctuation in the documentation of Values
Alberto Donizetti [Sun, 12 May 2024 13:37:41 +0000 (15:37 +0200)]
slices: fix punctuation in the documentation of Values

Change-Id: Idea4f92d511b5f18531758667cb0cb5ed6f91a0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/584359
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: Dmitri Shuralyov <dmitshur@google.com>
11 months agoimage/gif: use internal/byteorder
apocelipes [Sat, 11 May 2024 13:13:19 +0000 (13:13 +0000)]
image/gif: use internal/byteorder

Change-Id: Ic00e63aa35bcea4c97a5885d61edb8fc37d84e22
GitHub-Last-Rev: 1ad3a5d0edebbd0f0b98ce68ad81ea4c36f5a63d
GitHub-Pull-Request: golang/go#67324
Reviewed-on: https://go-review.googlesource.com/c/go/+/584997
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: Dmitri Shuralyov <dmitshur@google.com>
11 months agoencoding/csv: clarify that Writer uses different line break than RFC 4180 by default
nobishino [Mon, 13 May 2024 21:31:18 +0000 (21:31 +0000)]
encoding/csv: clarify that Writer uses different line break than RFC 4180 by default

Package documentation of encoding/csv says:

> this package supports the format described in RFC 4180.

According to section 2 of RFC 4180:

> Each record is located on a separate line, delimited by a line break (CRLF).

On the other hand, Writer uses LF (not CRLF) as newline character by default.

> If [Writer.UseCRLF] is true, the Writer ends each output line with \r\n instead of \n.

Strictly speaking, this behavior is different from RFC 4180.
Package documentation would improve if we clarify that point.

Change-Id: I120e9332b593e1ac9ed8e49f6f8419ea88efc57d
GitHub-Last-Rev: 489167eb04331fa5c623f3da9041a9d34aa258ae
GitHub-Pull-Request: golang/go#67290
Reviewed-on: https://go-review.googlesource.com/c/go/+/584835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
11 months agomath/rand/v2, math/big: use internal/byteorder
Mateusz Poliwczak [Sat, 11 May 2024 06:59:46 +0000 (06:59 +0000)]
math/rand/v2, math/big: use internal/byteorder

Change-Id: Id07f16d14133ee539bc2880b39641c42418fa6e2
GitHub-Last-Rev: 7b327d508f677f2476d24f046d25921f4599dd9a
GitHub-Pull-Request: golang/go#67319
Reviewed-on: https://go-review.googlesource.com/c/go/+/585016
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
11 months agofmt, internal/fmtsort: refactor SortedMap to use slice of structs for map sorting
aimuz [Fri, 10 May 2024 09:23:24 +0000 (09:23 +0000)]
fmt, internal/fmtsort: refactor SortedMap to use slice of structs for map sorting

This change refactors the SortedMap type in the fmtsort package from using
two parallel slices for keys and values to a single slice of structs. This
improves code clarity and reduces the complexity of handling map entries.
Affected files and their respective functions have been updated to work
with the new structure, including adjustments in fmt/print.go and
text/template/exec.go to iterate over the new map representation.

goos: darwin
goarch: arm64
pkg: fmt
cpu: Apple M2 Max
                                 â”‚   old.txt    â”‚               new.txt                â”‚
                                 â”‚    sec/op    â”‚    sec/op     vs base                â”‚
SprintfPadding-12                  21.29n Â±  5%   20.89n Â±  8%        ~ (p=0.393 n=10)
SprintfEmpty-12                    2.986n Â±  4%   2.997n Â± 10%        ~ (p=0.697 n=10)
SprintfString-12                   8.327n Â±  9%   8.493n Â± 12%        ~ (p=0.579 n=10)
SprintfTruncateString-12           15.93n Â± 10%   15.56n Â± 10%        ~ (p=0.853 n=10)
SprintfTruncateBytes-12            14.56n Â± 12%   14.13n Â± 11%        ~ (p=0.796 n=10)
SprintfSlowParsingPath-12          9.026n Â± 15%   9.511n Â± 14%        ~ (p=0.646 n=10)
SprintfQuoteString-12              40.88n Â±  3%   40.73n Â±  1%        ~ (p=0.782 n=10)
SprintfInt-12                      6.279n Â±  7%   6.130n Â±  6%        ~ (p=0.218 n=10)
SprintfIntInt-12                   11.08n Â± 10%   11.37n Â± 10%        ~ (p=0.424 n=10)
SprintfPrefixedInt-12              31.24n Â±  3%   31.21n Â±  2%        ~ (p=0.912 n=10)
SprintfFloat-12                    13.96n Â±  7%   13.99n Â± 15%        ~ (p=0.986 n=10)
SprintfComplex-12                  49.16n Â±  7%   50.57n Â±  6%        ~ (p=0.436 n=10)
SprintfBoolean-12                  7.578n Â± 15%   7.267n Â± 11%        ~ (p=0.529 n=10)
SprintfHexString-12                36.14n Â±  2%   35.74n Â±  1%        ~ (p=0.118 n=10)
SprintfHexBytes-12                 48.74n Â±  1%   48.34n Â±  4%        ~ (p=0.128 n=10)
SprintfBytes-12                    60.16n Â±  3%   61.36n Â±  5%        ~ (p=0.218 n=10)
SprintfStringer-12                 39.02n Â± 10%   39.31n Â±  9%        ~ (p=0.739 n=10)
SprintfStructure-12                161.2n Â±  1%   133.9n Â±  4%  -16.90% (p=0.000 n=10)
ManyArgs-12                        31.87n Â± 17%   33.00n Â± 12%        ~ (p=0.165 n=10)
FprintInt-12                       32.32n Â±  0%   33.13n Â±  1%   +2.49% (p=0.000 n=10)
FprintfBytes-12                    47.31n Â±  0%   47.99n Â±  1%   +1.44% (p=0.000 n=10)
FprintIntNoAlloc-12                32.05n Â±  1%   33.12n Â±  0%   +3.34% (p=0.000 n=10)
ScanInts-12                        130.5µ Â±  1%   131.3µ Â±  0%   +0.57% (p=0.000 n=10)
ScanRecursiveInt-12                40.83m Â±  1%   40.65m Â±  2%        ~ (p=0.353 n=10)
ScanRecursiveIntReaderWrapper-12   40.77m Â±  2%   40.83m Â±  2%        ~ (p=0.971 n=10)
geomean                            100.6n         100.3n         -0.32%

                                 â”‚    old.txt     â”‚                new.txt                 â”‚
                                 â”‚      B/op      â”‚     B/op      vs base                  â”‚
SprintfPadding-12                    16.00 Â± 0%       16.00 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfEmpty-12                      0.000 Â± 0%       0.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfString-12                     5.000 Â± 0%       5.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfTruncateString-12             16.00 Â± 0%       16.00 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfTruncateBytes-12              16.00 Â± 0%       16.00 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfSlowParsingPath-12            5.000 Â± 0%       5.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfQuoteString-12                32.00 Â± 0%       32.00 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfInt-12                        0.000 Â± 0%       0.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfIntInt-12                     3.000 Â± 0%       3.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfPrefixedInt-12                64.00 Â± 0%       64.00 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfFloat-12                      8.000 Â± 0%       8.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfComplex-12                    24.00 Â± 0%       24.00 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfBoolean-12                    4.000 Â± 0%       4.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfHexString-12                  80.00 Â± 0%       80.00 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfHexBytes-12                   104.0 Â± 0%       104.0 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfBytes-12                      88.00 Â± 0%       88.00 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfStringer-12                   32.00 Â± 0%       32.00 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfStructure-12                  216.0 Â± 0%       168.0 Â± 0%  -22.22% (p=0.000 n=10)
ManyArgs-12                          0.000 Â± 0%       0.000 Â± 0%        ~ (p=1.000 n=10) Â¹
FprintInt-12                         0.000 Â± 0%       0.000 Â± 0%        ~ (p=1.000 n=10) Â¹
FprintfBytes-12                      24.00 Â± 0%       24.00 Â± 0%        ~ (p=1.000 n=10) Â¹
FprintIntNoAlloc-12                  0.000 Â± 0%       0.000 Â± 0%        ~ (p=1.000 n=10) Â¹
ScanInts-12                        14.87Ki Â± 0%     14.87Ki Â± 0%        ~ (p=1.000 n=10) Â¹
ScanRecursiveInt-12                16.37Ki Â± 0%     16.34Ki Â± 9%        ~ (p=0.950 n=10)
ScanRecursiveIntReaderWrapper-12   16.43Ki Â± 8%     16.35Ki Â± 0%        ~ (p=0.052 n=10)
geomean                                         Â²                  -1.03%                Â²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                 â”‚    old.txt    â”‚                new.txt                â”‚
                                 â”‚   allocs/op   â”‚  allocs/op   vs base                  â”‚
SprintfPadding-12                   1.000 Â± 0%      1.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfEmpty-12                     0.000 Â± 0%      0.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfString-12                    1.000 Â± 0%      1.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfTruncateString-12            1.000 Â± 0%      1.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfTruncateBytes-12             1.000 Â± 0%      1.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfSlowParsingPath-12           1.000 Â± 0%      1.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfQuoteString-12               1.000 Â± 0%      1.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfInt-12                       0.000 Â± 0%      0.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfIntInt-12                    1.000 Â± 0%      1.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfPrefixedInt-12               1.000 Â± 0%      1.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfFloat-12                     1.000 Â± 0%      1.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfComplex-12                   1.000 Â± 0%      1.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfBoolean-12                   1.000 Â± 0%      1.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfHexString-12                 1.000 Â± 0%      1.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfHexBytes-12                  2.000 Â± 0%      2.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfBytes-12                     2.000 Â± 0%      2.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfStringer-12                  4.000 Â± 0%      4.000 Â± 0%        ~ (p=1.000 n=10) Â¹
SprintfStructure-12                 8.000 Â± 0%      6.000 Â± 0%  -25.00% (p=0.000 n=10)
ManyArgs-12                         0.000 Â± 0%      0.000 Â± 0%        ~ (p=1.000 n=10) Â¹
FprintInt-12                        0.000 Â± 0%      0.000 Â± 0%        ~ (p=1.000 n=10) Â¹
FprintfBytes-12                     1.000 Â± 0%      1.000 Â± 0%        ~ (p=1.000 n=10) Â¹
FprintIntNoAlloc-12                 0.000 Â± 0%      0.000 Â± 0%        ~ (p=1.000 n=10) Â¹
ScanInts-12                        1.590k Â± 0%     1.590k Â± 0%        ~ (p=1.000 n=10) Â¹
ScanRecursiveInt-12                1.592k Â± 0%     1.592k Â± 0%        ~ (p=0.303 n=10)
ScanRecursiveIntReaderWrapper-12   1.594k Â± 0%     1.594k Â± 0%        ~ (p=0.582 n=10)
geomean                                        Â²                 -1.14%                Â²
¹ all samples are equal
² summaries must be >0 to compute geomean

Change-Id: I2e850d827d2fd7d6618db60f7071977af5639032
GitHub-Last-Rev: 5a4afcf045331c6864902e848ededc1562d5fa53
GitHub-Pull-Request: golang/go#67256
Reviewed-on: https://go-review.googlesource.com/c/go/+/584155
Reviewed-by: Dmitri Shuralyov <dmitshur@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: qiu laidongfeng2 <2645477756@qq.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Auto-Submit: Ian Lance Taylor <iant@google.com>

11 months agoencoding/binary: simplify encoder.value
Lorenz Bauer [Tue, 16 Apr 2024 08:15:41 +0000 (09:15 +0100)]
encoding/binary: simplify encoder.value

Remove some duplicate type switching from encoder.value. reflect.Uint and
reflect.Int don't have a case statement anymore, but since they aren't valid
types there is no change in semantics.

goos: darwin
goarch: arm64
pkg: encoding/binary
cpu: Apple M1 Pro
                            â”‚   base.txt   â”‚            simplify.txt             â”‚
                            â”‚    sec/op    â”‚    sec/op     vs base               â”‚
ReadSlice1000Int32s-10         2.649µ Â± 1%    2.645µ Â± 0%        ~ (p=0.069 n=6)
ReadStruct-10                  204.8n Â± 2%    199.9n Â± 0%   -2.39% (p=0.002 n=6)
WriteStruct-10                 185.6n Â± 2%    154.0n Â± 0%  -17.03% (p=0.002 n=6)
WriteSlice1000Structs-10       157.9µ Â± 1%    125.0µ Â± 0%  -20.86% (p=0.002 n=6)
ReadSlice1000Structs-10        162.6µ Â± 2%    159.3µ Â± 0%        ~ (p=0.065 n=6)
ReadInts-10                    159.7n Â± 1%    156.7n Â± 0%   -1.88% (p=0.002 n=6)
WriteInts-10                   134.2n Â± 0%    134.1n Â± 0%   -0.11% (p=0.011 n=6)
WriteSlice1000Int32s-10        2.680µ Â± 0%    2.680µ Â± 0%        ~ (p=0.955 n=6)
PutUint16-10                  0.6253n Â± 2%   0.6211n Â± 0%   -0.67% (p=0.013 n=6)
AppendUint16-10                1.417n Â± 2%    1.413n Â± 0%        ~ (p=0.065 n=6)
PutUint32-10                  0.6210n Â± 0%   0.6210n Â± 0%        ~ (p=0.835 n=6)
AppendUint32-10                1.414n Â± 0%    1.414n Â± 0%        ~ (p=1.000 n=6)
PutUint64-10                  0.6210n Â± 0%   0.6212n Â± 0%        ~ (p=0.260 n=6)
AppendUint64-10                1.414n Â± 1%    1.417n Â± 0%        ~ (p=0.097 n=6)
LittleEndianPutUint16-10      0.6236n Â± 0%   0.6238n Â± 0%        ~ (p=0.426 n=6)
LittleEndianAppendUint16-10    1.419n Â± 0%    1.421n Â± 1%        ~ (p=0.054 n=6)
LittleEndianPutUint32-10      0.6236n Â± 0%   0.6239n Â± 0%        ~ (p=0.457 n=6)
LittleEndianAppendUint32-10    1.421n Â± 3%    1.421n Â± 0%        ~ (p=1.000 n=6)
LittleEndianPutUint64-10      0.6242n Â± 1%   0.6239n Â± 0%        ~ (p=0.372 n=6)
LittleEndianAppendUint64-10    1.421n Â± 0%    1.421n Â± 0%        ~ (p=1.000 n=6)
ReadFloats-10                  39.39n Â± 0%    39.35n Â± 0%   -0.10% (p=0.026 n=6)
WriteFloats-10                 33.64n Â± 0%    33.65n Â± 0%        ~ (p=0.297 n=6)
ReadSlice1000Float32s-10       2.661µ Â± 0%    2.664µ Â± 0%        ~ (p=0.916 n=6)
WriteSlice1000Float32s-10      2.763µ Â± 0%    2.758µ Â± 2%        ~ (p=0.225 n=6)
ReadSlice1000Uint8s-10         129.5n Â± 2%    129.5n Â± 2%        ~ (p=0.485 n=6)
WriteSlice1000Uint8s-10        144.4n Â± 4%    146.1n Â± 2%        ~ (p=0.065 n=6)
PutUvarint32-10                12.12n Â± 0%    12.12n Â± 2%        ~ (p=0.933 n=6)
PutUvarint64-10                30.75n Â± 0%    31.29n Â± 1%   +1.76% (p=0.002 n=6)
geomean                        33.44n         32.89n        -1.65%

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

11 months agosyscall: don't change local limit if prlimit used for another process
lifubang [Fri, 10 May 2024 03:29:45 +0000 (03:29 +0000)]
syscall: don't change local limit if prlimit used for another process

Fixes: #67184
Change-Id: Ibdf3810cbba30ae29f466f7f95f357e8512f228b
GitHub-Last-Rev: 5eabc760be6b89ae85629627da37b517e8ec356f
GitHub-Pull-Request: golang/go#67185
Reviewed-on: https://go-review.googlesource.com/c/go/+/583299
Reviewed-by: Ian Lance Taylor <iant@google.com>
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>

11 months agocmd/go: add module information to vet actions
Tim King [Thu, 18 Apr 2024 20:48:18 +0000 (13:48 -0700)]
cmd/go: add module information to vet actions

Update golang/go#66315

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

11 months agocrypto: replace encoding/binary in favour of internal/byteorder
Mateusz Poliwczak [Sat, 11 May 2024 09:37:50 +0000 (09:37 +0000)]
crypto: replace encoding/binary in favour of internal/byteorder

Updates #54097

Change-Id: I827a5efd1736ce057b76f079466f2d9ead225898
GitHub-Last-Rev: 40af10469d85ce9f4bef4b40025589d9e44f43d6
GitHub-Pull-Request: golang/go#67321
Reviewed-on: https://go-review.googlesource.com/c/go/+/585017
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
11 months agocmd/cgo, cmd/go: add cgo -ldflags option, use it in cmd/go
Ian Lance Taylor [Thu, 9 May 2024 22:19:38 +0000 (15:19 -0700)]
cmd/cgo, cmd/go: add cgo -ldflags option, use it in cmd/go

This will automatically use a response file if ldflags is long,
avoiding "argument list too long" errors with a very large CGO_LDFLAGS.

Fixes #66456

Change-Id: I5f9ee86e03b4e6d6430f7f9d8357ef37a9c22465
Reviewed-on: https://go-review.googlesource.com/c/go/+/584655
Reviewed-by: Michael Matloob <matloob@golang.org>
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>

11 months agoruntime: use frame pointer unwinding for block and mutex profilers
Nick Ripley [Fri, 6 Oct 2023 17:02:40 +0000 (13:02 -0400)]
runtime: use frame pointer unwinding for block and mutex profilers

Use frame pointer unwinding, where supported, to collect call stacks for
the block, and mutex profilers. This method of collecting call stacks is
typically an order of magnitude faster than callers/tracebackPCs. The
marginal benefit for these profile types is likely small compared to
using frame pointer unwinding for the execution tracer. However, the
block profiler can have noticeable overhead unless the sampling rate is
very high. Additionally, using frame pointer unwinding in more places
helps ensure more testing/support, which benefits systems like the
execution tracer which rely on frame pointer unwinding to be practical
to use.

Change-Id: I4b36c90cd2df844645fd275a41b247352d635727
Reviewed-on: https://go-review.googlesource.com/c/go/+/533258
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
11 months agoruntime: refactor fpunwindExpand to use provided buffer
Nick Ripley [Mon, 20 Nov 2023 01:01:57 +0000 (20:01 -0500)]
runtime: refactor fpunwindExpand to use provided buffer

fpunwindExpand currently allocates a new slice to hold the expanded call
stack. In each place it's used, the resulting slice won't be needed
immediately afterward, so the allocation is wasteful. Refactor
fpunwindExpand to instead expand the call stack into a provided buffer.

Change-Id: I05b26c191a8f76404c21ccbe3bd422325540425b
Reviewed-on: https://go-review.googlesource.com/c/go/+/543715
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
11 months agonet/netip: use internal/byteorder
Mateusz Poliwczak [Sat, 11 May 2024 05:31:15 +0000 (05:31 +0000)]
net/netip: use internal/byteorder

This also as a side effect fixes #56136 because internal/byteorder
package has a special treatment in the inliner.

Fixes #56136

Change-Id: Ib90eb716f7a67659fb4cea7e99c14cf7e819ef7b
GitHub-Last-Rev: a78d8f6feef78f3f2fc28b2a52cf6374728ce537
GitHub-Pull-Request: golang/go#67317
Reviewed-on: https://go-review.googlesource.com/c/go/+/584995
Auto-Submit: 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>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
11 months agocmd/go: remove unused code
qiulaidongfeng [Sun, 28 Apr 2024 04:57:20 +0000 (04:57 +0000)]
cmd/go: remove unused code

Change-Id: I39e8533a646d171a84c1ef307915286213006543
GitHub-Last-Rev: 3c21684ad071ecf6c4e4bf93128131a9cd0e587d
GitHub-Pull-Request: golang/go#67090
Reviewed-on: https://go-review.googlesource.com/c/go/+/581938
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>

11 months agocmd/internal/obj/loong64: improve the definition of plan9 assembly format in optab
Guoqi Chen [Sun, 7 May 2023 22:20:21 +0000 (06:20 +0800)]
cmd/internal/obj/loong64: improve the definition of plan9 assembly format in optab

In the three formats corresponding to case 7 of the function asmout, BREAK actually
corresponds to the cacop instruction of Loong64, refer to the loong64 instruction
manual volume 1 [1], the cacop instruction is a privileged instruction used to
maintain the cache, and the user mode does not have permission to execute.

Referring to the loong64 instruction manual volume 1 [1], the SYSCALL, BREAK and DBAR
instructions have similar formats and can be grouped into one category, the RDTIMED,
RDTIMELW and RDTIMEHW instructions can be grouped into one category, and the NOOP and
UNDEF instructions can be grouped into one category.

[1]: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html

Change-Id: I0b8998270102d1557fc2b2410cf8c0b078bd0c2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/493435
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>

11 months agoall: delete loong64 non-register ABI fallback path
Guoqi Chen [Wed, 30 Aug 2023 09:49:55 +0000 (17:49 +0800)]
all: delete loong64 non-register ABI fallback path

Change-Id: If1d3eba9a922ac6f9d78301bb8f07e445c712899
Reviewed-on: https://go-review.googlesource.com/c/go/+/525576
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Commit-Queue: abner chenc <chenguoqi@loongson.cn>
Run-TryBot: abner chenc <chenguoqi@loongson.cn>

11 months agocmd: vendor golang.org/x/telemetry@51e8b5d
Michael Matloob [Fri, 10 May 2024 22:52:41 +0000 (18:52 -0400)]
cmd: vendor golang.org/x/telemetry@51e8b5d

Commands run
    go get golang.org/x/telemetry@51e8b5d
    go mod tidy
    go mod vendor

Change-Id: Ie11f207d25902c3ef932237eec66bdd586564fc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/584237
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
11 months agoruntime: remove unused code
qiulaidongfeng [Wed, 24 Apr 2024 12:03:56 +0000 (12:03 +0000)]
runtime: remove unused code

Change-Id: Ifb9864704f55e27adfa5c21452fed5a243468d13
GitHub-Last-Rev: 6b000e7314ea47eea6fead60988d6d432bc381f7
GitHub-Pull-Request: golang/go#67013
Reviewed-on: https://go-review.googlesource.com/c/go/+/581376
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 months agohash: use internal/byteorder
Mateusz Poliwczak [Sat, 11 May 2024 06:59:33 +0000 (06:59 +0000)]
hash: use internal/byteorder

Change-Id: I58c24a58a7b32d3f8d544509db04baac1ea1b56e
GitHub-Last-Rev: 7a648fda00ad30aa00d72013d9c6e22e207c31b2
GitHub-Pull-Request: golang/go#67318
Reviewed-on: https://go-review.googlesource.com/c/go/+/585015
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@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>
Reviewed-by: Keith Randall <khr@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com>

11 months agoruntime/internal/atomic: add mips operators for And/Or
Mauri de Souza Meneguzzo [Wed, 1 May 2024 14:33:11 +0000 (14:33 +0000)]
runtime/internal/atomic: add mips operators for And/Or

These primitives will be used by the new And/Or sync/atomic apis.

Implemented for mips/mipsle and mips64/mips64le.

For #61395

Change-Id: Icc604a2b5cdfe72646d47d3c6a0bb49a0fd0d353
GitHub-Last-Rev: 95dca2a9f144c5d96dfa53eaf116e88be5f55040
GitHub-Pull-Request: golang/go#63297
Reviewed-on: https://go-review.googlesource.com/c/go/+/531835
Reviewed-by: Cherry Mui <cherryyz@google.com>
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>

11 months agoruntime: add runtime.debugPinnerV1
Alessandro Arzilli [Wed, 24 Jan 2024 18:02:32 +0000 (19:02 +0100)]
runtime: add runtime.debugPinnerV1

Adds runtime.debugPinnerV1 which returns a runtime.Pinner object that
pins itself. This is intended to be used by debuggers in conjunction
with runtime.debugCall to keep heap memory reachable even if it isn't
referenced from anywhere else.

Change-Id: I508ee6a7b103e68df83c96f2e04a0599200300dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/558276
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
11 months agocmd/go/testdata/script: disable build_plugin_reproducible on darwin
Michael Matloob [Fri, 10 May 2024 22:43:45 +0000 (18:43 -0400)]
cmd/go/testdata/script: disable build_plugin_reproducible on darwin

It's broken with the latest XCode versions, and is also already disabled
on darwin builders. Disable the test to get go test cmd/go working on
local builds again.

For #64947

Change-Id: I5a4b46cf23cbe887df4903f90b54cd2225f51233
Reviewed-on: https://go-review.googlesource.com/c/go/+/584937
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
11 months agocmd/go/testdata/script: clear path in gotoolchain_issue66175
Michael Matloob [Fri, 10 May 2024 19:24:06 +0000 (15:24 -0400)]
cmd/go/testdata/script: clear path in gotoolchain_issue66175

The gotoolchain_issue66175 script test would fail if a binary named
go1.21 or go1.22 was present in the system PATH. Clear the path at the
beginning of the test to make it independent of the system path.

Fixes #67277

Change-Id: I6d9133aee5b20ab116e07b659e8ecf3eb8add4ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/584258
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
11 months agocmd/trace: pkg import only once
guoguangwu [Fri, 10 May 2024 05:20:09 +0000 (05:20 +0000)]
cmd/trace: pkg import only once

Change-Id: Iaaf2e9dbcffb4b1944817b0a4aaecd3554ebfec1
GitHub-Last-Rev: f4ec85a05e54c2f403cabc4c6458cd2f396e183d
GitHub-Pull-Request: golang/go#67280
Reviewed-on: https://go-review.googlesource.com/c/go/+/584695
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
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>
11 months agointernal/byteorder: new package
Mateusz Poliwczak [Fri, 10 May 2024 06:06:47 +0000 (06:06 +0000)]
internal/byteorder: new package

Currently in a lot of packages we define functions for appending/decoding
mostly BigEndian data (see internal/chacha8rand, net/netip,
internal/boring/sha, hash/crc64, and probably more), because we don't
want to depend on encoding/binary, because of #54097.

This change introduces a new package internal/byteorder, that
will allow us to remove all of the functions and replace them with
internal/byteorder.

Updates #54097

Change-Id: I03e5ea1eb721dd98bdabdb25786f889cc5de54c5
GitHub-Last-Rev: 3f07d3dfb453a9e679395711f9b93e25f9340a3b
GitHub-Pull-Request: golang/go#67183
Reviewed-on: https://go-review.googlesource.com/c/go/+/583298
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>

11 months agoslices: add Chunk
Matt Layher [Fri, 9 Feb 2024 15:34:58 +0000 (10:34 -0500)]
slices: add Chunk

Chunk returns an iterator over consecutive sub-slices of up to n elements of s.

Fixes #53987.

Change-Id: I508274eca388db39550eb9e4d8abd5ce68d29d8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/562935
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>
Auto-Submit: Ian Lance Taylor <iant@google.com>

11 months agonet/http/httptest: add comment to Server.Client() about Server.URL
Alireza Ghasemi [Thu, 9 May 2024 06:07:55 +0000 (06:07 +0000)]
net/http/httptest: add comment to Server.Client() about Server.URL

Updates #30774.

Change-Id: I9564f955b15c701bee27aa9fbf3972de8fdb55e4
GitHub-Last-Rev: 50bd6bd54ec4195ed9e09a4a2d69e386bf55b21f
GitHub-Pull-Request: golang/go#67037
Reviewed-on: https://go-review.googlesource.com/c/go/+/581777
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 months agocmd/compile, cmd/link: disallow linkname of some newly added internal functions
Cherry Mui [Thu, 9 May 2024 21:07:43 +0000 (17:07 -0400)]
cmd/compile, cmd/link: disallow linkname of some newly added internal functions

Go API is defined through exported symbols. When a package is
imported, the compiler ensures that only exported symbols can be
accessed, and the go command ensures that internal packages cannot
be imported. This ensures API integrity. But there is a hole:
using linkname, one can access internal or non-exported symbols.
Linkname is a mechanism to give access of a symbol to a package
without adding it to the public API. It is intended for coupled
packages to share some implementation details, or to break
circular dependencies, and both "push" (definition) and "pull"
(reference) sides are controlled, so they can be updated in sync.
Nevertheless, it is abused as a mechanism to reach into internal
details of other packages uncontrolled by the user, notably the
runtime. As the other package evolves, the code often breaks,
because the linknamed symbol may no longer exist, or change its
signature or semantics.

This CL adds a mechanism to enforce the integrity of linknames.
Generally, "push" linkname is allowed, as the package defining
the symbol explicitly opt in for access outside of the package.
"Pull" linkname is checked and only allowed in some circumstances.
Given that there are existing code that use "pull"-only linkname
to access other package's internals, disallowing it completely is
too much a change at this point in the release cycle. For a start,
implement a hard-coded blocklist, which contains some newly added
internal functions that, if used inappropriately, may break memory
safety or runtime integrity. All blocked symbols are newly added
in Go 1.23. So existing code that builds with Go 1.22 will
continue to build.

For the implementation, when compiling a package, we mark
linknamed symbols in the current package with an attribute. At
link time, marked linknamed symbols are checked against the
blocklist. Care is taken so it distinguishes a linkname reference
in the current package vs. a reference of a linkname from another
package and propagated to the current package (e.g. through
inlining or instantiation).

Symbol references in assembly code are similar to linknames, and
are treated similarly.

Change-Id: I8067efe29c122740cd4f1effd2dec2d839147d5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/584598
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
11 months agoruntime: crash asap and extend total sleep time for slow machine in test
zzkcode [Fri, 10 May 2024 14:51:01 +0000 (14:51 +0000)]
runtime: crash asap and extend total sleep time for slow machine in test

Running with few threads usually does not need 500ms to crash, so let it
crash as soon as possible. While the test may caused more time on slow
machine, try to expand the sleep time in test.

Updates #64752

Change-Id: I635fab846bd5e1735808d4d47bb9032d5a04cc2b
GitHub-Last-Rev: 84f3844ac0054a6a4b0e8ae13479a670e24ba8ce
GitHub-Pull-Request: golang/go#65018
Reviewed-on: https://go-review.googlesource.com/c/go/+/554615
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
11 months agoreflect: let Value.Seq iterate integer conform to the spec
qiulaidongfeng [Fri, 10 May 2024 08:38:42 +0000 (08:38 +0000)]
reflect: let Value.Seq iterate integer conform to the spec

See CL 557596, according to the go specification,
the iterated variable type should
be the same as the iterated integer type.

For #66056

Change-Id: I96c87440328c2c50c40d76ecf2f222a331be1ce9
GitHub-Last-Rev: 8f80e401e5d7e092290d94e2bfcac89f3e04c2c5
GitHub-Pull-Request: golang/go#67269
Reviewed-on: https://go-review.googlesource.com/c/go/+/584516
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
11 months agocmd/link/internal/ld: fix overlapping sections in ELF relro links
Than McIntosh [Thu, 9 May 2024 17:48:33 +0000 (17:48 +0000)]
cmd/link/internal/ld: fix overlapping sections in ELF relro links

This patch fixes a problem with how the .dynamic and .got sections are
handled during PIE linking on ELF targets. These sections were being
given addresses that overlapped with the .data.rel.ro section, which
resulted in binaries that worked correctly but confused the binutils
"strip" tool (which, confusingly, produced non-working stripped output
when used on Go PIE binaries without returning a non-zero exit
status). The new RELRO PIE code path preserves .dynamic and .got as
their own independent sections, while ensuring that they make it into
the RELRO segment. A new test verifies that we can successfully strip
and run Go PIE binaries, and also that we don't wind up with any
sections whose address ranges overlap.

Fixes #67261.
Updates #45681.

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

11 months agoos: change ioutil-test to os-test in test
guoguangwu [Thu, 9 May 2024 01:20:07 +0000 (01:20 +0000)]
os: change ioutil-test to os-test in test

Change-Id: I8c5c0831b94261c5880ca22b7ea52cce034d88f1
GitHub-Last-Rev: 5fd119d4e8e5f98690afb2d966c07aea19415db0
GitHub-Pull-Request: golang/go#67248
Reviewed-on: https://go-review.googlesource.com/c/go/+/583876
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
11 months agocmd/dist: don't copy files ending in ~ to bootstrap directory
Ian Lance Taylor [Thu, 9 May 2024 22:28:23 +0000 (15:28 -0700)]
cmd/dist: don't copy files ending in ~ to bootstrap directory

They are editor backup files. They are ignored by .gitignore,
so they can never be real files in the Go repo.

Change-Id: I58800e6e9f939e0bd21b086243b9260bcc8cd770
Reviewed-on: https://go-review.googlesource.com/c/go/+/584675
Reviewed-by: Than McIntosh <thanm@google.com>
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@golang.org>

11 months agoreflect: improved ifaceIndir comment
Ian Lance Taylor [Thu, 9 May 2024 23:08:49 +0000 (16:08 -0700)]
reflect: improved ifaceIndir comment

Change-Id: Ic88ef6b60b5a772865603971411fd5d37ef45006
Reviewed-on: https://go-review.googlesource.com/c/go/+/584656
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@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: Dmitri Shuralyov <dmitshur@golang.org>
11 months agocrypto/x509: reject critical AKI
Roland Shoemaker [Wed, 7 Feb 2024 20:10:58 +0000 (12:10 -0800)]
crypto/x509: reject critical AKI

Updates #65085

Change-Id: I8cc60990737d582edf4f7f85ec871f5e42f82b78
Reviewed-on: https://go-review.googlesource.com/c/go/+/562341
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
11 months agoreflect: restore ifaceIndir function for now
Ian Lance Taylor [Thu, 9 May 2024 22:40:34 +0000 (15:40 -0700)]
reflect: restore ifaceIndir function for now

CL 583755 removed all uses of the ifaceIndir function,
and the function itself. Unfortunately, ifaceIndir is accessed
using go:linkname by the popular github.com/goccy/go-json package.
A bug has been filed to fix this upstream:
https://github.com/goccy/go-json/issues/506
Until that bug is fixed and the fix is distributed,
keep this function available.
With luck we can remove this in the 1.24 release.

For #67279

Change-Id: I15fccf82d7a172a0b15cdbefb0a0a48381998938
Reviewed-on: https://go-review.googlesource.com/c/go/+/584676
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
11 months agocrypto/x509: reject critical SKI extensions
Roland Shoemaker [Wed, 7 Feb 2024 21:05:59 +0000 (13:05 -0800)]
crypto/x509: reject critical SKI extensions

Updates #65085

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

11 months agocrypto/x509: reject critical AIA extensions
Roland Shoemaker [Wed, 7 Feb 2024 20:12:14 +0000 (12:12 -0800)]
crypto/x509: reject critical AIA extensions

Updates #65085

Change-Id: I86d8a85130286e1ec2aca3249808ec1dc8ec97ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/562342
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
11 months agocrypto/x509: properly reject invalid DNS names when checking constraints
Roland Shoemaker [Mon, 5 Feb 2024 21:12:51 +0000 (13:12 -0800)]
crypto/x509: properly reject invalid DNS names when checking constraints

A DNS name prefixed with an empty label should be considered invalid
when checking constraints (i.e. ".example.com" does not satisfy a
constraint of "example.com").

Updates #65085

Change-Id: I42919dc06abedc0e242ff36b2a42b583b14857b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/561615
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 months agoreflect: clarify documentation for Value.Seq/Seq2
qiulaidongfeng [Thu, 9 May 2024 22:04:57 +0000 (22:04 +0000)]
reflect: clarify documentation for Value.Seq/Seq2

For #66056

Change-Id: Ib47c07b2527d8213584b72e2575a353f2deaed68
GitHub-Last-Rev: 525a5c3fa469fcccfb1ab67b61c7d12e024cfb33
GitHub-Pull-Request: golang/go#67268
Reviewed-on: https://go-review.googlesource.com/c/go/+/584515
Reviewed-by: Cherry Mui <cherryyz@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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
11 months agoruntime: add workaround to "throw" pending resolution of issue #67274
Than McIntosh [Thu, 9 May 2024 20:02:30 +0000 (20:02 +0000)]
runtime: add workaround to "throw" pending resolution of issue #67274

Temporarily mark the function runtime.throw as "go:noinline" for the
time being to work around problems introduced by CL 581215. We do not
ordinarily inline runtime.throw unless the build is beind done with an
elevated inline budget (e.g. "-gcflags=-l=4"), so this change should
only have an effect for those special builds.

Updates #67274.

Change-Id: I3811913b8d441e0ddb1d4c7d7297ef23555582a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/584616
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
11 months agocmd: vendor golang.org/x/mod@6686f41
Michael Matloob [Wed, 8 May 2024 17:14:51 +0000 (13:14 -0400)]
cmd: vendor golang.org/x/mod@6686f41

To pull in CL 583836

Commands run
    go get golang.org/x/mod@6686f416970d4b8e2f54f521955dee89e6763c4b
    go mod tidy
    go mod vendor

For #67238
For #66625

Change-Id: I77e49706481e068d27072a38d0d2464aa40d2dd0
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/584335
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 months agoslices: add iterator-related functions
Ian Lance Taylor [Sat, 2 Mar 2024 01:40:50 +0000 (17:40 -0800)]
slices: add iterator-related functions

Fixes #61899

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

11 months agocmd/link: Add missing platform for Mac Catalyst
CP Lepage [Tue, 7 May 2024 12:35:25 +0000 (12:35 +0000)]
cmd/link: Add missing platform for Mac Catalyst

Fixes #67175

Defines a MachoPlatorm constant in OS_Darwin for MacCatalyst build. This enables adding the suffix $INODE64 on syscall methods needed for amd64 Darwin platform.

Change-Id: Ie677e241599e2a14359c5809fa9ddb3b63161629
GitHub-Last-Rev: feae982e682d5b0479fe1c7eccdc423dc4bf2ea4
GitHub-Pull-Request: golang/go#67176
Reviewed-on: https://go-review.googlesource.com/c/go/+/583295
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
11 months agonet/http: remove misleading response headers on error
Russ Cox [Fri, 15 Mar 2024 16:56:23 +0000 (12:56 -0400)]
net/http: remove misleading response headers on error

This is a reapply of CL 544019 and CL 569815, but with
less aggressive semantics as discussed in proposal #66343.

Error deletes Content-Encoding, since it is writing the response
and any preset encoding may not be correct.

On the error-serving path in ServeContent/ServeFile/ServeFS,
these functions delete additional headers: Etag, Last-Modified,
and Cache-Control. The caller may have set these intending
them for the success response, and they may well not be correct
for error responses.

Fixes #50905.
Fixes #66343.

Change-Id: I873d33edde1805990ca16d85ea8d7735b7448626
Reviewed-on: https://go-review.googlesource.com/c/go/+/571995
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>