1
0
mirror of https://github.com/golang/go synced 2024-11-15 09:20:58 -07:00
Commit Graph

60071 Commits

Author SHA1 Message Date
qiulaidongfeng
c3dff93a8c strconv: use stringslite.Clone
Change-Id: Ifa3c022ad5453301573593a3d05e7b1d42b931ff
GitHub-Last-Rev: a7468b068b
GitHub-Pull-Request: golang/go#67167
Reviewed-on: https://go-review.googlesource.com/c/go/+/583215
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
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>
Auto-Submit: Keith Randall <khr@golang.org>
2024-05-05 00:24:26 +00:00
qiulaidongfeng
a80543a987 time: use stringslite.Clone
Change-Id: I82f0e7c0c0c80a3cc0e4a732a59ae1debb37d8d9
GitHub-Last-Rev: c8a081f5b3
GitHub-Pull-Request: golang/go#67166
Reviewed-on: https://go-review.googlesource.com/c/go/+/583195
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-05 00:24:24 +00:00
qiulaidongfeng
4dccb78582 unique: use stringslite.Clone
Change-Id: Icb1ba7df1f0414090632e663b6a92b492546070d
GitHub-Last-Rev: 5169d26813
GitHub-Pull-Request: golang/go#67092
Reviewed-on: https://go-review.googlesource.com/c/go/+/581940
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-05-05 00:24:21 +00:00
Joel Sing
20130cc36a syscall: remove references to SYS_syscall on openbsd
OpenBSD 7.5 no longer has a syscall symbol in libc. This will
typically result in external linking failures since the syscall
package still has a reference to an undefined `syscall' symbol.
Remove these references and return ENOSYS if syscall.Syscall* or
syscall.RawSyscall* are used for a system call number that does not
currently have an internal remapping.

Fixes #63900

Change-Id: Ic757bf8872ad98a92dd5b34cf58312c32fbc9a96
Reviewed-on: https://go-review.googlesource.com/c/go/+/582257
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-05-04 07:51:20 +00:00
Joel Sing
8841f50d98 syscall: reroute SYS_IOCTL and SYS_SYSCTL on openbsd
OpenBSD 7.5 no longer supports indirect syscalls. A number of Go
packages make use of syscall.Syscall with SYS_IOCTL or SYS_SYSCTL,
since neither is well supported by golang.org/x/sys/unix. Reroute
calls with either of these system call numbers to the respective
libc stub so that they continue to work.

Updates #63900

Change-Id: I3323a3fa311ee9227e6220417834253763866881
Reviewed-on: https://go-review.googlesource.com/c/go/+/582256
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-04 07:50:55 +00:00
Joel Sing
17fce63239 cmd/dist,internal/platform: temporarily disable race detector on openbsd/amd64
Unfortunately, LLVM TSAN decided to remove OpenBSD support, which
means that the syso files cannot currently be regenerated (see #52090).
The race_openbsd.syso contains a reference to the syscall symbol,
which has been removed from OpenBSD's libc in 7.5. As such, this
means that the race detector no longer works on openbsd/amd64 (at
least until LLVM TSAN support is reinstated for OpenBSD).

Updates #63900

Change-Id: I3474fc43a94e5197815862b7dc420b71d5e08815
Reviewed-on: https://go-review.googlesource.com/c/go/+/582255
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-04 07:50:22 +00:00
qiulaidongfeng
ae6af9b3d8 strings: move Clone to stringslite
Follow-up CL help package like unique use Clone.

Change-Id: Ie64adf7e1a331f47c3cfe178c368d72fc72493ff
GitHub-Last-Rev: 499476cc4a
GitHub-Pull-Request: golang/go#67106
Reviewed-on: https://go-review.googlesource.com/c/go/+/581956
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>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-05-04 01:23:42 +00:00
Paul E. Murphy
7994da4cc1 cmd/compile/internal/ssa: on PPC64, try combining CLRLSLDI and SRDconst into RLWINM
This provides a small performance bump to crc64 as measured on ppc64le/power10:

name              old time/op    new time/op    delta
Crc64/ISO64KB       49.6µs ± 0%    46.6µs ± 0%  -6.18%
Crc64/ISO4KB        3.16µs ± 0%    2.97µs ± 0%  -5.83%
Crc64/ISO1KB         840ns ± 0%     794ns ± 0%  -5.46%
Crc64/ECMA64KB      49.6µs ± 0%    46.5µs ± 0%  -6.20%
Crc64/Random64KB    53.1µs ± 0%    49.9µs ± 0%  -6.04%
Crc64/Random16KB    15.9µs ± 1%    15.0µs ± 0%  -5.73%

Change-Id: I302b5431c7dc46dfd2d211545c483bdcdfe011f1
Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9,gotip-linux-ppc64le_power10
Reviewed-on: https://go-review.googlesource.com/c/go/+/581937
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-05-03 21:12:29 +00:00
Michael Matloob
99fc317948 cmd/go: add flag values to counter for buildmode
Usually, when we increment counters for flags, the counter only contains
the flag name. For the buildmode flag, we now include the flag value
because there's a limited set of values.

We can't use CountFlags directly anymore since we have different
behavior for buildmode.

Change-Id: I956a1a97d62850df3199b5514ad507ea51355c9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/582896
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
2024-05-03 19:05:42 +00:00
Michael Matloob
23f760fd58 cmd/go: remove checks that all counters incremented are in counters.txt
This change removes cmd/go/testdata/counters.txt. It also removes the
code that prepares it and checks that it contains all registered
counters as well as counters for all flags and subcommands. It removes
the counter registration mechanism, and uses telemetry.NewCounter to
create new counters instead. It keeps the tests that check that at least
one counter is incremented if the go command is invoked in a script test.

Change-Id: Ic6bda5c64e90f0dd7e221968fce0e375e84d6e17
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/582715
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
2024-05-03 18:15:22 +00:00
Russ Cox
7b5206bdf3 internal/bisect: use f.Function instead of f.Func.Name in stack trace
For inlined frames f.Func is nil and f.Func.Name is an empty string.
f.Function is correct all the time.

Change-Id: I7c30f80e7176128ae5576b130d2891f884ee47c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/581996
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2024-05-03 17:28:43 +00:00
apocelipes
10c035acd6 strings: move TrimPrefix and TrimSuffix to stringslite
To help packages use these functions like "os" which using
the copied function "stringsTrimSuffix".

Change-Id: I223028ed264c7b7e95534b4883223af0988cda68
GitHub-Last-Rev: 2fd8fbf528
GitHub-Pull-Request: golang/go#67151
Reviewed-on: https://go-review.googlesource.com/c/go/+/583075
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-05-03 16:48:16 +00:00
Tobias Klauser
0bc093a1aa internal/sysinfo: use sync.OnceValue for CPUName
Change-Id: I0f3ae97f2bd5ff3f533c5bf4570a8cda8b92b16a
Reviewed-on: https://go-review.googlesource.com/c/go/+/582836
Reviewed-by: David Chase <drchase@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: Tobias Klauser <tobias.klauser@gmail.com>
2024-05-03 16:47:15 +00:00
qiulaidongfeng
44e48c7e6c hash/maphash: parallel run test
This is a reapplication of CL 564576.

This reduces the go test hash/maphash time
by more than half.

After investigation it was confirmed that
the original CL would cause OOM when 32-bit machine.

This CL add testenv.ParallelOn64Bit for tests
that can be parallel on 64-bit machines,
it is not parallel on 32-bit machines,
because CL 564995 require the same API.

Change-Id: I1b7feaa07716cb3f55db4671653348fabf2396b0
GitHub-Last-Rev: 2827725558
GitHub-Pull-Request: golang/go#66359
Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/572195
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-03 16:41:38 +00:00
zhangjian
18dd682672 cmd/compile/internal/ssa: correct error message for AuxArm64BitField
Change-Id: I2e1f48c02cb5c6e90a9cb894eb3bc330a4c5c4b5
GitHub-Last-Rev: 303d1f8a13
GitHub-Pull-Request: golang/go#67124
Reviewed-on: https://go-review.googlesource.com/c/go/+/582615
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-05-03 16:40:22 +00:00
go101
44b54b99c9 strings,bytes: improve Repeat panic messages
The Repeat("-", maxInt) call should produce

   panic: runtime error: makeslice: len out of range

instead of

   panic: strings: Repeat output length overflow

This PR is only for theory perfection.

Change-Id: If67d87b147d666fbbb7238656f2a0cb6cf1dbb5b
GitHub-Last-Rev: 29dc0cb9c9
GitHub-Pull-Request: golang/go#67068
Reviewed-on: https://go-review.googlesource.com/c/go/+/581936
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-03 12:58:37 +00:00
qiulaidongfeng
2f5b420fb5 runtime,reflect: move zeroVal to internal/abi
Change-Id: I0e19e4aa2ea47a714e27b8d66c23c449e27861f2
GitHub-Last-Rev: 2d59b9589e
GitHub-Pull-Request: golang/go#67014
Reviewed-on: https://go-review.googlesource.com/c/go/+/581395
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>
Reviewed-by: Joedian Reid <joedian@google.com>
2024-05-03 12:00:41 +00:00
Alan Donovan
a3eb55cea9 cmd/vendor: update x/tools to v0.20.1-0.20240429173604-74c9cfe4d22f
The golang.org/x/tools/go/analysis/passes/stdversion was forcibly
added by means of an import in a throwaway file not committed.

Change-Id: I194012ae354f6f8d2d0c1fa39612e5554a4ab1cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/582555
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>
2024-05-03 02:38:00 +00:00
Alan Donovan
6defff5005 cmd/vet: add stdversion analyzer
+ release note, test

Fixes #46136

Change-Id: Ib157c5343dde379f8d6f67bdfa64b3f6a6432bab
Reviewed-on: https://go-review.googlesource.com/c/go/+/582556
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-05-03 01:02:40 +00:00
Olivier Mengué
344075d936 spec: clarify when range expression is evaluated
Clarify that the range expression of a "for" loop is called *just* once to
rule out that it might be re-evaluated after each iteration.

Change-Id: Iedb61cd29e5238ac0168b8ac01c34d6208cc4312
Reviewed-on: https://go-review.googlesource.com/c/go/+/582775
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-02 22:43:51 +00:00
Ian Lance Taylor
e602625c5e cmd/go: pass -Wl,-z,nodelete for c-shared mode with gccgo
This is the gccgo version of CL 15605.

For https://gcc.gnu.org/PR114699

For #11100
For #12582
For #12873

Change-Id: I30e23130737022d772971f0bd629b57269174886
Reviewed-on: https://go-review.googlesource.com/c/go/+/582975
Reviewed-by: Than McIntosh <thanm@google.com>
Commit-Queue: 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>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-05-02 22:18:34 +00:00
Tobias Klauser
b64e5e38ab net: use stringslite.HasPrefix
Change-Id: Ib14c70f580d0891b3fbedf9e4cde93077409d4e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/582915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-02 22:14:43 +00:00
Russ Cox
8f71c7633f runtime: remove note about goid reuse
Goids are designed to be big enough that they will never be reused:
a uint64 is enough to generate a new goroutine every nanosecond
for 500+ years before wrapping around, and after 500 years you
should probably stop and pick up some security updates.

This note was added in CL 70993 and appears to have just been
a misunderstanding by the CL author.

Change-Id: Ida7099b5191a4e5dbb1e3e9e44b4b86d7779fd6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/582895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
2024-05-02 21:10:56 +00:00
Jorropo
865cf5c5f6 testing: improve the documentation around b.N
Fixes #67137

- Make it clear the benchmark function is called multiple times.
- Demonstrate range over int.

Change-Id: I7e993d938b0351012cdd4aed8528951e0ad406ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/582835
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-02 18:41:57 +00:00
Michael Matloob
660a071906 cmd/internal/telemetry: add NewStackCounter functions
This CL adds a wrapper for the golang.org/x/telemetry/counter.NewStack
function so that it can be used by the compiler.

Also add build constraints for compiler_bootstrap to build the stubs
when we're bootstrapping the compiler.

For #58894

Change-Id: Icdbdd7aa6d2a3f1147112739c6939e14414f5ee9
Cq-Include-Trybots: luci.golang.try:gotip-linux-arm64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/582695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
2024-05-01 17:37:58 +00:00
cui fliter
c5698e3155 cmd/pprof: fix exception when file or path contains colon
Fixes #63924

Change-Id: I4ea17979faaca04eb6b046abffca2dd77397e0cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/539595
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-05-01 03:56:37 +00:00
Daniel Martí
959e65c41c bytes: fix up godoc link errors
[Reader.Reader] does not exist in this package.
These docs most likely meant to refer to [Reader] itself.

Change-Id: I4fa117e8541573e0be7c13751fdfc102d5f2d604
Reviewed-on: https://go-review.googlesource.com/c/go/+/582515
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>
2024-04-30 19:45:36 +00:00
Jonathan Amsterdam
cf05873029 net/http: represent multi wildcards properly
The routing tree used for matching ServeMux patterns used the
key "*" to hold a child node for a multi-segment wildcard.
The problem is that "*" is a valid path segment, which confused
the matching algorithm: it would fetch the multi wildcard child
when looking for the literal child for "*".

Eschew clever encodings. Use a separate field in the node to
represent the multi wildcard child.

Fixes #67067.

Change-Id: I300ca08b8628f5367626cf41979f6c238ed8c831
Reviewed-on: https://go-review.googlesource.com/c/go/+/582115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-04-30 15:43:24 +00:00
qmuntal
8509f6939c os: use filepathlite.FromSlash
Change-Id: Id15ebd9e97a8626e64665f6830a662e62432a619
Reviewed-on: https://go-review.googlesource.com/c/go/+/582500
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-04-30 15:38:38 +00:00
qmuntal
5616ab6025 os: use filepathlite.VolumeName
It is better to have a single implementation of VolumeName, which is
quite tricky to get right on Windows.

Change-Id: Ibba82dd71fe10b594cb6f782582430aa422e7078
Reviewed-on: https://go-review.googlesource.com/c/go/+/582499
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-04-30 15:38:09 +00:00
qmuntal
d95fa7aca7 os: use filepathlite.IsAbs
It is better to have a single implementation of IsAbs, which is quite
tricky to get right on Windows.

Change-Id: I45933b0ceff2920d9eddb61e62aacb2602c3dc8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/582498
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-04-30 15:37:05 +00:00
Tobias Klauser
150f45b2c4 os: use stringslite.HasPrefix
Change-Id: I791bdfecc6c94ee9dac592d60d95e97182bf0120
Reviewed-on: https://go-review.googlesource.com/c/go/+/582496
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-04-30 15:35:30 +00:00
The Backend Grip
3206a9b562 http: fix some comments typo in server.go
Change-Id: I826412175876a84ab978aba9418be28593484fba
GitHub-Last-Rev: d35753c7e0
GitHub-Pull-Request: golang/go#67112
Reviewed-on: https://go-review.googlesource.com/c/go/+/582435
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: Ian Lance Taylor <iant@google.com>
2024-04-30 15:35:05 +00:00
Tobias Klauser
476a352522 syscall: use stringslite.Has{Prefix,Suffix}
Change-Id: I393191b95eeb8e17345ce28cfa1fb54a3ef13951
Reviewed-on: https://go-review.googlesource.com/c/go/+/582237
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-04-30 15:34:18 +00:00
qmuntal
dc164eade1 os: remove ineffective else branch
Change-Id: Ic9cf871d862aec54ab8f491b8bc8d2820aecc875
Reviewed-on: https://go-review.googlesource.com/c/go/+/582497
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: 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>
2024-04-30 12:44:22 +00:00
David du Colombier
16ce8b3925 net: fix lookupHost on Plan 9
CL 532217 added the newDNSError function.

However, the implementation was not correct on
Plan 9, which lead TestLookupNoSuchHost to fail.

This change fixes lookupHost on Plan 9.

Fixes #67096.

Change-Id: I39271f7d588b19c1b1608f18a24d871460be09cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/582236
Reviewed-by: Joedian Reid <joedian@google.com>
Run-TryBot: David du Colombier <0intro@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-04-29 14:35:28 +00:00
Jes Cok
cf164403d1 slices: reduce code nesting depth for Compact and CompactFunc
To make it easier to read.

Change-Id: I2fa1eb78d879b9d86b4dc839be7ede37c7c864f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/581976
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: Joedian Reid <joedian@google.com>
2024-04-29 14:01:59 +00:00
aimuz
9e0685f9c2 encoding/json: optimize field sorting with slices and cmp
Refactor field sorting in typeFields to use slices.SortFunc and cmp.Compare,
resulting in performance improvements in cache misses and slight increases in
hit latency. Memory allocation and operation counts also reduced significantly
for cache misses.

goos: darwin
goarch: arm64
pkg: encoding/json
cpu: Apple M2 Max
                                    │   old.txt    │              new.txt               │
                                    │    sec/op    │   sec/op     vs base               │
TypeFieldsCache/MissTypes1-12          5.068µ ± 2%   5.032µ ± 1%       ~ (p=0.055 n=10)
TypeFieldsCache/MissTypes10-12         15.22µ ± 2%   14.79µ ± 2%  -2.84% (p=0.000 n=10)
TypeFieldsCache/MissTypes100-12        98.40µ ± 3%   94.72µ ± 1%  -3.73% (p=0.002 n=10)
TypeFieldsCache/MissTypes1000-12       860.3µ ± 3%   840.7µ ± 1%       ~ (p=0.105 n=10)
TypeFieldsCache/MissTypes10000-12      8.092m ± 3%   7.987m ± 4%       ~ (p=0.280 n=10)
TypeFieldsCache/MissTypes100000-12     80.90m ± 9%   80.62m ± 2%       ~ (p=0.631 n=10)
TypeFieldsCache/MissTypes1000000-12   1009.5m ± 7%   933.8m ± 7%  -7.50% (p=0.011 n=10)
TypeFieldsCache/HitTypes1-12           1.554n ± 3%   1.617n ± 3%  +4.05% (p=0.004 n=10)
TypeFieldsCache/HitTypes10-12          1.575n ± 1%   1.624n ± 6%  +3.14% (p=0.000 n=10)
TypeFieldsCache/HitTypes100-12         1.566n ± 1%   1.627n ± 5%  +3.86% (p=0.000 n=10)
TypeFieldsCache/HitTypes1000-12        1.526n ± 4%   1.596n ± 3%  +4.55% (p=0.001 n=10)
TypeFieldsCache/HitTypes10000-12       1.506n ± 0%   1.573n ± 3%  +4.41% (p=0.000 n=10)
TypeFieldsCache/HitTypes100000-12      1.480n ± 1%   1.529n ± 7%  +3.35% (p=0.001 n=10)
TypeFieldsCache/HitTypes1000000-12     1.473n ± 2%   1.468n ± 2%       ~ (p=0.739 n=10)
geomean                                1.371µ        1.374µ       +0.25%

                                    │     old.txt     │                new.txt                 │
                                    │      B/op       │     B/op       vs base                 │
TypeFieldsCache/MissTypes1-12          2.023Ki ± 0%      2.000Ki ± 0%  -1.16% (p=0.000 n=10)
TypeFieldsCache/MissTypes10-12         10.95Ki ± 0%      10.71Ki ± 0%  -2.17% (p=0.000 n=10)
TypeFieldsCache/MissTypes100-12       101.91Ki ± 0%      99.53Ki ± 0%  -2.34% (p=0.000 n=10)
TypeFieldsCache/MissTypes1000-12      1044.3Ki ± 0%     1020.8Ki ± 0%  -2.25% (p=0.000 n=10)
TypeFieldsCache/MissTypes10000-12      9.957Mi ± 0%      9.730Mi ± 0%  -2.29% (p=0.000 n=10)
TypeFieldsCache/MissTypes100000-12     97.79Mi ± 0%      95.50Mi ± 0%  -2.34% (p=0.000 n=10)
TypeFieldsCache/MissTypes1000000-12   1018.4Mi ± 0%      995.5Mi ± 0%  -2.25% (p=0.000 n=10)
TypeFieldsCache/HitTypes1-12             0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes10-12            0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes100-12           0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes1000-12          0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes10000-12         0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes100000-12        0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes1000000-12       0.000 ± 0%        0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                             ²                  -1.06%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                    │    old.txt    │               new.txt                │
                                    │   allocs/op   │  allocs/op   vs base                 │
TypeFieldsCache/MissTypes1-12          46.00 ± 0%      45.00 ± 0%  -2.17% (p=0.000 n=10)
TypeFieldsCache/MissTypes10-12         215.0 ± 0%      205.0 ± 0%  -4.65% (p=0.000 n=10)
TypeFieldsCache/MissTypes100-12       1.845k ± 0%     1.745k ± 0%  -5.42% (p=0.000 n=10)
TypeFieldsCache/MissTypes1000-12      18.08k ± 0%     17.08k ± 0%  -5.53% (p=0.000 n=10)
TypeFieldsCache/MissTypes10000-12     180.3k ± 0%     170.3k ± 0%  -5.55% (p=0.000 n=10)
TypeFieldsCache/MissTypes100000-12    1.804M ± 0%     1.704M ± 0%  -5.54% (p=0.000 n=10)
TypeFieldsCache/MissTypes1000000-12   18.04M ± 0%     17.04M ± 0%  -5.54% (p=0.000 n=10)
TypeFieldsCache/HitTypes1-12           0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes10-12          0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes100-12         0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes1000-12        0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes10000-12       0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes100000-12      0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
TypeFieldsCache/HitTypes1000000-12     0.000 ± 0%      0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                           ²                -2.49%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

Change-Id: I62b8f524f5747f4f1b9241a1d849efeef1851049
GitHub-Last-Rev: d16772d4fb
GitHub-Pull-Request: golang/go#67046
Reviewed-on: https://go-review.googlesource.com/c/go/+/581895
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: Joedian Reid <joedian@google.com>
2024-04-29 14:01:21 +00:00
plasmatium
f6e6b637c0 time: add notes about monotonic time paused
See #66870

Change-Id: I781265355a3dbd0d9538bc9dcafaa83b482ec3f8
GitHub-Last-Rev: 9d92f116b0
GitHub-Pull-Request: golang/go#66922
Reviewed-on: https://go-review.googlesource.com/c/go/+/580515
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joedian Reid <joedian@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-29 14:01:17 +00:00
Koya IWAMURA
a81c8b3bf2 net/url: improve URL.String performance
URL.String performs memory allocation many times, but it can improve
performance by allocating memory that it clearly knows it needs.
This CL achieves 24.6% speedup, 18.3% memory reduction, and 46.7% fewer memory
allocations on existing benchmarks.

          │ string_old.txt │           string_new2.txt           │
          │     sec/op     │   sec/op     vs base                │
String-16      3.622µ ± 5%   2.730µ ± 2%  -24.63% (p=0.000 n=10)

          │ string_old.txt │           string_new2.txt            │
          │      B/op      │     B/op      vs base                │
String-16     1.406Ki ± 0%   1.148Ki ± 0%  -18.33% (p=0.000 n=10)

          │ string_old.txt │          string_new2.txt           │
          │   allocs/op    │ allocs/op   vs base                │
String-16       60.00 ± 0%   32.00 ± 0%  -46.67% (p=0.000 n=10)

Change-Id: I70199be952eddc44134945077e52740e8921088f
Reviewed-on: https://go-review.googlesource.com/c/go/+/581155
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>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Joedian Reid <joedian@google.com>
2024-04-29 13:58:27 +00:00
Egon Elbre
99ee616250 internal/runtime/atomic: fix TestAnd64 and TestOr64
The local variable may not be 64bit aligned, which caused arm tests
to fail.

Fixes #67077

Change-Id: Ia3ae4abcc90319cb10cd593bdc7994cc6eeb3a28
Reviewed-on: https://go-review.googlesource.com/c/go/+/581916
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2024-04-27 20:49:32 +00:00
Egon Elbre
644a4ff333 testing: use time.Since in highPrecisionTime
time.Since has optimizations for measuring monotonic time.

For #31160.

Change-Id: I0529b9f69b9f008e3414b8e386b6faa64af4a008
Reviewed-on: https://go-review.googlesource.com/c/go/+/582135
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>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-04-27 19:42:36 +00:00
Russ Cox
774d5b366c make.bash: avoid ksh bug in nogoenv
ksh handles make.bash surprisingly well and is a smaller
supply chain attack surface, so it's reasonable to want
to use "ksh make.bash" to build Go.

The only place where ksh and bash disagree in running
make.bash is an arguable bug in ksh that

	X=Y foo

accidentally changes the real value of X following that
command when foo is a shell function. (It correctly preserves
the original value of X when foo is a command being invoked.)

More specifically,

	GOROOT=$GOROOT_BOOTSTRAP nogoenv foo

incorrectly changes $GOROOT in the rest of the script.

CL 580020 suggested using a subshell, but subshells
historically have lost "set -e", so we'd have to use (...) || exit 1.
Instead of that, this CL refactors nogoenv into bootstrapenv,
putting it in charge of changing $GOROOT the same way it
changes all the other environment variables.

This CL also updates make.rc for parallelism.
It does not bother updating make.bat: that part is already
a bit different, and attempting to change it is all risk, no reward.

Change-Id: I5923a6fb5016a3862363363859365d1cd4f61a1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/582076
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eric Grosse <grosse@gmail.com>
2024-04-27 11:30:21 +00:00
Damien Neil
ceef0633b3 path/filepath, internal/filepathlite: move parts of filepath to filepathlite
The path/filepath package needs to depend on the os package to
implement Abs, Walk, and other functions. Move the implementation
of purely lexical functions from path/filepath into
internal/filepathlite, so they can be used by os and
other low-level packages.

Change-Id: Id211e547d6f1f58c82419695ff2d75cd6cd14a12
Reviewed-on: https://go-review.googlesource.com/c/go/+/566556
Reviewed-by: Behroz Karimpor <behrozkarimpor201@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-26 23:07:50 +00:00
Damien Neil
ad22356ec6 all: rename internal/safefilepath to internal/filepathlite
The safefilepath package was originally added to contain
the FromFS function. We subsequently added FromFS to path/filepath
as Localize. The safefilepath package now exists only to permit
the os package to import Localize.

Rename safefilepath to filepathlite to better indicate that it's
a low-dependency version of filepath.

Change-Id: I4c5f9b28e8581f841947b48c5cac9954cd0c9535
Reviewed-on: https://go-review.googlesource.com/c/go/+/581517
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-04-26 23:07:37 +00:00
Damien Neil
d69f87445c strings, internal/stringslite: lite version of strings package
To be used by internal/filepathlite, which is to be used by os.
There are probably other places where it would be convenient
to have strings functions accessible to RUNTIME level packages.

Change-Id: Icda59e7a9e26d9e8f3692db0ea4fb7b3dbf570d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/581516
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-26 23:07:25 +00:00
Egon Elbre
1c4704991a testing: use QueryPerformanceCounter on Windows
Windows time.Now granularity is around 0.5ms on modern systems,
which introduces a significant noise into benchmark results.
Instead of relying time.Now use QueryPerformanceCounter, which
has significantly better granularity compared to time.Now.

 │ TimeNow-32  │        HighPrecisionTimeNow-32        │
 │   sec/op    │    sec/op     vs base                 │
   4.812n ± 0%   30.580n ± 0%  +535.43% (p=0.000 n=20)

Fixes #31160

Change-Id: Ib2a574d638c9c6762a2524212def02265574e267
Reviewed-on: https://go-review.googlesource.com/c/go/+/557315
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-04-26 22:55:25 +00:00
Dmitriy Matrenichev
9effeeab27 internal/weak: remove unnecessary conversion, fix typo
Remove unnecessary conversion from unsafe.Pointer to unsafe.Pointer.
Also fix small typo in weak.Pointer.Strong method documentation.

Change-Id: I84791fba244581bd6218c589827a61914f0797b4
GitHub-Last-Rev: 7978d07d5b
GitHub-Pull-Request: golang/go#66977
Reviewed-on: https://go-review.googlesource.com/c/go/+/580936
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joedian Reid <joedian@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-04-26 22:13:25 +00:00
Jes Cok
b439f32859 all: make use of sync.Map.Clear
Since CL 515015 added sync.Map.Clear method, we can use it to make
the code simpler and clearer.

Change-Id: I29edc969431b4fd95cd5fd864953a71ca1538dd3
Reviewed-on: https://go-review.googlesource.com/c/go/+/582015
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joedian Reid <joedian@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-04-26 21:32:11 +00:00
Jonathan Amsterdam
0e7f5cf30b doc/README.md: discourage RELNOTE in CLs
Release notes should always be files under doc/next. Make it clear that
this is the only way to add them: RELNOTE markers in CLs are no longer
supported.

Change-Id: I34d77eb876f57b84ecdc7e5ecbf3eb5c91e6fed8
Reviewed-on: https://go-review.googlesource.com/c/go/+/582075
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2024-04-26 21:24:36 +00:00