1
0
mirror of https://github.com/golang/go synced 2024-11-25 13:47:57 -07:00
Commit Graph

61165 Commits

Author SHA1 Message Date
qiu laidongfeng2
1646f725bb Revert "cmd/go: relax the regular expression of TestScript/list_pkgconfig_error"
This reverts commit 906338f82f.

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>
2024-09-27 17:54:19 +00:00
Robert Griesemer
de46eaadb5 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>
2024-09-27 17:31:05 +00:00
Robert Griesemer
5fe3b31cf8 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>
2024-09-27 16:45:09 +00:00
Xiaolin Zhao
0a8dea10ce 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>
2024-09-27 15:45:19 +00:00
Mark Ryan
6a730e1ef0 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>
2024-09-27 00:32:20 +00:00
Shulhan
ff695ca2e3 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>
2024-09-27 00:25:54 +00:00
Ian Lance Taylor
2ebaff4890 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>
2024-09-26 22:39:10 +00:00
Ian Lance Taylor
3587430899 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>
2024-09-26 20:34:56 +00:00
qiulaidongfeng
712d47ce15 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>
2024-09-26 20:17:24 +00:00
Michael Anthony Knyszek
b7e4d2067c 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>
2024-09-26 20:13:15 +00:00
Michael Anthony Knyszek
1596a6c8ec 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>
2024-09-26 20:13:12 +00:00
apocelipes
3f2737f5dd net/http: use sync.OnceFunc, sync.OnceValue
Use sync.OnceFunc and sync.OnceValue to simplify the code.

Change-Id: Ie47e0444c2b9d3260f6ef94cdc6ee8ee5bcf9f71
GitHub-Last-Rev: 520afbec2a
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>
2024-09-26 19:49:02 +00:00
apocelipes
9ace960d54 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: f796c49260
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>
2024-09-26 19:48:18 +00:00
Jes Cok
ca3b1b13de cmd/cgo: add missing args for fatalf
Change-Id: I56b40a9d2ff85fdbc0d170aec686f1868176e068
GitHub-Last-Rev: 9424faf0f8
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>
2024-09-26 19:42:59 +00:00
aimuz
ca1123f9c5 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: dc5f836cc7
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>
2024-09-26 17:06:55 +00:00
Jason A. Donenfeld
ba42120723 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>
2024-09-26 16:51:09 +00:00
zhangjian
4aa5aa63c9 cmd/link/internal/ld: fix error print in decodetypeGcprog
Change-Id: Ifbd33881280d88c00df9b2c4e20f0127aca55799
GitHub-Last-Rev: 5b42bc612c
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>
2024-09-26 14:47:19 +00:00
Alan Donovan
9b1f8f32b8 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>
2024-09-26 14:28:38 +00:00
qiulaidongfeng
906338f82f cmd/go: relax the regular expression of TestScript/list_pkgconfig_error
Fixes #68283

Change-Id: Ia6af550f0fc232e4ae6f7ea96370138e958aaca2
GitHub-Last-Rev: 206ce8b0d9
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>
2024-09-26 14:01:59 +00:00
Cuong Manh Le
6d856a804c 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>
2024-09-26 13:18:08 +00:00
cions
a3a05ed04c 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: aad6b3b32c
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>
2024-09-26 13:17:09 +00:00
qiulaidongfeng
607975cfa1 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: 425cd7f03c
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>
2024-09-26 13:17:04 +00:00
Jason A. Donenfeld
80143607f0 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>
2024-09-25 23:56:00 +00:00
Brad Fitzpatrick
3d6173aa12 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>
2024-09-25 23:15:26 +00:00
Sam Thanawalla
7d91cc26ab 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>
2024-09-25 20:32:14 +00:00
Roland Shoemaker
8ed18d2cef 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>
2024-09-25 20:04:01 +00:00
Felix Geisendörfer
49e542aa85 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>
2024-09-25 17:31:06 +00:00
Felix Geisendörfer
c64ca8c6ef 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>
2024-09-25 17:30:33 +00:00
Conrad Irwin
8c8948c375 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>
2024-09-25 16:24:10 +00:00
Tim King
4a1167dfe1 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>
2024-09-25 16:22:13 +00:00
Keith Randall
6cb107452a 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>
2024-09-25 15:13:19 +00:00
Robert Griesemer
b17a55d095 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>
2024-09-24 23:20:50 +00:00
Robert Griesemer
681751a1fe 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>
2024-09-24 23:20:47 +00:00
Zxilly
d39b366841 runtime: disable epipe check for wasm platform
Pipe operation seems impossible for wasm build

Fixes #59099

Change-Id: Ibb526693dce4e867dabd92e5ace38a1adf18f401
GitHub-Last-Rev: d7dc336271
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>
2024-09-24 21:08:12 +00:00
khr@golang.org
944a2ac3c7 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>
2024-09-24 21:02:34 +00:00
khr@golang.org
be86f09e01 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>
2024-09-24 21:02:31 +00:00
khr@golang.org
b92f3f29c1 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>
2024-09-24 21:02:28 +00:00
Robert Griesemer
1e5a72e980 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>
2024-09-24 20:35:14 +00:00
Robert Griesemer
5a1de4ed34 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>
2024-09-24 20:28:36 +00:00
Conrad Irwin
68bcef7e9f 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>
2024-09-24 19:51:22 +00:00
Robert Griesemer
03fecda02b 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>
2024-09-24 18:31:44 +00:00
Conrad Irwin
2f24fdde4e 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>
2024-09-24 17:47:41 +00:00
Robert Griesemer
e3cbda934c 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>
2024-09-24 17:44:11 +00:00
Sam Thanawalla
43cf73186b 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>
2024-09-24 17:10:31 +00:00
Jes Cok
83fbd0a37b 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>
2024-09-24 15:45:23 +00:00
Paul E. Murphy
bc047b62b2 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>
2024-09-23 18:27:32 +00:00
apocelipes
a92c80eb40 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: 5d27854725
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>
2024-09-23 18:10:51 +00:00
Jes Cok
c9ad32bd9f 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>
2024-09-23 18:05:24 +00:00
yincong
7d114b5b71 text/template/parse: use correct line number in error after comment
Fixes #69526

Change-Id: I42467ddec02e91f24bce87185bf8d7f16f8811b0
GitHub-Last-Rev: 039a5b6884
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>
2024-09-23 18:02:15 +00:00
wanggang
530fbb283c 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: a0d93b6e9d
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>
2024-09-23 18:01:36 +00:00