1
0
mirror of https://github.com/golang/go.git synced 2025-02-06 09:45:23 +00:00

62129 Commits

Author SHA1 Message Date
apocelipes
4cc7705e56 testing: use strings.SplitSeq and bytes.SplitSeq
To simplify the code. This is a follow-up for the CL 646216.

Change-Id: Ib09d1074a783482fb293527e9f1abeb3c02137c3
GitHub-Last-Rev: 2e7a6ad40cc22ea855e4d703ff39db9cc2c8a58e
GitHub-Pull-Request: golang/go#71568
Reviewed-on: https://go-review.googlesource.com/c/go/+/646755
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Salah (Globlost) <globlost@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-02-05 15:53:08 -08:00
Roland Shoemaker
51bf2cf7cf Revert "cmd/go/internal/work: allow @ character in some -Wl, linker flags on darwin"
This reverts CL 638075 (commit e3cd55e9d293d519e622e788e902f372dc30338a).

This change introduced a security issue as @ flags are first resolved as
files by the darwin linker, before their meaning as flags, allowing the
flag filtering logic to be entirely bypassed.

Thanks to Juho Forsén for reporting this issue.

Fixes #71476
Fixes CVE-2025-22867

Change-Id: I3a4b4a6fc534de105d930b8ed5b9900bc94b0c4e
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/1900
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/646996
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-05 13:31:48 -08:00
Michael Matloob
220fe79871 cmd/go: add '-skip' to list of cacheable test flags
-run is cacheable, so -skip should be cacheable too.

Fixes #70692

Change-Id: I16880189b0d3a963f8f08008fc7fedcdc6f11630
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/646997
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
2025-02-05 13:25:26 -08:00
Dmitri Shuralyov
b45c7d5466 internal/trace: skip TestTraceCgoCallback on freebsd-amd64-race builders
For #71556.

Change-Id: I754f113bfdad244d0e978cf559bf45f2f4d7bf06
Reviewed-on: https://go-review.googlesource.com/c/go/+/646396
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-02-05 12:06:13 -08:00
Dmitri Shuralyov
ee6e0a5ed6 internal/routebsd: fix typo in sockAddrLen identifer name
For #70528.

Change-Id: I0db75cb998aeb299676384fe59bf241db18ebc5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/646975
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-05 11:19:56 -08:00
Tobias Klauser
721f5ca4ed runtime: adjust comments for auxv getAuxv
github.com/cilium/ebpf no longer accesses getAuxv using linkname but now
uses the golang.org/x/sys/unix.Auxv wrapper introduced in
go.dev/cl/644295.

Also adjust the list of users to include x/sys/unix.

Updates #67839
Updates #67401

Change-Id: Ieee266360b22cc0bc4be8f740e0302afd7dbd14f
Reviewed-on: https://go-review.googlesource.com/c/go/+/646535
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-02-05 09:41:51 -08:00
Dmitri Shuralyov
a7cbea8332 cmd/go: skip bzr tests if 'bzr help' has non-zero exit code
It appears to be quite easy to end up with a broken 'bzr' installation.
For example, if bzr was installed via a system-wide package manager and
intends to work with a system-wide Python installation, it may break if
another 'python3' binary is added to PATH.

If something as simple as 'bzr help' fails to exit with zero code,
consider it broken and skip tests that require a working bzr binary
just like if the 'bzr' binary isn't present in PATH at all.

This makes these tests more robust and capable of producing useful
signal in more environments. Separately from this, we'll want to
restore a working bzr installation on the linux-arm64 builders, but
at least there's still one on linux-amd64 builders.

For #71563.
Fixes #71504.

Change-Id: Ia147196f12b90a0731ebbfab63b5de308212ed65
Cq-Include-Trybots: luci.golang.try:gotip-linux-arm64-longtest,gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/646715
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
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>
2025-02-05 09:23:15 -08:00
Ian Lance Taylor
f6ea0621d2 internal/routebsd: fix parsing network address of length zero
This applies CL 646555 from the net repository to this copy.

For #70528

Change-Id: Ib7e23accfa3f278392e7bdca6f8544b8f1395e7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/646676
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Bypass: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2025-02-05 09:18:29 -08:00
Jakub Ciolek
b7c9cdd53c cmd/compile: establish limits of bool to uint8 conversions
Improves bound check elimination for:

func arrayLargeEnough(b bool, a [2]int64) int64 {
    c := byte(0)
    if b {
        c = 1
    }

    // this bound check gets elided
    return a[c]
}

We also detect never true branches like:

func cCanOnlyBe0or1(b bool) byte {
    var c byte
    if b {
        c = 1
    }
    // this statement can never be true so we can elide it
    if c == 2 {
        c = 3
    }

    return c
}

Hits a few times:

crypto/internal/sysrand
crypto/internal/sysrand.Read 357 -> 349  (-2.24%)

testing
testing.(*F).Fuzz.func1.1 837 -> 828  (-1.08%)

image/png
image/png.(*Encoder).Encode 1735 -> 1733  (-0.12%)

vendor/golang.org/x/crypto/cryptobyte
vendor/golang.org/x/crypto/cryptobyte.(*Builder).callContinuation 187 -> 185  (-1.07%)

crypto/internal/sysrand [cmd/compile]
crypto/internal/sysrand.Read 357 -> 349  (-2.24%)

go/parser
go/parser.(*parser).parseType 463 -> 457  (-1.30%)
go/parser.(*parser).embeddedElem 633 -> 626  (-1.11%)
go/parser.(*parser).parseFuncDecl 917 -> 914  (-0.33%)
go/parser.(*parser).parseDotsType 393 -> 391  (-0.51%)
go/parser.(*parser).error 1061 -> 1054  (-0.66%)
go/parser.(*parser).parseTypeName 537 -> 532  (-0.93%)
go/parser.(*parser).parseParamDecl 1478 -> 1451  (-1.83%)
go/parser.(*parser).parseFuncTypeOrLit 498 -> 495  (-0.60%)
go/parser.(*parser).parseValue 375 -> 371  (-1.07%)
go/parser.(*parser).parseElementList 594 -> 593  (-0.17%)
go/parser.(*parser).parseResult 593 -> 583  (-1.69%)
go/parser.(*parser).parseElement 506 -> 504  (-0.40%)
go/parser.(*parser).parseImportSpec 1110 -> 1108  (-0.18%)
go/parser.(*parser).parseStructType 741 -> 735  (-0.81%)
go/parser.(*parser).parseTypeSpec 1054 -> 1048  (-0.57%)
go/parser.(*parser).parseIdentList 625 -> 623  (-0.32%)
go/parser.(*parser).parseOperand 1221 -> 1199  (-1.80%)
go/parser.(*parser).parseIndexOrSliceOrInstance 2713 -> 2694  (-0.70%)
go/parser.(*parser).parseSwitchStmt 1458 -> 1447  (-0.75%)
go/parser.(*parser).parseArrayFieldOrTypeInstance 1865 -> 1861  (-0.21%)
go/parser.(*parser).parseExpr 307 -> 305  (-0.65%)
go/parser.(*parser).parseSelector 427 -> 425  (-0.47%)
go/parser.(*parser).parseTypeInstance 1433 -> 1420  (-0.91%)
go/parser.(*parser).parseCaseClause 629 -> 626  (-0.48%)
go/parser.(*parser).parseParameterList 4212 -> 4189  (-0.55%)
go/parser.(*parser).parsePointerType 393 -> 391  (-0.51%)
go/parser.(*parser).parseFuncType 465 -> 463  (-0.43%)
go/parser.(*parser).parseTypeAssertion 559 -> 557  (-0.36%)
go/parser.(*parser).parseSimpleStmt 2443 -> 2388  (-2.25%)
go/parser.(*parser).parseCallOrConversion 1093 -> 1087  (-0.55%)
go/parser.(*parser).parseForStmt 2168 -> 2159  (-0.42%)
go/parser.(*parser).embeddedTerm 657 -> 649  (-1.22%)
go/parser.(*parser).parseCommClause 1509 -> 1501  (-0.53%)

cmd/internal/objfile
cmd/internal/objfile.(*goobjFile).symbols 5299 -> 5274  (-0.47%)

net
net.initConfVal 378 -> 374  (-1.06%)
net.(*conf).hostLookupOrder 269 -> 267  (-0.74%)
net.(*conf).addrLookupOrder 261 -> 255  (-2.30%)

cmd/internal/obj/loong64
cmd/internal/obj/loong64.(*ctxt0).oplook 1829 -> 1813  (-0.87%)

cmd/internal/obj/mips
cmd/internal/obj/mips.(*ctxt0).oplook 1428 -> 1400  (-1.96%)

go/types
go/types.(*typeWriter).signature 605 -> 601  (-0.66%)
go/types.(*Checker).instantiateSignature 1469 -> 1467  (-0.14%)

go/parser [cmd/compile]
go/parser.(*parser).parseSwitchStmt 1458 -> 1447  (-0.75%)
go/parser.(*parser).parseDotsType 393 -> 391  (-0.51%)
go/parser.(*parser).embeddedElem 633 -> 626  (-1.11%)
go/parser.(*parser).parseTypeAssertion 559 -> 557  (-0.36%)
go/parser.(*parser).parseCommClause 1509 -> 1501  (-0.53%)
go/parser.(*parser).parseCaseClause 629 -> 626  (-0.48%)
go/parser.(*parser).parseImportSpec 1110 -> 1108  (-0.18%)
go/parser.(*parser).parseTypeSpec 1054 -> 1048  (-0.57%)
go/parser.(*parser).parseElementList 594 -> 593  (-0.17%)
go/parser.(*parser).parseParamDecl 1478 -> 1451  (-1.83%)
go/parser.(*parser).parseType 463 -> 457  (-1.30%)
go/parser.(*parser).parseSimpleStmt 2443 -> 2388  (-2.25%)
go/parser.(*parser).parseIdentList 625 -> 623  (-0.32%)
go/parser.(*parser).parseTypeInstance 1433 -> 1420  (-0.91%)
go/parser.(*parser).parseResult 593 -> 583  (-1.69%)
go/parser.(*parser).parseValue 375 -> 371  (-1.07%)
go/parser.(*parser).parseFuncDecl 917 -> 914  (-0.33%)
go/parser.(*parser).error 1061 -> 1054  (-0.66%)
go/parser.(*parser).parseElement 506 -> 504  (-0.40%)
go/parser.(*parser).parseFuncType 465 -> 463  (-0.43%)
go/parser.(*parser).parsePointerType 393 -> 391  (-0.51%)
go/parser.(*parser).parseTypeName 537 -> 532  (-0.93%)
go/parser.(*parser).parseExpr 307 -> 305  (-0.65%)
go/parser.(*parser).parseFuncTypeOrLit 498 -> 495  (-0.60%)
go/parser.(*parser).parseStructType 741 -> 735  (-0.81%)
go/parser.(*parser).parseOperand 1221 -> 1199  (-1.80%)
go/parser.(*parser).parseIndexOrSliceOrInstance 2713 -> 2694  (-0.70%)
go/parser.(*parser).parseForStmt 2168 -> 2159  (-0.42%)
go/parser.(*parser).parseParameterList 4212 -> 4189  (-0.55%)
go/parser.(*parser).parseArrayFieldOrTypeInstance 1865 -> 1861  (-0.21%)
go/parser.(*parser).parseSelector 427 -> 425  (-0.47%)
go/parser.(*parser).parseCallOrConversion 1093 -> 1087  (-0.55%)
go/parser.(*parser).embeddedTerm 657 -> 649  (-1.22%)

crypto/tls
crypto/tls.(*Conn).clientHandshake 3430 -> 3421  (-0.26%)

cmd/internal/obj/mips [cmd/compile]
cmd/internal/obj/mips.(*ctxt0).oplook 1428 -> 1400  (-1.96%)

cmd/internal/obj/loong64 [cmd/compile]
cmd/internal/obj/loong64.(*ctxt0).oplook 1829 -> 1813  (-0.87%)

cmd/compile/internal/types2
cmd/compile/internal/types2.(*typeWriter).signature 605 -> 601  (-0.66%)
cmd/compile/internal/types2.(*Checker).infer 10646 -> 10614  (-0.30%)
cmd/compile/internal/types2.(*Checker).instantiateSignature 1567 -> 1561  (-0.38%)

cmd/compile/internal/types2 [cmd/compile]
cmd/compile/internal/types2.(*Checker).instantiateSignature 1567 -> 1561  (-0.38%)
cmd/compile/internal/types2.(*typeWriter).signature 605 -> 601  (-0.66%)
cmd/compile/internal/types2.(*Checker).infer 10718 -> 10654  (-0.60%)

cmd/vendor/golang.org/x/arch/s390x/s390xasm
cmd/vendor/golang.org/x/arch/s390x/s390xasm.GoSyntax 36778 -> 36682  (-0.26%)

net/http
net/http.(*Client).do 4202 -> 4170  (-0.76%)
net/http.(*http2clientStream).writeRequest 3692 -> 3686  (-0.16%)

cmd/vendor/github.com/ianlancetaylor/demangle
cmd/vendor/github.com/ianlancetaylor/demangle.(*rustState).genericArgs 466 -> 463  (-0.64%)

cmd/compile/internal/devirtualize
cmd/compile/internal/devirtualize.ProfileGuided.func1 1364 -> 1357  (-0.51%)

cmd/compile/internal/inline/interleaved
cmd/compile/internal/inline/interleaved.DevirtualizeAndInlinePackage.func2 533 -> 526  (-1.31%)

cmd/compile/internal/devirtualize [cmd/compile]
cmd/compile/internal/devirtualize.ProfileGuided.func1 1343 -> 1332  (-0.82%)

cmd/compile/internal/inline/interleaved [cmd/compile]
cmd/compile/internal/inline/interleaved.DevirtualizeAndInlinePackage.func2 533 -> 526  (-1.31%)

cmd/link/internal/ld
cmd/link/internal/ld.mustLinkExternal 2739 -> 2674  (-2.37%)

cmd/compile/internal/ssa
cmd/compile/internal/ssa.(*poset).Ordered 391 -> 389  (-0.51%)
cmd/compile/internal/ssa.(*poset).Equal 318 -> 313  (-1.57%)
cmd/compile/internal/ssa.(*poset).Undo 1842 -> 1832  (-0.54%)
cmd/compile/internal/ssa.(*expandState).decomposeAsNecessary 4587 -> 4555  (-0.70%)
cmd/compile/internal/ssa.(*poset).OrderedOrEqual 390 -> 389  (-0.26%)
cmd/compile/internal/ssa.(*poset).NonEqual 613 -> 606  (-1.14%)

cmd/compile/internal/ssa [cmd/compile]
cmd/compile/internal/ssa.(*poset).OrderedOrEqual 368 -> 365  (-0.82%)
cmd/compile/internal/ssa.(*poset).Equal 318 -> 313  (-1.57%)
cmd/compile/internal/ssa.(*expandState).decomposeAsNecessary 4952 -> 4938  (-0.28%)
cmd/compile/internal/ssa.(*poset).NonEqual 613 -> 606  (-1.14%)
cmd/compile/internal/ssa.(*poset).SetEqual 2533 -> 2505  (-1.11%)
cmd/compile/internal/ssa.(*poset).SetNonEqual 785 -> 777  (-1.02%)
cmd/compile/internal/ssa.(*poset).Ordered 370 -> 366  (-1.08%)

cmd/compile/internal/gc [cmd/compile]
cmd/compile/internal/gc.Main.DevirtualizeAndInlinePackage.func2 492 -> 489  (-0.61%)

file                                                    before   after    Δ       %
crypto/internal/sysrand.s                               1553     1545     -8      -0.515%
internal/zstd.s                                         49179    49190    +11     +0.022%
testing.s                                               115197   115188   -9      -0.008%
image/png.s                                             36109    36107    -2      -0.006%
vendor/golang.org/x/crypto/cryptobyte.s                 30980    30978    -2      -0.006%
crypto/internal/sysrand [cmd/compile].s                 1553     1545     -8      -0.515%
go/parser.s                                             112638   112354   -284    -0.252%
cmd/internal/objfile.s                                  49994    49969    -25     -0.050%
net.s                                                   299558   299546   -12     -0.004%
cmd/internal/obj/loong64.s                              71651    71635    -16     -0.022%
cmd/internal/obj/mips.s                                 59681    59653    -28     -0.047%
go/types.s                                              558839   558833   -6      -0.001%
cmd/compile/internal/types.s                            71305    71306    +1      +0.001%
go/parser [cmd/compile].s                               112749   112465   -284    -0.252%
crypto/tls.s                                            388859   388850   -9      -0.002%
cmd/internal/obj/mips [cmd/compile].s                   59792    59764    -28     -0.047%
cmd/internal/obj/loong64 [cmd/compile].s                71762    71746    -16     -0.022%
cmd/compile/internal/types2.s                           540608   540566   -42     -0.008%
cmd/compile/internal/types2 [cmd/compile].s             577428   577354   -74     -0.013%
cmd/vendor/golang.org/x/arch/s390x/s390xasm.s           267664   267568   -96     -0.036%
net/http.s                                              620704   620666   -38     -0.006%
cmd/vendor/github.com/ianlancetaylor/demangle.s         299991   299988   -3      -0.001%
cmd/compile/internal/devirtualize.s                     21452    21445    -7      -0.033%
cmd/compile/internal/inline/interleaved.s               8358     8351     -7      -0.084%
cmd/compile/internal/devirtualize [cmd/compile].s       20994    20983    -11     -0.052%
cmd/compile/internal/inline/interleaved [cmd/compile].s 8328     8321     -7      -0.084%
cmd/link/internal/ld.s                                  641802   641737   -65     -0.010%
cmd/compile/internal/ssa.s                              3552939  3552957  +18     +0.001%
cmd/compile/internal/ssa [cmd/compile].s                3752191  3752197  +6      +0.000%
cmd/compile/internal/ssagen.s                           405780   405786   +6      +0.001%
cmd/compile/internal/ssagen [cmd/compile].s             434472   434496   +24     +0.006%
cmd/compile/internal/gc [cmd/compile].s                 38499    38496    -3      -0.008%
total                                                   36185267 36184243 -1024   -0.003%

Change-Id: I867222b0f907b29d32b2676e55c6b5789ec56511
Reviewed-on: https://go-review.googlesource.com/c/go/+/642716
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-02-05 09:04:25 -08:00
Mark Ryan
bcfa00cbd2 cpu/internal: provide runtime detection of RISC-V extensions on Linux
Add a RISCV64 variable to cpu/internal that indicates both the presence
of RISC-V extensions and performance information about the underlying
RISC-V cores.  The variable is only populated with non false values on
Linux.  The detection code relies on the riscv_hwprobe syscall
introduced in Linux 6.4.  The patch can detect RVV 1.0 and whether
the CPU supports fast misaligned accesses.  It can only detect RVV 1.0
on a 6.5 kernel or later (without backports).

Updates #61416

Change-Id: I2d8289345c885b699afff441d417cae38f6bdc54
Reviewed-on: https://go-review.googlesource.com/c/go/+/522995
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-02-05 03:47:25 -08:00
Mark Ryan
664aebab7d cmd/go: add rva23u64 as a valid value for GORISCV64
The RVA23 profile was ratified on the 21st of October 2024.

https://riscv.org/announcements/2024/10/risc-v-announces-ratification-of-the-rva23-profile-standard/

Now that it's ratified we can add rva23u64 as a valid value for the
GORISCV64 environment variable. This will allow the compiler and
assembler to generate instructions made mandatory by the new profile
without a runtime check.  Examples of such instructions include those
introduced by the Vector and Zicond extensions.

Setting GORISCV64=rva23u64 defines the riscv64.rva20u64,
riscv64.rva22u64 and riscv64.rva23u64 build tags, sets the internal
variable buildcfg.GORISCV64 to 23 and defines the macros
GORISCV64_rva23u64, hasV, hasZba, hasZbb, hasZbs, hasZfa, and
hasZicond for use in assembly language code.

Updates #61476

Change-Id: I7641c23084fa52891c9a18df58f4013cb6597d88
Reviewed-on: https://go-review.googlesource.com/c/go/+/633417
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
2025-02-05 03:44:40 -08:00
Ian Lance Taylor
842e4b5207 net/rpc: move frozen notice to the start of the package doc
For #71559

Change-Id: I68b9518a26cab75789d596839267abab7997bc2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/646575
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
2025-02-04 21:26:47 -08:00
Amirhossein Akhlaghpour
be2b809e5b os: fix race condition in readdir by atomically initializing dirinfo
This change ensures that dirinfo in the File struct is initialized atomically,
avoiding redundant allocations when multiple goroutines access it concurrently.
Instead of creating separate buffers, we now use CompareAndSwap to guarantee
thread-safe initialization and reduce unnecessary memory usage.

Although this is not a strict race condition, the update enhances efficiency by
eliminating duplicate allocations and ensuring safer concurrent access.

Fixes #71496.

Change-Id: If08699a94afa05611cdf67e82a5957a8d8f9d5c8
GitHub-Last-Rev: 1e1f6191439cf3ad32f3ba54bba5a0185dd55b14
GitHub-Pull-Request: golang/go#71501
Reviewed-on: https://go-review.googlesource.com/c/go/+/645720
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>
2025-02-04 18:18:11 -08:00
apocelipes
a1ea78c470 net: use strings.SplitSeq and bytes.SplitSeq
Replace `for _, s := range {strings, bytes}.Split(v, sep)` with
`for s := range {strings, bytes}.SplitSeq(v, sep)`, to simplify
the code and reduce some memory allocations.

Change-Id: Idead4de1e3928fc75cc5ba8caeff85542f1243d5
GitHub-Last-Rev: 5fb196a073e7583b23b1ebb446d6c067580ed63a
GitHub-Pull-Request: golang/go#71554
Reviewed-on: https://go-review.googlesource.com/c/go/+/646216
Reviewed-by: Damien Neil <dneil@google.com>
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>
2025-02-04 17:20:47 -08:00
Ian Lance Taylor
0e35fb2f99 net: ignore unnamed interfaces on DragonFly
On DragonFly it seems that we can see an unnamed interface,
but be unable to retrieve it. Skip unnamed interface cases.

For #71064

Change-Id: Ie9af74bd656d403ddc19cc5f14062cd8e0fa2571
Reviewed-on: https://go-review.googlesource.com/c/go/+/646675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2025-02-04 16:52:20 -08:00
Ian Lance Taylor
b485e5bceb os: remove Process.mode field
It's now redundant with checking whether the handle field is nil.

For #70907

Change-Id: I877f2a7c63d15ab5f8e3d2c9aa24776c2e3e2056
Reviewed-on: https://go-review.googlesource.com/c/go/+/638576
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
2025-02-04 15:03:18 -08:00
Ian Lance Taylor
5c2b5e02c4 os: separate Process.handle into a separate memory allocation
This is a step toward using AddCleanup rather than SetFinalizer
to close process handles.

For #70907

Change-Id: I7fb37461dd67b27135eab46fbdae94f0058ace85
Reviewed-on: https://go-review.googlesource.com/c/go/+/638575
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: Robert Griesemer <gri@google.com>
2025-02-04 13:10:59 -08:00
Youlin Feng
0825475599 cmd/compile: do not treat OpLocalAddr as load in DSE
Fixes #70409
Fixes #47107

Change-Id: I82a66c46f6b76c68e156b5d937273b0316975d44
Reviewed-on: https://go-review.googlesource.com/c/go/+/629016
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>
Reviewed-by: David Chase <drchase@google.com>
2025-02-04 12:52:01 -08:00
Ian Lance Taylor
5cb5437b6d cmd/go/internal/vcsweb/vcstest: skip bzr test if deps not found
The linux-arm64 trybots are consistently failing with

    vcstest_test.go:155: 2025/01/30 21:50:41 hello.txt:
        > handle bzr
        > env BZR_EMAIL='Russ Cox <rsc@google.com>'
        > env EMAIL='Russ Cox <rsc@google.com>'
        > bzr init-repo .
        [stderr]
        brz: ERROR: Couldn't import breezy and dependencies.
        Please check the directory containing breezy is on your PYTHONPATH.

        Error: PyErr { type: <class 'ModuleNotFoundError'>, value: ModuleNotFoundError("No module named 'breezy'"), traceback: None }

    vcstest_test.go:161: hello.txt:6: bzr init-repo .: exit status 1

This seems to be a problem with the builder.

For now, skip the test if we see that error message, just as we already
skip the test if the bzr executable is not found.

For #71504

Change-Id: If8b6d4dea02dc16198ba6067595dff3340a81299
Reviewed-on: https://go-review.googlesource.com/c/go/+/646635
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2025-02-04 12:19:45 -08:00
David Chase
7472b4c324 cmd/compile: include liveness info in GOSSAFUNC output
For this function
```
func test(a, b int, c string, s []int, r [3]int, f ifn) {
	in(a)
	in(b)
	sl(s)
	ar(r)
	fu(f)
}
```
this output
```
HASH live at entry to test: f s
HASH /Users/drchase/work/src/live/main.go
	00000 (15) TEXT main.test(SB), ABIInternal
	00001 (15) FUNCDATA $0, gclocals·vYpXgR4/KsH5nhFsqkHG1Q==(SB)
	00002 (15) FUNCDATA $1, gclocals·Soq6RzO4SX8YA1O9euewoQ==(SB)
	00003 (15) FUNCDATA $5, main.test.arginfo1(SB)
	00004 (15) FUNCDATA $6, main.test.argliveinfo(SB)
b1	00005 (15) PCDATA $3, $1
v32	00006 (21) MOVD R6, main.s+72(RSP)
v27	00007 (21) MOVD R5, main.s+64(RSP)
v30	00008 (21) MOVD R4, main.s+56(RSP)
v7	00009 (21) MOVD R1, main.b+32(RSP)
v34	00010 (21) MOVD R7, main.f+80(RSP)
v34	00011 (21) PCDATA $3, $2
v15	00012 (+16) PCDATA $1, $0
HASH live at call to in: f s
v15	00013 (+16) CALL main.in(SB)
v3	00014 (+17) MOVD main.b+32(RSP), R0
HASH live at call to in: f s
v17	00015 (+17) CALL main.in(SB)
v8	00016 (+18) MOVD main.s+56(RSP), R0
v21	00017 (18) MOVD main.s+64(RSP), R1
v33	00018 (18) MOVD main.s+72(RSP), R2
v19	00019 (+18) PCDATA $1, $1
HASH live at call to sl: f
v19	00020 (+18) CALL main.sl(SB)
v29	00021 (+19) LDP main.r(RSP), (R1, R2)
v9	00022 (19) STP (R1, R2), 8(RSP)
v12	00023 (19) MOVD main.r+16(RSP), R1
v31	00024 (19) MOVD R1, 24(RSP)
HASH live at call to ar: f
v22	00025 (+19) CALL main.ar(SB)
v35	00026 (+20) MOVD main.f+80(RSP), R0
v24	00027 (+20) PCDATA $1, $2
HASH live at call to fu:
v24	00028 (+20) CALL main.fu(SB)
b1	00029 (21) RET
	00030 (?) END
```

Where "HASH" is the git commit comment character I don't know how
to escape and this was easier than fighting with git.

Change-Id: I0691a3f7988db111d11d69388ace83641a841e57
Reviewed-on: https://go-review.googlesource.com/c/go/+/641360
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: Michael Knyszek <mknyszek@google.com>
2025-02-04 11:05:42 -08:00
Jakub Ciolek
46fd6b4e37 cmd/compile: remove reduntant Zero rule
These two rules produce the same output but have opposite
s%16 conditions. Consolidate them into a single rule.

Change-Id: I6daa0e7f7af4a4e59a3125b66b85f59e888586c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/640475
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>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-02-04 09:41:43 -08:00
Jakub Ciolek
bdc2d856a8 cmd/compile: use isGenericIntConst() in prove
Use the existing Value method to make it a bit shorter.

Change-Id: I47c4328b5241ab48b3490a04a3d93d4428f7b88c
Reviewed-on: https://go-review.googlesource.com/c/go/+/642735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2025-02-04 09:39:40 -08:00
Keith Randall
3981b446dd cmd/internal/sys: allow unaligned loads on big-endian ppc64
According to https://go.dev/wiki/MinimumRequirements, we've required
power8 since Go 1.9.

Before that, we supported power5 which couldn't do unaligned loads.
But power8 should be able to (it does for ppc64le).

In fact, I think we already support unaligned loads in some cases,
for instance cmd/compile/internal/ssa/config.go lists big-endian ppc64
as having unaligned loads.

Change-Id: I4a75f09d4b5199a889e0e8db0b3b7a1fa23145f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/631318
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jayanth Krishnamurthy <jayanth.krishnamurthy@ibm.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-02-04 09:39:01 -08:00
Jakub Ciolek
ef7f09149b cmd/compile: prefer hv2 <= 127 over hv2 < 128
This is shorter to encode on AMD64/x86. Shrinks a few functions and doesn't
seem to cause any regressions. No size impact on other archs.

Covers a bit more than CL 639935.

compilecmp linux/amd64:

unicode/utf8
unicode/utf8.RuneCountInString changed
unicode/utf8.RuneCount changed

unicode/utf8 [cmd/compile]
unicode/utf8.RuneCount changed
unicode/utf8.RuneCountInString changed

runtime
runtime.countrunes changed
runtime.stringtoslicerune 413 -> 379  (-8.23%)

runtime [cmd/compile]
runtime.countrunes changed
runtime.stringtoslicerune 413 -> 379  (-8.23%)

bytes
bytes.containsRune 143 -> 139  (-2.80%)
bytes.IndexAny changed
bytes.Runes 462 -> 455  (-1.52%)
bytes.trimLeftUnicode changed
bytes.trimRightUnicode 325 -> 316  (-2.77%)
bytes.LastIndexAny 1261 -> 1256  (-0.40%)
bytes.Count 524 -> 520  (-0.76%)

strings
strings.Map 1241 -> 1230  (-0.89%)
strings.TrimFunc 261 -> 255  (-2.30%)
strings.Count changed
strings.IndexRune changed
strings.TrimLeftFunc 249 -> 241  (-3.21%)
strings.explode 462 -> 441  (-4.55%)
strings.IndexAny changed
strings.ToValidUTF8 changed
strings.FieldsFunc 744 -> 741  (-0.40%)
strings.EqualFold 638 -> 625  (-2.04%)
strings.IndexFunc 185 -> 179  (-3.24%)
strings.ContainsFunc 189 -> 185  (-2.12%)
strings.indexFunc 213 -> 209  (-1.88%)

go/build/constraint
go/build/constraint.(*exprParser).lex changed
go/build/constraint.isValidTag changed

regexp/syntax
regexp/syntax.isValidCaptureName 180 -> 174  (-3.33%)
regexp/syntax.literalRegexp changed
regexp/syntax.(*parser).parsePerlFlags changed
regexp/syntax.parse changed

time
time.tzsetName 471 -> 455  (-3.40%)
time.tzsetRule 2476 -> 2444  (-1.29%)
time.tzsetNum 389 -> 365  (-6.17%)
time.quote 1239 -> 1221  (-1.45%)
time.tzsetOffset 1332 -> 1317  (-1.13%)

io/fs
io/fs.FileMode.String changed

reflect
reflect.Value.Seq2.func4 changed
reflect.Value.Seq.func4 changed
reflect.isValidFieldName 265 -> 261  (-1.51%)

bytes [cmd/compile]
bytes.Runes 462 -> 455  (-1.52%)
bytes.trimLeftUnicode changed
bytes.LastIndexAny 1261 -> 1256  (-0.40%)
bytes.IndexAny changed
bytes.trimRightUnicode 325 -> 316  (-2.77%)
bytes.Count 524 -> 520  (-0.76%)
bytes.containsRune 143 -> 139  (-2.80%)

strings [cmd/compile]
strings.indexFunc 213 -> 209  (-1.88%)
strings.IndexAny changed
strings.FieldsFunc 744 -> 741  (-0.40%)
strings.IndexRune changed
strings.Count changed
strings.IndexFunc 185 -> 179  (-3.24%)
strings.Map 1241 -> 1230  (-0.89%)
strings.TrimFunc 261 -> 255  (-2.30%)
strings.ToValidUTF8 changed
strings.explode 462 -> 441  (-4.55%)
strings.EqualFold 638 -> 625  (-2.04%)
strings.ContainsFunc 189 -> 185  (-2.12%)
strings.TrimLeftFunc 249 -> 241  (-3.21%)

go/build/constraint [cmd/compile]
go/build/constraint.(*exprParser).lex changed
go/build/constraint.isValidTag changed

regexp/syntax [cmd/compile]
regexp/syntax.literalRegexp changed
regexp/syntax.parse changed
regexp/syntax.(*parser).parsePerlFlags changed
regexp/syntax.isValidCaptureName 180 -> 174  (-3.33%)

fmt
fmt.(*ss).scanOne changed
fmt.(*ss).scanUint changed
fmt.(*ss).scanInt changed
fmt.(*fmt).pad changed
fmt.(*ss).getBase 447 -> 435  (-2.68%)
fmt.(*fmt).fmtS 217 -> 211  (-2.76%)
fmt.(*ss).consume changed
fmt.(*fmt).fmtQ 494 -> 485  (-1.82%)
fmt.(*fmt).truncateString changed
fmt.(*ss).scanComplex changed
fmt.(*ss).okVerb 410 -> 409  (-0.24%)
fmt.(*ss).convertString 447 -> 436  (-2.46%)
fmt.(*ss).peek changed
fmt.FormatString 650 -> 625  (-3.85%)
fmt.(*fmt).padString changed
fmt.(*ss).convertFloat changed
fmt.(*ss).scanBool changed
fmt.indexRune changed

time [cmd/compile]
time.tzsetNum 389 -> 365  (-6.17%)
time.tzsetOffset 1332 -> 1317  (-1.13%)
time.tzsetName 471 -> 455  (-3.40%)
time.tzsetRule 2476 -> 2444  (-1.29%)
time.quote 1239 -> 1221  (-1.45%)

net/url
net/url.validOptionalPort 189 -> 186  (-1.59%)
net/url.validUserinfo 229 -> 204  (-10.92%)
net/url.parseAuthority 972 -> 948  (-2.47%)
net/url.parseHost 1372 -> 1371  (-0.07%)
net/url.splitHostPort 584 -> 581  (-0.51%)

reflect [cmd/compile]
reflect.isValidFieldName 265 -> 261  (-1.51%)
reflect.Value.Seq2.func4 changed
reflect.Value.Seq.func4 changed

compress/gzip
compress/gzip.(*Writer).writeString changed

encoding/json
encoding/json.isValidTag 313 -> 308  (-1.60%)

testing
testing.rewrite changed
testing.(*B).ReportMetric changed

mime
mime.consumeValue 1012 -> 997  (-1.48%)
mime.isToken 180 -> 172  (-4.44%)
mime.checkMediaTypeDisposition changed
mime.FormatMediaType 6375 -> 6343  (-0.50%)
mime.consumeToken changed
mime.needsEncoding 137 -> 135  (-1.46%)
mime.WordEncoder.Encode 216 -> 210  (-2.78%)
mime.consumeMediaParam 1620 -> 1605  (-0.93%)
mime.hasNonWhitespace 142 -> 139  (-2.11%)
mime.(*WordDecoder).DecodeHeader 2643 -> 2630  (-0.49%)
mime.ParseMediaType 3037 -> 3035  (-0.07%)

go/token
go/token.IsIdentifier changed

encoding/asn1
encoding/asn1.makeField changed

text/tabwriter
text/tabwriter.(*Writer).Write 3465 -> 3454  (-0.32%)
text/tabwriter.(*Writer).updateWidth changed
text/tabwriter.(*Writer).endEscape 335 -> 327  (-2.39%)

internal/buildcfg
internal/buildcfg.goriscv64 changed

go/doc/comment
go/doc/comment.wrap 5496 -> 5489  (-0.13%)
go/doc/comment.(*Printer).Text 1033 -> 1030  (-0.29%)
go/doc/comment.validImportPath 661 -> 648  (-1.97%)
go/doc/comment.(*Heading).DefaultID changed
go/doc/comment.(*textPrinter).text 1070 -> 1069  (-0.09%)

archive/tar
archive/tar.splitUSTARPath changed
archive/tar.(*Writer).writeRawFile changed
archive/tar.(*Reader).readHeader 2416 -> 2415  (-0.04%)
archive/tar.isASCII 136 -> 133  (-2.21%)
archive/tar.Header.allowedFormats.func1 changed
archive/tar.toASCII 415 -> 393  (-5.30%)
archive/tar.(*Writer).writePAXHeader.func1 645 -> 627  (-2.79%)

crypto/x509/pkix
crypto/x509/pkix.RDNSequence.String 1502 -> 1486  (-1.07%)

go/constant
go/constant.(*stringVal).String changed

vendor/golang.org/x/net/idna
vendor/golang.org/x/net/idna.decode changed
vendor/golang.org/x/net/idna.encode 2000 -> 1968  (-1.60%)

internal/trace/raw
internal/trace/raw.readArgs 783 -> 781  (-0.26%)
internal/trace/raw.NewTextReader 1158 -> 1157  (-0.09%)
internal/trace/raw.readToken 542 -> 532  (-1.85%)

cmd/internal/objabi
cmd/internal/objabi.DecodeArg changed

cmd/internal/quoted
cmd/internal/quoted.Join changed

cmd/internal/pkgpath
cmd/internal/pkgpath.toSymbolV3 changed
cmd/internal/pkgpath.toSymbolV2 changed

testing/fstest
testing/fstest.(*fsTester).checkGlob changed

text/template
text/template.JSEscapeString changed
text/template.goodName changed

io/fs [cmd/compile]
io/fs.FileMode.String changed

go/printer
go/printer.sanitizeImportPath 470 -> 463  (-1.49%)
go/printer.(*printer).isOneLineFieldList changed
go/printer.identListSize 261 -> 254  (-2.68%)

go/doc
go/doc.assumedPackageName changed
go/doc.firstSentence changed

net
net.parseCriteria.func1 changed
net.hasUpperCase 181 -> 180  (-0.55%)
net.parsePort changed
net.lookupStaticHost changed

html/template
html/template.htmlNameFilter 251 -> 249  (-0.80%)

vendor/golang.org/x/net/http/httpguts
vendor/golang.org/x/net/http/httpguts.tokenEqual changed
vendor/golang.org/x/net/http/httpguts.headerValueContainsToken 971 -> 965  (-0.62%)

mime/multipart
mime/multipart.(*Writer).SetBoundary 510 -> 505  (-0.98%)

go/build
go/build.splitQuoted 1157 -> 1148  (-0.78%)
go/build.parseGoEmbed changed
go/build.isValidImport 203 -> 197  (-2.96%)

net/mail
net/mail.(*addrParser).parseAddress changed
net/mail.quoteString changed
net/mail.(*Address).String changed

crypto/x509
crypto/x509.(*Certificate).VerifyHostname 1020 -> 1018  (-0.20%)
crypto/x509.toLowerCaseASCII 223 -> 215  (-3.59%)
crypto/x509.matchHostnames changed
crypto/x509.validHostname 506 -> 505  (-0.20%)
crypto/x509.isIA5String 197 -> 186  (-5.58%)
crypto/x509.parseNameConstraintsExtension.func1 changed
crypto/x509.matchExactly changed
crypto/x509.parseSANExtension.func1 1996 -> 1982  (-0.70%)
crypto/x509.marshalSANs 3071 -> 3051  (-0.65%)
crypto/x509.domainToReverseLabels 820 -> 805  (-1.83%)
crypto/x509.buildCertExtensions.func2 changed
crypto/x509.(*OID).unmarshalOIDText 1359 -> 1355  (-0.29%)
crypto/x509.parseASN1String 1350 -> 1334  (-1.19%)

cmd/cgo
main.checkImportSymName changed
main.splitQuoted 1157 -> 1148  (-0.78%)

fmt [cmd/compile]
fmt.(*fmt).fmtQ 494 -> 485  (-1.82%)
fmt.(*ss).scanComplex changed
fmt.(*fmt).truncateString changed
fmt.(*fmt).pad changed
fmt.(*ss).getBase 447 -> 435  (-2.68%)
fmt.(*ss).convertFloat changed
fmt.(*fmt).padString changed
fmt.(*fmt).fmtS 217 -> 211  (-2.76%)
fmt.(*ss).scanInt changed
fmt.indexRune changed
fmt.(*ss).okVerb 410 -> 409  (-0.24%)
fmt.FormatString 650 -> 625  (-3.85%)
fmt.(*ss).consume changed
fmt.(*ss).scanUint changed
fmt.(*ss).scanOne changed
fmt.(*ss).peek changed
fmt.(*ss).convertString 447 -> 436  (-2.46%)
fmt.(*ss).scanBool changed

internal/buildcfg [cmd/compile]
internal/buildcfg.goriscv64 changed

cmd/compile/internal/base
cmd/compile/internal/base.lines.write 1451 -> 1450  (-0.07%)
cmd/compile/internal/base.isnumber 165 -> 154  (-6.67%)

go/token [cmd/compile]
go/token.IsIdentifier changed

net/url [cmd/compile]
net/url.validOptionalPort 189 -> 186  (-1.59%)
net/url.splitHostPort 584 -> 581  (-0.51%)
net/url.parseAuthority 972 -> 948  (-2.47%)
net/url.validUserinfo 229 -> 204  (-10.92%)
net/url.parseHost 1372 -> 1371  (-0.07%)

cmd/internal/objabi [cmd/compile]
cmd/internal/objabi.DecodeArg changed

text/tabwriter [cmd/compile]
text/tabwriter.(*Writer).endEscape 335 -> 327  (-2.39%)
text/tabwriter.(*Writer).updateWidth changed
text/tabwriter.(*Writer).Write 3465 -> 3454  (-0.32%)

go/doc/comment [cmd/compile]
go/doc/comment.validImportPath 661 -> 648  (-1.97%)
go/doc/comment.wrap 5496 -> 5489  (-0.13%)
go/doc/comment.(*Printer).Text 1033 -> 1030  (-0.29%)
go/doc/comment.(*textPrinter).text 1070 -> 1069  (-0.09%)
go/doc/comment.(*Heading).DefaultID changed

compress/gzip [cmd/compile]
compress/gzip.(*Writer).writeString changed

encoding/json [cmd/compile]
encoding/json.isValidTag 313 -> 308  (-1.60%)

cmd/doc
main.match 549 -> 542  (-1.28%)

go/types
go/types.validatedImportPath changed
go/types.(*Checker).lookupError 3109 -> 3082  (-0.87%)
go/types.stripAnnotations 233 -> 229  (-1.72%)
go/types.tail 153 -> 148  (-3.27%)
go/types.isValidName 345 -> 330  (-4.35%)

cmd/compile/internal/syntax
cmd/compile/internal/syntax.(*scanner).lineComment 655 -> 634  (-3.21%)
cmd/compile/internal/syntax.(*scanner).fullComment 527 -> 517  (-1.90%)

crypto/tls
crypto/tls.validDNSName changed

go/constant [cmd/compile]
go/constant.(*stringVal).String changed

cmd/go/internal/str
cmd/go/internal/str.ToFold 293 -> 278  (-5.12%)
cmd/go/internal/str.QuoteGlob changed

go/doc [cmd/compile]
go/doc.firstSentence changed
go/doc.assumedPackageName changed

cmd/compile/internal/base [cmd/compile]
cmd/compile/internal/base.lines.write 1451 -> 1450  (-0.07%)
cmd/compile/internal/base.isnumber 165 -> 154  (-6.67%)

cmd/compile/internal/syntax [cmd/compile]
cmd/compile/internal/syntax.(*scanner).fullComment 527 -> 517  (-1.90%)
cmd/compile/internal/syntax.(*scanner).lineComment changed

cmd/vendor/golang.org/x/mod/module
cmd/vendor/golang.org/x/mod/module.unescapeString 500 -> 487  (-2.60%)
cmd/vendor/golang.org/x/mod/module.escapeString 538 -> 519  (-3.53%)
cmd/vendor/golang.org/x/mod/module.checkPath changed
cmd/vendor/golang.org/x/mod/module.checkElem changed
cmd/vendor/golang.org/x/mod/module.CheckPath changed

cmd/vendor/golang.org/x/mod/sumdb/note
cmd/vendor/golang.org/x/mod/sumdb/note.isValidName 246 -> 244  (-0.81%)

cmd/go/internal/base
cmd/go/internal/base.validToolName 150 -> 142  (-5.33%)
cmd/go/internal/base.ToolPath 488 -> 474  (-2.87%)

cmd/go/internal/imports
cmd/go/internal/imports.matchTag changed

go/build [cmd/compile]
go/build.isValidImport 203 -> 197  (-2.96%)
go/build.splitQuoted 1157 -> 1148  (-0.78%)
go/build.parseGoEmbed changed

cmd/vendor/golang.org/x/mod/modfile
cmd/vendor/golang.org/x/mod/modfile.Position.add 421 -> 412  (-2.14%)
cmd/vendor/golang.org/x/mod/modfile.MustQuote 380 -> 372  (-2.11%)

cmd/vendor/golang.org/x/mod/zip
cmd/vendor/golang.org/x/mod/zip.strToFold changed

cmd/link/internal/benchmark
cmd/link/internal/benchmark.makeBenchString 476 -> 453  (-4.83%)

cmd/internal/script
cmd/internal/script.wrapLine 773 -> 766  (-0.91%)

cmd/compile/internal/ir
cmd/compile/internal/ir.splitPkg changed
cmd/compile/internal/ir.splitType changed
cmd/compile/internal/ir.LookupMethodSelector changed

cmd/go/internal/modindex
cmd/go/internal/modindex.parseGoEmbed changed
cmd/go/internal/modindex.splitQuoted 1157 -> 1148  (-0.78%)

cmd/pack
main.setOp 325 -> 308  (-5.23%)

cmd/vendor/golang.org/x/term
cmd/vendor/golang.org/x/term.(*Terminal).handleKey changed

cmd/compile/internal/types2
cmd/compile/internal/types2.validatedImportPath changed
cmd/compile/internal/types2.tail 153 -> 148  (-3.27%)
cmd/compile/internal/types2.(*Checker).lookupError 3717 -> 3690  (-0.73%)
cmd/compile/internal/types2.isValidName 345 -> 330  (-4.35%)
cmd/compile/internal/types2.stripAnnotations 233 -> 229  (-1.72%)

net/http
net/http.NewRequestWithContext 2251 -> 2245  (-0.27%)
net/http.isValidWildcardName 357 -> 351  (-1.68%)
net/http.ParseCookie 1100 -> 1099  (-0.09%)
net/http.ParseSetCookie changed
net/http.readCookies changed
net/http.(*http2Framer).readMetaFrame.func1 changed
net/http.isCookieNameValid changed
net/http.(*Cookie).String changed
net/http.(*Cookie).Valid changed
net/http.validMethod changed
net/http.parsePattern 4343 -> 4330  (-0.30%)
net/http.http2validWireHeaderFieldName changed
net/http.http2encodeHeaders changed
net/http.(*Transport).roundTrip changed

cmd/compile/internal/types2 [cmd/compile]
cmd/compile/internal/types2.validatedImportPath changed
cmd/compile/internal/types2.stripAnnotations 233 -> 229  (-1.72%)
cmd/compile/internal/types2.tail 153 -> 148  (-3.27%)
cmd/compile/internal/types2.(*Checker).lookupError 3717 -> 3690  (-0.73%)
cmd/compile/internal/types2.isValidName 345 -> 330  (-4.35%)

cmd/compile/internal/ir [cmd/compile]
cmd/compile/internal/ir.LookupMethodSelector changed
cmd/compile/internal/ir.splitType changed
cmd/compile/internal/ir.splitPkg changed

cmd/compile/internal/typecheck
cmd/compile/internal/typecheck.stringtoruneslit changed

net/http/cookiejar
net/http/cookiejar.encode 1944 -> 1936  (-0.41%)

expvar
expvar.appendJSONQuote changed

cmd/go/internal/web
cmd/go/internal/web.(*Response).formatErrorDetail 1552 -> 1529  (-1.48%)

cmd/vendor/golang.org/x/text/internal/language
cmd/vendor/golang.org/x/text/internal/language.Parse 1102 -> 1099  (-0.27%)

cmd/vendor/golang.org/x/tools/go/analysis
cmd/vendor/golang.org/x/tools/go/analysis.validIdent 351 -> 346  (-1.42%)

cmd/compile/internal/typecheck [cmd/compile]
cmd/compile/internal/typecheck.stringtoruneslit changed

cmd/vendor/github.com/google/pprof/internal/report
cmd/vendor/github.com/google/pprof/internal/report.rightPad 377 -> 365  (-3.18%)
cmd/vendor/github.com/google/pprof/internal/report.indentation 169 -> 165  (-2.37%)
cmd/vendor/github.com/google/pprof/internal/report.makeWebListLine changed

cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag
cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag.(*checker).plusBuildLine changed

cmd/vendor/golang.org/x/tools/go/analysis/passes/directive
cmd/vendor/golang.org/x/tools/go/analysis/passes/directive.(*checker).comment changed

cmd/vendor/rsc.io/markdown
cmd/vendor/rsc.io/markdown.(*CodeBlock).PrintHTML changed
cmd/vendor/rsc.io/markdown.(*Code).printMarkdown changed
cmd/vendor/rsc.io/markdown.newATXHeading changed
cmd/vendor/rsc.io/markdown.longestSequence 249 -> 237  (-4.82%)
cmd/vendor/rsc.io/markdown.newFence changed

cmd/link/internal/ld
cmd/link/internal/ld.methodref.isExported changed

cmd/go/internal/modload
cmd/go/internal/modload.ShortMessage changed

cmd/go/internal/work
cmd/go/internal/work.encodeArg changed

cmd/compile/internal/walk
cmd/compile/internal/walk.rangeAssign2 changed
cmd/compile/internal/walk.arrayRangeClear changed
cmd/compile/internal/walk.rangeAssign changed
cmd/compile/internal/walk.mapClear changed
cmd/compile/internal/walk.arrayClear changed
cmd/compile/internal/walk.isMapClear changed
cmd/compile/internal/walk.walkRange 15218 -> 15538  (+2.10%)
cmd/compile/internal/walk.mapRangeClear changed
cmd/compile/internal/walk.mapRangeClear.func1 changed
cmd/compile/internal/walk.rangeConvert changed

cmd/compile/internal/noder
cmd/compile/internal/noder.checkImportPath changed
cmd/compile/internal/noder.pragmaFields changed
cmd/compile/internal/noder.parseGoEmbed 1309 -> 1300  (-0.69%)

cmd/compile/internal/walk [cmd/compile]
cmd/compile/internal/walk.mapRangeClear changed
cmd/compile/internal/walk.rangeAssign2 changed
cmd/compile/internal/walk.arrayClear changed
cmd/compile/internal/walk.arrayRangeClear changed
cmd/compile/internal/walk.walkRange 14789 -> 15109  (+2.16%)
cmd/compile/internal/walk.mapRangeClear.func1 changed
cmd/compile/internal/walk.rangeConvert changed
cmd/compile/internal/walk.mapClear changed
cmd/compile/internal/walk.isMapClear changed
cmd/compile/internal/walk.rangeAssign changed

cmd/compile/internal/noder [cmd/compile]
cmd/compile/internal/noder.pragmaFields changed
cmd/compile/internal/noder.parseGoEmbed 1309 -> 1300  (-0.69%)
cmd/compile/internal/noder.checkImportPath changed

file                                                 before   after    Δ       %
runtime.s                                            577251   577217   -34     -0.006%
runtime [cmd/compile].s                              642419   642385   -34     -0.005%
bytes.s                                              36806    36777    -29     -0.079%
strings.s                                            44176    44100    -76     -0.172%
regexp/syntax.s                                      81719    81713    -6      -0.007%
time.s                                               94341    94236    -105    -0.111%
reflect.s                                            180291   180287   -4      -0.002%
bytes [cmd/compile].s                                38181    38152    -29     -0.076%
strings [cmd/compile].s                              44192    44116    -76     -0.172%
regexp/syntax [cmd/compile].s                        81719    81713    -6      -0.007%
fmt.s                                                75019    74955    -64     -0.085%
time [cmd/compile].s                                 94341    94236    -105    -0.111%
net/url.s                                            37111    37055    -56     -0.151%
reflect [cmd/compile].s                              180340   180336   -4      -0.002%
encoding/json.s                                      110294   110289   -5      -0.005%
mime.s                                               47009    46913    -96     -0.204%
text/tabwriter.s                                     9538     9519     -19     -0.199%
go/doc/comment.s                                     49401    49377    -24     -0.049%
archive/tar.s                                        71994    71950    -44     -0.061%
crypto/x509/pkix.s                                   8493     8477     -16     -0.188%
vendor/golang.org/x/net/idna.s                       21271    21239    -32     -0.150%
internal/trace/raw.s                                 15413    15400    -13     -0.084%
go/printer.s                                         93669    93655    -14     -0.015%
net.s                                                299569   299568   -1      -0.000%
html/template.s                                      97069    97067    -2      -0.002%
vendor/golang.org/x/net/http/httpguts.s              3187     3181     -6      -0.188%
mime/multipart.s                                     31070    31065    -5      -0.016%
go/build.s                                           75077    75062    -15     -0.020%
crypto/x509.s                                        177195   177104   -91     -0.051%
cmd/cgo.s                                            215638   215629   -9      -0.004%
fmt [cmd/compile].s                                  86358    86294    -64     -0.074%
cmd/compile/internal/base.s                          44380    44368    -12     -0.027%
net/url [cmd/compile].s                              37222    37166    -56     -0.150%
text/tabwriter [cmd/compile].s                       9649     9630     -19     -0.197%
go/doc/comment [cmd/compile].s                       49512    49488    -24     -0.048%
encoding/json [cmd/compile].s                        110712   110707   -5      -0.005%
cmd/doc.s                                            54581    54574    -7      -0.013%
go/types.s                                           558219   558168   -51     -0.009%
cmd/compile/internal/syntax.s                        181755   181724   -31     -0.017%
cmd/go/internal/str.s                                3166     3151     -15     -0.474%
cmd/compile/internal/base [cmd/compile].s            44589    44577    -12     -0.027%
cmd/compile/internal/syntax [cmd/compile].s          196105   196095   -10     -0.005%
cmd/vendor/golang.org/x/mod/module.s                 19140    19108    -32     -0.167%
cmd/vendor/golang.org/x/mod/sumdb/note.s             12831    12829    -2      -0.016%
cmd/go/internal/base.s                               20413    20391    -22     -0.108%
go/build [cmd/compile].s                             75188    75173    -15     -0.020%
cmd/vendor/golang.org/x/mod/modfile.s                116513   116496   -17     -0.015%
cmd/link/internal/benchmark.s                        4068     4045     -23     -0.565%
cmd/internal/script.s                                83442    83435    -7      -0.008%
cmd/go/internal/modindex.s                           83527    83518    -9      -0.011%
cmd/pack.s                                           9128     9111     -17     -0.186%
cmd/compile/internal/types2.s                        540279   540228   -51     -0.009%
net/http.s                                           620639   620613   -26     -0.004%
cmd/compile/internal/types2 [cmd/compile].s          577279   577228   -51     -0.009%
net/http/cookiejar.s                                 28569    28561    -8      -0.028%
cmd/go/internal/web.s                                16316    16293    -23     -0.141%
cmd/vendor/golang.org/x/text/internal/language.s     57819    57816    -3      -0.005%
cmd/vendor/golang.org/x/tools/go/analysis.s          5528     5523     -5      -0.090%
cmd/vendor/github.com/google/pprof/internal/report.s 83881    83865    -16     -0.019%
cmd/vendor/rsc.io/markdown.s                         117312   117300   -12     -0.010%
cmd/compile/internal/walk.s                          329328   329648   +320    +0.097%
cmd/compile/internal/noder.s                         262295   262286   -9      -0.003%
cmd/compile/internal/walk [cmd/compile].s            350300   350620   +320    +0.091%
cmd/compile/internal/noder [cmd/compile].s           298464   298455   -9      -0.003%
total                                                36179015 36177972 -1043   -0.003%

Change-Id: I191371db975761c24e53bb83bef0c42fa8ba3485
Reviewed-on: https://go-review.googlesource.com/c/go/+/641758
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-04 09:38:04 -08:00
Robert Griesemer
b07b20fbb5 spec: remove reference to Go 1.17 spec
Also, delete go1.17_spec.html.

Change-Id: I7c78029dcfbbe8dbabb4ca81052976c1c8f4ed9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/645717
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
2025-02-03 15:44:27 -08:00
Robert Griesemer
ad7b46ee4a go/parser, go/types, syntax, types2: report invalid uses of ... by parsers
Check correct use of ...'s in parameter lists in parsers.
This allows the type checkers to assume correct ASTs with
respect to ... use.

Adjust some error messages: if a ... is used in a result
parameter list, the error is now more accurate.

Eliminate a now unused error code.

Change-Id: I66058e114e84805e24c59e570604b607ef5ff1fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/631135
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2025-02-03 14:04:09 -08:00
Ian Lance Taylor
d96fd2e758 cmd/go: update new test for removal of nocoverageredesign
The new test was committed after the removal was tested.

For #51430
For #65570
For #70244

Change-Id: I5f94c36a68ea96ba76d018dc06a5a233ad684aa5
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/646355
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2025-02-03 13:59:54 -08:00
Robert Griesemer
64eed8ef1d go/parser: refactor parameter parsing (cleanup)
Refactor parser.parseParameters to only parse
ordinary parameters. Introduce a variant to
parse type parameters.

In the two places where we need ordinary and type
parameters, call the function twice.

Also, use a range loop in two places which is a
bit easier to read.

Change-Id: I0a62e1c508d6ccd16b7cb6e1b852ab1d32224ec2
Reviewed-on: https://go-review.googlesource.com/c/go/+/630816
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Commit-Queue: Robert Griesemer <gri@google.com>
2025-02-03 13:45:49 -08:00
Ian Lance Taylor
530c829270 syscall: use consistent message for ESTALE on Linux
For some reason the ESTALE error message differed on Linux systems.
On Linux strerror normally returns "Stale file handle" for ESTALE,
except possibly in the en_GB locale. The mkerrors.sh script sets
LC_ALL=C, so it should always produces "stale file handle".
However, for some reason, several targets use "stale NFS file handle"
instead.

Clean this up so that we use the same string on all Linux systems.
This is also consistent with golang.org/x/sys/unix.

Fixes #71309

Change-Id: Ic2ffaf114c85112bc6d0831e43dd5fd2f4237bc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/643335
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2025-02-03 12:11:17 -08:00
Ian Lance Taylor
4160ebf28f net: permit Interface with no Name
On darwin the utun interface sometimes has no name.

Fixes #71064

Change-Id: Iec51641880515f8bd3f97bd892c26f68fd588fa3
Reviewed-on: https://go-review.googlesource.com/c/go/+/641855
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: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-02-03 12:11:12 -08:00
Ian Lance Taylor
dcebb675b3 internal/routebsd: simplify for standard library
Discard everything we don't need from x/net/route.

Change-Id: If6a4ecb37e5e2349bc4df46c151990719a14f2c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/637696
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: 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>
Commit-Queue: Ian Lance Taylor <iant@google.com>
2025-02-03 12:11:07 -08:00
Ian Lance Taylor
c1a5889edb net, internal/routebsd: move vendored x/net/route to internal
This is a simple move of the contents of the vendored x/net/route
to internal/routebsd. I've also added some test files that
were not previously vendored.

This next CL will simplify the new internal/routebsd, removing the
code that is not needed by the new package.

This is a step toward simplifying the x/net/route package by
permitting it to import x/sys/unix.

Change-Id: I4d13df11fa9738cd68876b2ea456d03f82d8d64a
Reviewed-on: https://go-review.googlesource.com/c/go/+/637695
Commit-Queue: 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@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2025-02-03 12:11:04 -08:00
Ian Lance Taylor
41298239cf all: remove coverageredesign experiment
The coverageredesign experiment was turned on by default by
CL 436236 in September, 2022. We've documented it and people
are using it. This CL removes the ability to turn off the experiment.
This removes some old code that is no longer being executed.

For #51430

Change-Id: I88d4998c8b5ea98eef8145d7ca6ebd96f64fbc2b
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-darwin-amd64-longtest,gotip-linux-arm64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/644997
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: Than McIntosh <thanm@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
2025-02-03 12:10:28 -08:00
qmuntal
26c59d3153 crypto/internal/fips140/sha3/_asm: remove unnecessary x/crypto dependency
There is no need to blank-import golang.org/x/crypto/sha3, as we are not
using any crypto.SHA3 variant in the code.

Change-Id: Ia5455647f737371fc4ec0972bf9a90d5ee854495
Reviewed-on: https://go-review.googlesource.com/c/go/+/637055
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-03 10:59:30 -08:00
Sean Liao
439d39a719 all: replace reflect.Value.Type.Kind with reflect.Value.Kind
Fixes #46107

Change-Id: I170f3cacda652752cd740e04b565a616a0e43fd1
Reviewed-on: https://go-review.googlesource.com/c/go/+/632635
Reviewed-by: Rob Pike <r@golang.org>
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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2025-02-03 10:30:40 -08:00
Ian Lance Taylor
82337de9f2 test/issue71226: add cast to avoid clang error
Change-Id: I2d8ecb7b5f48943697d454d09947fdb1817809d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/646295
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2025-02-03 10:14:38 -08:00
Ian Lance Taylor
77f5ecef3a all: run gofmt
Change-Id: I0af1903ed1e4f2bf4ea273847b024520c577ef6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/642496
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>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2025-02-03 09:55:31 -08:00
Michael Matloob
66e6f5c920 cmd/doc: add support for starting pkgsite instance for docs
This change adds a new flag "-http" to cmd/doc which enables starting
a pkgsite instance. -http will start a pkgsite instance and navigate to
the page for the requested package, at the anchor for the item
requested.

For #68106

Change-Id: Ic1c113795cb2e1035e99c89c8e972c799342385b
Reviewed-on: https://go-review.googlesource.com/c/go/+/628175
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-02-03 09:26:03 -08:00
cuishuang
39ceaf7961 all: use slices.Contains to simplify code
Change-Id: I9ef075bbb0e3c65f3c2a9d49e599ef50b18aa9be
Reviewed-on: https://go-review.googlesource.com/c/go/+/639535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2025-02-03 08:47:55 -08:00
Sean Liao
3caf5bd09e text/scanner: add required ScanComments in example
Fixes #71133

Change-Id: I11f792bf4cb275e7bc3585cd92a4b327a3b6e368
Reviewed-on: https://go-review.googlesource.com/c/go/+/646036
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: Cherry Mui <cherryyz@google.com>
2025-02-03 08:46:25 -08:00
cuishuang
3a81ebea0d net/http: use strings.FieldsFuncSeq to reduce memory allocations
After using strings.FieldsFuncSeq, the number of memory allocations has been reduced from 2 to 0.

The following is the complete benchamark code and results:

package main

import (
	"strings"
	"testing"
)

func isSlashRune(r rune) bool { return r == '/' || r == '\\' }

func containsDotDotLoop(v string) bool {
	if !strings.Contains(v, "..") {
		return false
	}
	for _, ent := range strings.FieldsFunc(v, isSlashRune) {
		if ent == ".." {
			return true
		}
	}
	return false
}

func containsDotDotSeq(v string) bool {
	if !strings.Contains(v, "..") {
		return false
	}
	for ent := range strings.FieldsFuncSeq(v, isSlashRune) {
		if ent == ".." {
			return true
		}
	}
	return false
}

func BenchmarkDotDot(b *testing.B) {
	testCases := []string{
		"/path/to/somewhere",
		"/path/../to/somewhere",
		"/really/long/path/with/many/segments",
		"../../../deep/path",
	}

	b.Run("Loop", func(b *testing.B) {
		for i := 0; i < b.N; i++ {
			for _, tc := range testCases {
				containsDotDotLoop(tc)
			}
		}
	})

	b.Run("Seq", func(b *testing.B) {
		for i := 0; i < b.N; i++ {
			for _, tc := range testCases {
				containsDotDotSeq(tc)
			}
		}
	})
}

go test -bench=. -benchmem

goos: darwin
goarch: arm64
pkg: bc
cpu: Apple M1
BenchmarkDotDot/Loop-8         	 6133270	       193.7 ns/op	     144 B/op	       2 allocs/op
BenchmarkDotDot/Seq-8          	23172360	        51.19 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	bc	2.633s

Change-Id: I529c296e701b22710e21b53877aa798799980a3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/639536
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: Cherry Mui <cherryyz@google.com>
2025-02-03 08:46:19 -08:00
Jakub Ciolek
691b7ff1c7 internal/fuzz: use a lookup table for SnapshotCoverage
Previously, the implementation used bit manipulation to approximate
counters to the nearest power of two.

Given the 0-255 range of byte, we can precompute values at
initialization and use a lookup table, reducing runtime computation.

Benchmarks show an 18% performance gain on AMD64 and 5% on ARM64.

* net/netip/FuzzParse (n=10, t=60s, state reset per run)
  * AMD64 (Intel Alder Lake i5-12600k):

    17,349,217 -> 20,487,756 execs/s

  * ARM64 (M3 Pro):

    19,606,471 -> 20,657,041 execs/s

* compress/gzip/FuzzReader (n=10, t=60s, mature corpus)
  * AMD64 (Intel Alder Lake i5-12600k):

    5,655,956 -> 6,707,035 execs/s

Change-Id: If11f7fe866f54c7cd2c5a48e251c027b67980df7
Reviewed-on: https://go-review.googlesource.com/c/go/+/627378
Reviewed-by: Cherry Mui <cherryyz@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>
2025-02-03 08:46:08 -08:00
qmuntal
52e32ad79e crypto/x509/internal/macos: remove unused types and functions
Some of the types and functions in the macos package are unused since
CL 353132. They can be removed.

Change-Id: Ifb7c9619d3c77b83852e785b82877dfa3ca8fe6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/643277
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-02-03 08:44:32 -08:00
Diego Lara
1118da2514 text/template improved comparison error addresses issue #71421
Addresses issue #71421, improves the error message given for comparison. Previous error message did not specify the types causing conflict, just said incompatible types, new error message specifies the two types causing the issue.

Change-Id: I9d940ab7573c2763a9d052445140ecd6d38cde5e
GitHub-Last-Rev: 6fe7d8101317ea616fd9a8f3f430874b5f946d3e
GitHub-Pull-Request: golang/go#71431
Reviewed-on: https://go-review.googlesource.com/c/go/+/644175
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Rob Pike <r@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>
2025-02-03 08:43:47 -08:00
Jakub Ciolek
e57769d5ad cmd/compile: on AMD64, prefer XOR/AND for (x & 1) == 0 check
It's shorter to encode. Additionally, XOR and AND generally
have higher throughput than BT/SET*.

compilecmp:

runtime
runtime.(*sweepClass).split 58 -> 56  (-3.45%)
runtime.sweepClass.split 14 -> 11  (-21.43%)

runtime [cmd/compile]
runtime.(*sweepClass).split 58 -> 56  (-3.45%)
runtime.sweepClass.split 14 -> 11  (-21.43%)

strconv
strconv.ryuFtoaShortest changed

strconv [cmd/compile]
strconv.ryuFtoaShortest changed

math/big
math/big.(*Int).MulRange 255 -> 252  (-1.18%)

testing/quick
testing/quick.sizedValue changed

internal/fuzz
internal/fuzz.(*pcgRand).bool 69 -> 70  (+1.45%)

cmd/internal/obj/x86
cmd/internal/obj/x86.(*AsmBuf).asmevex changed

math/big [cmd/compile]
math/big.(*Int).MulRange 255 -> 252  (-1.18%)

cmd/internal/obj/x86 [cmd/compile]
cmd/internal/obj/x86.(*AsmBuf).asmevex changed

net/http
net/http.(*http2stream).isPushed 11 -> 10  (-9.09%)

cmd/vendor/github.com/google/pprof/internal/binutils
cmd/vendor/github.com/google/pprof/internal/binutils.(*file).computeBase changed

Change-Id: I9cb2987eb263c85ee4e93d6f8455c91a55273173
Reviewed-on: https://go-review.googlesource.com/c/go/+/640975
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-03 08:42:01 -08:00
Jakub Ciolek
f7dbbf2519 cmd/compile: distribute 8 and 16-bit multiplication
Expand the existing rule to cover 8 and 16 bit variants.

compilecmp linux/amd64:

time
time.parseStrictRFC3339.func1 80 -> 70  (-12.50%)
time.Time.appendStrictRFC3339.func1 80 -> 70  (-12.50%)
time.Time.appendStrictRFC3339 439 -> 428  (-2.51%)

time [cmd/compile]
time.parseStrictRFC3339.func1 80 -> 70  (-12.50%)
time.Time.appendStrictRFC3339.func1 80 -> 70  (-12.50%)
time.Time.appendStrictRFC3339 439 -> 428  (-2.51%)

linux/arm64:

time
time.parseStrictRFC3339.func1 changed
time.Time.appendStrictRFC3339.func1 changed
time.Time.appendStrictRFC3339 416 -> 400  (-3.85%)

time [cmd/compile]
time.Time.appendStrictRFC3339 416 -> 400  (-3.85%)
time.parseStrictRFC3339.func1 changed
time.Time.appendStrictRFC3339.func1 changed

Change-Id: I0ad3b2363a9fe8c322dd05fbc13bf151a146d8cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/641756
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2025-02-03 08:41:08 -08:00
Roxy Light
f7b8dd9033 io/fs: add ReadLinkFS interface
Added implementations for *io/fs.subFS, os.DirFS, and testing/fstest.MapFS.
Amended testing/fstest.TestFS to check behavior.

Addressed TODOs in archive/tar and os.CopyFS around symbolic links.

I am deliberately not changing archive/zip in this CL,
since it currently does not resolve symlinks
as part of its filesystem implementation.
I am unsure of the compatibility restrictions on doing so,
so figured it would be better to address independently.

testing/fstest.MapFS now includes resolution of symlinks,
with MapFile.Data storing the symlink data.
The behavior change there seemed less intrusive,
especially given its intended usage in tests,
and it is especially helpful in testing the io/fs function implementations.

Fixes #49580

Change-Id: I58ec6915e8cc97341cdbfd9c24c67d1b60139447
Reviewed-on: https://go-review.googlesource.com/c/go/+/385534
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Funda Secgin <fundasecgin33@gmail.com>
2025-02-03 08:38:43 -08:00
Tobias Klauser
9896da303a internal/poll: use ignoringEINTR2 in (*FD).Pread
Change-Id: I2af5f3f039b6c0e8e77484bd6b2cdb88e919a85d
Reviewed-on: https://go-review.googlesource.com/c/go/+/641759
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2025-02-03 08:34:15 -08:00
Eng Zer Jun
cc874072f3 math/big: use built-in max function
Change-Id: I65721039dab311762e55c6a60dd75b82f6b4622f
Reviewed-on: https://go-review.googlesource.com/c/go/+/642335
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2025-02-03 08:25:31 -08:00
Ian Lance Taylor
6adf54a3eb cmd/cgo: declare _GoString{Len,Ptr} in _cgo_export.h
Fixes #71226

Change-Id: I91c46a4310a9c7a9fcd1e3a131ca16e46949edb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/642235
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2025-02-03 08:24:48 -08:00