aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-07-14[release-branch.go1.21] go1.21rc3go1.21rc3Gopher Robot
Change-Id: Ibab6e2a998d5b57fcae923fa0627037846af1492 Reviewed-on: https://go-review.googlesource.com/c/go/+/509775 Reviewed-by: Eli Bendersky <eliben@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Gopher Robot <gobot@golang.org> Auto-Submit: Gopher Robot <gobot@golang.org>
2023-07-13[release-branch.go1.21] all: merge master (b88bd91) into release-branch.go1.21Cherry Mui
Merge List: + 2023-07-13 b88bd917b8 cmd/go/internal/modfetch: always allow Stat for the current toolchain to succeed + 2023-07-13 d4f0d896a6 net/http: revert stray edit to h2_bundle.go from CL 508996 + 2023-07-13 4a0f51696e all: remove duplicate word and fix comment + 2023-07-12 49d42128fd all: fix typos and remove repeated words Change-Id: Ie4f17f633483d5cd1d244b6e7cde6422dc246d9e
2023-07-13cmd/go/internal/modfetch: always allow Stat for the current toolchain to succeedBryan C. Mills
This fixes a failure mode observed in TestScript/gotoolchain_version when building go1.21rc3. Updates #61259. Change-Id: Ifb14a5b94b687adea7a26c1155591e3ae75b7a62 Reviewed-on: https://go-review.googlesource.com/c/go/+/509217 Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com>
2023-07-13net/http: revert stray edit to h2_bundle.go from CL 508996Bryan C. Mills
h2_bundle.go is generated from x/net/http2, so it must not be edited manually. Change-Id: If76716ce8baf581321358734e5b8bef3541632ca Reviewed-on: https://go-review.googlesource.com/c/go/+/508922 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Bryan Mills <bcmills@google.com>
2023-07-13all: remove duplicate word and fix commentcui fliter
Change-Id: I3302b94a47f384ec2519d08af50b3b5725c5b42a Reviewed-on: https://go-review.googlesource.com/c/go/+/508995 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: shuang cui <imcusg@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-07-12all: fix typos and remove repeated wordsDan Kortschak
Change-Id: I5f06a4ef1d827eb0fe32a8d98444142108b0d573 Reviewed-on: https://go-review.googlesource.com/c/go/+/508996 Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Keith Randall <khr@google.com>
2023-07-12[release-branch.go1.21] all: merge master (6244b19) into release-branch.go1.21Cherry Mui
Merge List: + 2023-07-12 6244b1946b all: update vendored dependencies + 2023-07-12 b4872ea187 cmd/go: fix go get go@badversion + 2023-07-12 87350393e6 cmd/go: fix GOTOOLCHAIN parsing for +auto + 2023-07-12 230e549142 doc/go1.21: add a release note for CL 463177 + 2023-07-12 5e4000ad7f cmd/compile: on PPC64, fix sign/zero extension when masking + 2023-07-11 af8f94e3c5 src/README.vendor: s/latest/master/ + 2023-07-11 3eaee3d5dd testing/slogtest: check for no group with empty record + 2023-07-11 167c8b73bf net/http/fcgi: eliminate goroutine leaks in tests + 2023-07-11 cb7a091d72 os/exec: ignore context.Canceled errors in TestConcurrentExec + 2023-07-11 651869716a log/slog: replace nil contexts with context.Background() + 2023-07-11 3f8b04bfb5 log/slog: change XXXCtx functions to XXXContext + 2023-07-11 4c58d6bf52 time: increase arbitrary upper bound in TestReset to 10s + 2023-07-11 6a063b01b0 net: mptcp: force using MPTCP with GODEBUG + 2023-07-10 07ede7a543 syscall: serialize locks on ForkLock on platforms where forkExecPipe is not atomic + 2023-07-10 7dc62f3bda test: add test cases for index value with range array clear + 2023-07-10 0b65b02ba5 cmd/compile: fix clear on slice with zero size elem + 2023-07-10 c4db811e44 cmd/compile: don't ICE on unaligned offsets for pointer writes + 2023-07-07 5c15498609 os: support reading empty root directories on Windows + 2023-07-07 894d24d617 src/database/sql: run gofmt + 2023-07-07 ac9137f8d3 go/types, types2: do not mutate arguments in NewChecker + 2023-07-07 158d11196f math: add test that covers riscv64 fnm{add,sub} codegen + 2023-07-07 d3d78b4bcc log/slog: handle recursively empty groups + 2023-07-06 39c5070712 os: do not skip directory entries with zero inodes on wasip1 + 2023-07-06 e6ec2a34dc runtime: print output on failure in TestMemPprof + 2023-07-06 449ef3795d net: only build cgo_stub.go on unix or wasip1 + 2023-07-06 6305d7fdd3 cmd/go: pass GoVersion in vet config + 2023-07-06 b490bdc27d go/types: record Config.GoVersion for reporting in Package.GoVersion method + 2023-07-06 36ea4f9680 log/slog: fix faulty test + 2023-07-05 3fce111535 cmd/compile: fix FMA negative commutativity of riscv64 + 2023-07-05 c8dad424bf math: fix portable FMA when x*y < 0 and x*y == -z + 2023-07-05 cd6676126b database/sql: prevent internal context error from being returned from Rows.Err() + 2023-07-05 b2215e49c7 runtime,runtime/metrics: clarify OS stack metrics + 2023-07-04 e126572f8a runtime: have ReadMemStats do a nil check before switching stacks + 2023-07-04 e4ed92a355 os, syscall: update unreachable link about =C: envs + 2023-07-04 5c1a15df41 test/codegen: enable Mul2 DivPow2 test for riscv64 + 2023-06-30 5b72f45dd1 runtime: check GOFLAGS not GCFLAGS + 2023-06-29 18e17e2cb1 net: enable pure Go resolver for wasip1 + 2023-06-29 1e97c51536 syscall: stub Getrlimit on wasip1 + 2023-06-29 683f51d307 cmd/asm/internal/lex: fix comment, remove the first "has" + 2023-06-29 2db31efdba cmd/compile/internal/types2: make TestIssue43124 match the go/types version + 2023-06-29 499458f7ca net/http: validate Host header before sending + 2023-06-29 fe73c186eb cmd/{go,compile}: run gofmt + 2023-06-29 da5d8fdd0c runtime: run wasip1 tests with wazero + 2023-06-29 411c99671a slices, maps: add examples; doc comment fixes + 2023-06-29 03cd8a7b0e internal/bytealg: fix alignment code in equal_riscv64.s + 2023-06-28 8b5fe5980c cmd/compile: handle min/max correctly in mayCall + 2023-06-28 79d4defa75 cmd/compile/internal/ssagen: fix min/max codegen, again + 2023-06-28 a3093eca64 cmd/go: enable slog vet check during 'go test' + 2023-06-27 6691f438c3 cmd/dist, internal/abi: support bootstrapping with gccgo + 2023-06-27 942c1c12d8 runtime: fix trace.Stop deadlock when built with faketime + 2023-06-27 4ad4128d3c cmd/compile: fix bad order of evaluation for min/max builtin + 2023-06-27 4f36f7e4dd encoding: document that base32 and base64 do not use UTF-8 + 2023-06-27 8008c0840f syscall: clarify which handles are affected by SysProcAttr.NoInheritHandles + 2023-06-27 13529cc5f4 syscall: try non-blocking stdio on wasip1 + 2023-06-26 1dbbafc70f go/types, types2: replace TODO with clarifying comment + 2023-06-26 7cc0740596 slices: add godoc links + 2023-06-26 d49017a7c3 go/types, types2: fix interface unification + 2023-06-26 b3ca8d2b3c types2, go/types: record final type for min/max arguments + 2023-06-26 ee361ce66c go/types, types2: more readable inference trace + 2023-06-26 9f6e87ff74 doc/go1.21: document changes in crypto/x509 + 2023-06-26 f5015b5164 doc/go1.21: context.Background and TODO may now appear equal + 2023-06-24 a031f4ef83 cmd/compile: fix min/max builtin code generation + 2023-06-24 ea927e560d slices: clarify MinFunc/MaxFunc result for equal elements + 2023-06-23 3619255777 crypto/x509: rename duplicated test + 2023-06-23 48dbb6227a runtime: set raceignore to zero when starting a new goroutine + 2023-06-23 3adcce5ae7 crypto: document non-determinism of GenerateKey + 2023-06-23 6dce882b3a cmd/compile: scanning closures body when visiting wrapper function + 2023-06-23 164aceea08 log/slog: fix broken link to AnyValue in comment + 2023-06-23 82e17c4d11 log/slog: fix broken link to Record.Clone in package docs + 2023-06-22 25e46693a1 cmd/go: impersonate 'go tool dist list' if 'go tool dist' is not present + 2023-06-22 f8616b8484 internal/platform,cmd/dist: export the list of supported platforms + 2023-06-22 51885c1fa2 cmd/{go,cover}: enable response file args for cmd/cover + 2023-06-22 3479e1e543 internal/fuzz: fix typo in comment + 2023-06-22 20313660f5 crypto/x509: tolerate multiple matching chains in testVerify + 2023-06-21 78c3aba470 net/mail: permit more characters in mail headers + 2023-06-21 633b742ae0 test: add test that caused a gofrontend crash + 2023-06-21 ad2c517708 doc/go1.21: correct GOOS to GOARCH (another location) + 2023-06-21 b23cae8095 doc/go1.21: correct GOOS to GOARCH + 2023-06-21 b1f1fb2950 go/types, types2: avoid spurious "declared and not used" error + 2023-06-21 e45202f215 runtime: relate GODEBUG=gctrace output to runtime/metrics + 2023-06-21 36edde9d9f cmd/go: shorten longest 5 tests + 2023-06-21 413e6c0499 cmd/compile/internal/ir: typo + 2023-06-20 f3bf18117b log/slog: fix HandlerOptions.ReplaceAttr doc + 2023-06-20 e122ebabb6 encoding/binary: on invalid type return -1 from Size + 2023-06-20 8484f2fe02 cmd/go: add comment for intentional misspelling Change-Id: Ie91c398dde7ca2a210b286c7865d3e7a905d6ea9
2023-07-12all: update vendored dependenciesRuss Cox
Generated by: go install golang.org/x/tools/cmd/bundle@latest go install golang.org/x/build/cmd/updatestd@latest updatestd -goroot=$GOROOT -branch=master For #36905. For #55079. Fixes #61174 (vet checkers understanding Go language version). Fixes #61200 (slog InfoCtx -> InfoContext etc). Change-Id: I4f2c86960ce72d6df06e23da1b1297ab3ff2eecf Reviewed-on: https://go-review.googlesource.com/c/go/+/509099 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com>
2023-07-12cmd/go: fix go get go@badversionRuss Cox
It was panicking instead of printing a nice error. Fixes #61258. Fixes #61259. Change-Id: Ia30853db5bc7f1f2a4c7e91169c659ae2b79adcb Reviewed-on: https://go-review.googlesource.com/c/go/+/509097 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-07-12cmd/go: fix GOTOOLCHAIN parsing for +autoRuss Cox
The call from toolchain.Select to gover.FromToolchain was passing the wrong argument but this was masked by gover.IsValid being a little bit too lax. Fix and test IsValid, which then breaks the existing gotoolchain_local test, and then fix toolchain.Select to fix the test. Fixes #61068. Change-Id: I505ceb227457d6a51bd5e47f009b2fb1010c0d1f Reviewed-on: https://go-review.googlesource.com/c/go/+/508820 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-12doc/go1.21: add a release note for CL 463177Bryan C. Mills
I'm not sure why the relnote tool did not fill in a TODO for that change; one was requested in http://go.dev/cl/c/go/+/463177/3#message-87065dffb06e196fba9a325fefb32f16b41b6b15. Updates #50807. Updates #27225. Change-Id: If6be8c126bcafb04ba92de88d2fc74a0557a07b8 Reviewed-on: https://go-review.googlesource.com/c/go/+/509098 Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com>
2023-07-12cmd/compile: on PPC64, fix sign/zero extension when maskingPaul E. Murphy
(ANDCCconst [y] (MOV.*reg x)) should only be merged when zero extending. Otherwise, sign bits are lost on negative values. (ANDCCconst [0xFF] (MOVBreg x)) should be simplified to a zero extension of x. Likewise for the MOVHreg variant. Fixes #61297 Change-Id: I04e4fd7dc6a826e870681f37506620d48393698b Reviewed-on: https://go-review.googlesource.com/c/go/+/508775 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-07-11src/README.vendor: s/latest/master/Jonathan Amsterdam
Update the README to specify the module query "@master" instead of "@latest". Vendoring the highest tagged version is unlikely to be right. Usually one wants to vendor the module at HEAD. Change-Id: Id00d23523a13fd3dcd73d6eacefdf50bcdbfa26e Reviewed-on: https://go-review.googlesource.com/c/go/+/508823 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-07-11testing/slogtest: check for no group with empty recordJonathan Amsterdam
As #61067 pointed out, slog did not properly handle empty groups. https://go.dev/cl/508436 dealt with most cases inside slog itself, but handlers must still do a check on their own. Namely, a handler must not output a group created by WithGroup unless the Record has attributes. This change adds a test to slogtest to check that case. Fixes #61227. Change-Id: Ibc065b6e5f6e199a41bce8332ea8c7f9d8373392 Reviewed-on: https://go-review.googlesource.com/c/go/+/508438 Reviewed-by: Alan Donovan <adonovan@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-11net/http/fcgi: eliminate goroutine leaks in testsBryan C. Mills
Also fix a (minor) double-Close error in Serve that was exposed by the test fix. Serve accepts a net.Listener, which produces net.Conn instances. The documentation for net.Conn requires its methods to be safe for concurrent use, so most implementations likely allow Close to be called multiple times as a side effect of making it safe to call concurrently with other methods. However, the net.Conn interface is a superset of the io.Closer interface, io.Closer explicitly leaves the behavior of multiple Close calls undefined, and net.Conn does not explicitly document a stricter requirement. Perhaps more importantly, the test for the fcgi package calls unexported functions that accept an io.ReadWriteCloser (not a net.Conn), and at least one of the test-helper ReadWriteCloser implementations expects Close to be called only once. The goroutine leaks were exposed by a racy arbitrary timeout reported in #61271. Fixing the goroutine leak exposed the double-Close error: one of the leaked goroutines was blocked on reading from an unclosed pipe. Closing the pipe (to unblock the goroutine) triggered the second Close call. Fixes #61271. Change-Id: I5cfac8870e4bb4f13adeee48910d165dbd4b76fe Reviewed-on: https://go-review.googlesource.com/c/go/+/508815 Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-11os/exec: ignore context.Canceled errors in TestConcurrentExecBryan C. Mills
We cancel the Context to unblock the test as soon as all of the "exit" processes have completed. If that happens to occur before all of the "hang" processes have started, the Start calls may fail with context.Canceled. Since those errors are possible in normal operation of the test, ignore them. Fixes #61277. Updates #61080. Change-Id: I20db083ec89ca88eb085ceb2892b9f87f83705ac Reviewed-on: https://go-review.googlesource.com/c/go/+/508755 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-07-11log/slog: replace nil contexts with context.Background()Jonathan Amsterdam
Passing nil for a context is discouraged. We should avoid it. Fixes #61219. Change-Id: I664387070aacb56af580b6b0791ca40982d2a711 Reviewed-on: https://go-review.googlesource.com/c/go/+/508437 Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
2023-07-11log/slog: change XXXCtx functions to XXXContextJonathan Amsterdam
Fixes #61200. Change-Id: I3071dbf673bcd2d24e62644b40d481c953703978 Reviewed-on: https://go-review.googlesource.com/c/go/+/508195 Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-11time: increase arbitrary upper bound in TestReset to 10sBryan C. Mills
The previous upper bound was around 0.375 s, which is empirically too short on a slow, heavily-loaded builder. Since the test doesn't seem to depend on the actual duration in any meaningful way, let's make it several orders of magnitude larger. Fixes #61266. Change-Id: I6dde5e174966ee385db67e3cb87334f463c7e597 Reviewed-on: https://go-review.googlesource.com/c/go/+/508695 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-07-11net: mptcp: force using MPTCP with GODEBUGMatthieu Baerts
When adding MPTCP support to address the proposal #56539, I missed the GODEBUG setting from Russ Cox's plan: I am inclined to say that we add MPTCP as an opt-in for a release or two, and then make it opt-out. There should be a GODEBUG setting (...) See: https://github.com/golang/go/issues/56539#issuecomment-1309294637 Thanks to andrius4669 for having reported this issue to me. It makes sense to have this GODEBUG setting not to have to modify applications to use MPTCP (if available). It can then be useful to estimate the impact in case we want to switch from opt-in to opt-out later. The MPTCP E2E test has been modified to make sure we can enable MPTCP either via the source code like it was already the case before or with this environment variable: GODEBUG=multipathtcp=1 The documentation has been adapted accordingly. I don't know if it is too late for Go 1.21 but I had to put a version in the documentation. The modification is small, the risk seems low and this was supposed to be there from the beginning according to Russ Cox's specifications. It can also be backported or only be present in the future v1.22 if it is easier. Note: I didn't re-open #56539 or open a new one. It is not clear to me what I should do in this case. Fixes #56539 Change-Id: I9201f4dc0b99e3643075a34c7032a95528c48fa0 Reviewed-on: https://go-review.googlesource.com/c/go/+/507375 Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
2023-07-10syscall: serialize locks on ForkLock on platforms where forkExecPipe is not ↵Bryan C. Mills
atomic In CL 421441, we changed syscall to allow concurrent calls to forkExec. On platforms that support the pipe2 syscall that is the right behavior, because pipe2 atomically opens the pipe with CLOEXEC already set. However, on platforms that do not support pipe2 (currently aix and darwin), syscall.forkExecPipe is not atomic, and the pipes do not initially have CLOEXEC set. If two calls to forkExec proceed concurrently, a pipe intended for one child process can be accidentally inherited by the other. If the process is long-lived, the pipe can be held open unexpectedly and prevent the parent process from reaching EOF reading the child's status from the pipe. Fixes #61080. Updates #23558. Updates #54162. Change-Id: I83edcc80674ff267a39d06260c5697c654ff5a4b Reviewed-on: https://go-review.googlesource.com/c/go/+/507355 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com>
2023-07-10test: add test cases for index value with range array clearCuong Manh Le
Updates #61127 Change-Id: I5fb032c990b64bb4f455a7c0345cfb556bf263bd Reviewed-on: https://go-review.googlesource.com/c/go/+/508335 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org>
2023-07-10cmd/compile: fix clear on slice with zero size elemCuong Manh Le
Fixed #61127 Change-Id: If07b04ebcc98438c66f273c0c94bea1f230dc2e8 Reviewed-on: https://go-review.googlesource.com/c/go/+/507535 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2023-07-10cmd/compile: don't ICE on unaligned offsets for pointer writesKeith Randall
User code is unlikely to be correct, but don't crash the compiler when the offset of a pointer in an object is not a multiple of the pointer size. Fixes #61187 Change-Id: Ie56bfcb38556c5dd6f702ae4ec1d4534c6acd420 Reviewed-on: https://go-review.googlesource.com/c/go/+/508555 Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2023-07-07os: support reading empty root directories on Windowsqmuntal
GetFileInformationByHandleEx can return `ERROR_FILE_NOT_FOUND` when no files were found in a root directory, as per MS-FSA 2.1.5.6.3 [1]. This error code should not be treated as an error, but rather as an indication that no files were found, in which case `readdir` should return an empty slice. This CL doesn't add any test as it is difficult to trigger this error code. Empty root directories created using Windows utilities such as `net use` always report at least the optional `.` and `..` entries. A reproducer is provided in #61159, but it requires WinFSP to be installed. Fixes #61159 [1] https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fsa/fa8194e0-53ec-413b-8315-e8fa85396fd8 Change-Id: Id46452030f5355c292e5b0abbf5e22af434a84d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/507775 Reviewed-by: Nick Craig-Wood <nickcw@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-07-07src/database/sql: run gofmtThan McIntosh
Run gofmt on a source file. Change-Id: I180d5cc7425fc5d8e9cf63005ac692f361beb1ed Reviewed-on: https://go-review.googlesource.com/c/go/+/508497 Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Eli Bendersky <eliben@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-07go/types, types2: do not mutate arguments in NewCheckerRobert Findley
CL 507975 resulted in new data races (as reported in #61212), because the pkg argument to NewChecker was mutated. Fix this by deferring the recording of the goVersion in pkg until type checking is actually initiated via a call to Checker.Files. Additionally, modify types2/check.go to bring it in sync with the changes in go/types/check.go, and generate the new version_test.go from the types2 file. Also move parsing the version into checkFiles, for simplicity. Fixes #61212 Change-Id: I15edb6c2cff3085622fe7c6a3b0dab531d27bd04 Reviewed-on: https://go-review.googlesource.com/c/go/+/508439 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
2023-07-07math: add test that covers riscv64 fnm{add,sub} codegenMichael Munday
Adds a test that triggers the RISC-V fused multiply-add code generation bug fixed by CL 506575. Change-Id: Ia3a55a68b48c5cc6beac4e5235975dea31f3faf2 Reviewed-on: https://go-review.googlesource.com/c/go/+/507035 Auto-Submit: M Zhuo <mzh@golangcn.org> Reviewed-by: M Zhuo <mzh@golangcn.org> Run-TryBot: Michael Munday <mike.munday@lowrisc.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Joedian Reid <joedian@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2023-07-07log/slog: handle recursively empty groupsJonathan Amsterdam
Handlers should not display empty groups. A group with no attributes is certainly empty. But we also want to consider a group to be empty if all its attributes are empty groups. The built-in handlers did not handle this second case properly. This CL fixes that. There are two places in the implementation that we need to consider. For Values of KindGroup, we change the GroupValue constructor to omit Attrs that are empty groups. A Group is then empty if and only if it has no Attrs. This avoids a recursive check for emptiness. It does require allocation, but that doesn't worry us because Group values should be relatively rare. For groups established by WithGroup, we avoid opening such groups unless the Record contains non-empty groups. As we did for values, we avoid adding empty groups to records in the first place, so we only need to check that the record has at least one Attr. We are doing extra work, so we need to make sure we aren't slowing things down unduly. Benchmarks before and after this change show minimal differences. Fixes #61067. Change-Id: I684c7ca834bbf69210516faecae04ee548846fb7 Reviewed-on: https://go-review.googlesource.com/c/go/+/508436 Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-06os: do not skip directory entries with zero inodes on wasip1Achille Roussel
When building programs to GOOS=wasip1, the program does not have the guarantees that the underlying directories will come from a file system where a zero inode value indicates that the entry was deleted but not yet removed from the directory. The host runtime may be running on windows or may be exposing virtual user-space file systems that do not have the concept of inodes. In those setup, we assume that the host runtime is in charge of dealing with edge cases such as skipping directory entries with zero inodes when needed, and the guest application should trust the list of entries that it sees; therefore, we disable skipping over zero inodes on wasip1. Change-Id: I99aa562441cdb4182965f270af054cf3cf7f8f20 Reviewed-on: https://go-review.googlesource.com/c/go/+/507915 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
2023-07-06runtime: print output on failure in TestMemPprofCherry Mui
If running testprog fails, print the output. For #60901. Change-Id: Iee80fb09412ce13bae6ac3589779a8cdf7761765 Reviewed-on: https://go-review.googlesource.com/c/go/+/507978 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com>
2023-07-06net: only build cgo_stub.go on unix or wasip1Ian Lance Taylor
We were building it for Windows, although Windows code never calls any of these functions. When using -tags netgo that cause a multiple definition of cgoAvailable. Fixes #61153 Change-Id: Ib9e1de7720a8c0dacd6f12002917bf305dfa5405 Reviewed-on: https://go-review.googlesource.com/c/go/+/507655 Reviewed-by: Damien Neil <dneil@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2023-07-06cmd/go: pass GoVersion in vet configRuss Cox
When invoking a vet tool with -vettool (or vet itself), we need to pass the package's GoVersion to use when analyzing the package. The test of this behavior is in the x/tools/go/analysis CL 507880. For #61176. Change-Id: I3b5a90fcd19a0adc7fb29366e106e18f722fc061 Reviewed-on: https://go-review.googlesource.com/c/go/+/507976 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Russ Cox <rsc@golang.org>
2023-07-06go/types: record Config.GoVersion for reporting in Package.GoVersion methodRuss Cox
Clients of go/types, such as analyzers, may need to know which specific Go version a package is written for. Record that information in the Package and expose it using the new GoVersion method. Update parseGoVersion to handle the new Go versions that may be passed around starting in Go 1.21.0: versions like "go1.21.0" and "go1.21rc2". This is not strictly necessary today, but it adds some valuable future-proofing. While we are here, change NewChecker from panicking on invalid version to saving an error for returning later from Files. Go versions are now likely to be coming from a variety of sources, not just hard-coded in calls to NewChecker, making a panic inappropriate. For #61174. Fixes #61175. Change-Id: Ibe41fe207c1b6e71064b1fe448ac55776089c541 Reviewed-on: https://go-review.googlesource.com/c/go/+/507975 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
2023-07-06log/slog: fix faulty testMerrick Clay
Adds an optional close quote in the expected log message regex for TestConnections to prevent failing when the source filepath is surrounded in quotes due to it containing one or more spaces. Fixes #61161 Change-Id: I0dd71fb4389bff963bbfdc668ef4e4dfe787eafc Reviewed-on: https://go-review.googlesource.com/c/go/+/508055 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-05cmd/compile: fix FMA negative commutativity of riscv64Meng Zhuo
According to RISCV manual 11.6: FMADD x,y,z computes x*y+z and FNMADD x,y,z => -x*y-z FMSUB x,y,z => x*y-z FNMSUB x,y,z => -x*y+z respectively However our implement of SSA convert FMADD -x,y,z to FNMADD x,y,z which is wrong and should be convert to FNMSUB according to manual. Change-Id: Ib297bc83824e121fd7dda171ed56ea9694a4e575 Reviewed-on: https://go-review.googlesource.com/c/go/+/506575 Run-TryBot: M Zhuo <mzh@golangcn.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Joedian Reid <joedian@golang.org> Reviewed-by: Michael Munday <mike.munday@lowrisc.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-05math: fix portable FMA when x*y < 0 and x*y == -zMichael Munday
When x*y == -z the portable implementation of FMA copied the sign bit from x*y into the result. This meant that when x*y == -z and x*y < 0 the result was -0 which is incorrect. Fixes #61130. Change-Id: Ib93a568b7bdb9031e2aedfa1bdfa9bddde90851d Reviewed-on: https://go-review.googlesource.com/c/go/+/507376 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Michael Munday <mike.munday@lowrisc.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Joedian Reid <joedian@golang.org>
2023-07-05database/sql: prevent internal context error from being returned from Rows.Err()zikaeroh
CL 497675 modified Rows such that context errors are propagated through Rows.Err(). This caused an issue where calling Close meant that an internal cancellation error would (eventually) be returned from Err: 1. A caller makes a query using a cancellable context. 2. initContextClose sees that either the query context or the transaction context can be canceled, so will need to spawn a goroutine to capture their errors. 3. initContextClose derives a context from the query context via WithCancel and sets rs.cancel. 4. When a user calls Close, rs.cancel is called. awaitDone's ctx is cancelled, which is good, since we don't want it to hang forever. 5. This internal cancellation (after CL 497675) has its error saved on contextDone. 6. Later, calling Err will return the error in contextDone if present. This leads to a race condition depending on how quickly Err is called after Close. The docs for Close and Err state that calling Close should have no affect on the return result for Err. So, a potential fix is to ensure that awaitDone does not save the error when the cancellation comes from a Close via rs.cancel. This CL does that, using a new context not derived from the query context, whose error is ignored as the query context's error used to be before the original bugfix. The included test fails before the CL, and passes afterward. Fixes #60932 Change-Id: I2bf4c549efd83d62b86e298c9c45ebd06a3ad89a Reviewed-on: https://go-review.googlesource.com/c/go/+/505397 Auto-Submit: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2023-07-05runtime,runtime/metrics: clarify OS stack metricsMichael Anthony Knyszek
There are some subtle details here about measuring OS stacks in cgo programs. There's also an expectation about magnitude in the MemStats docs that isn't in the runtime/metrics docs. Fix both. Fixes #54396. Change-Id: I6b60a62a4a304e6688e7ab4d511d66193fc25321 Reviewed-on: https://go-review.googlesource.com/c/go/+/502156 Run-TryBot: Michael Knyszek <mknyszek@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
2023-07-04runtime: have ReadMemStats do a nil check before switching stacksKeith Randall
This gives the user a better stack trace experience. No need to expose them to runtime.systemstack and friends. Fixes #61158 Change-Id: I4f423f82e54b062773067c0ae64622e37cb3948b Reviewed-on: https://go-review.googlesource.com/c/go/+/507755 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2023-07-04os, syscall: update unreachable link about =C: envsOleksandr Redko
Change-Id: I185dec133599f9c69fda7563697bbc33e433fb78 Reviewed-on: https://go-review.googlesource.com/c/go/+/507135 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-07-04test/codegen: enable Mul2 DivPow2 test for riscv64Meng Zhuo
Change-Id: Ice0bb7a665599b334e927a1b00d1a5b400c15e3d Reviewed-on: https://go-review.googlesource.com/c/go/+/506035 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org>
2023-06-30runtime: check GOFLAGS not GCFLAGSMichael Pratt
GCFLAGS doesn't have any defined meaning. cmd/dist enables mayMoreStackPreempt with GOFLAGS. For #55160. Change-Id: I7ac71e4a1a983a56bd228ab5d24294db5cc595f7 Reviewed-on: https://go-review.googlesource.com/c/go/+/507359 Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
2023-06-29net: enable pure Go resolver for wasip1Chris O'Hara
Top-level functions in the net package that only read files, for example LookupPort(...), or LookupIP(host) where host resides in /etc/hosts, now work on wasip1. If the application has the ability to create sockets (for example, when using a sockets extension to WASI preview 1), it's now possible to do name resolution by passing a custom Dial function to a Resolver instance. Change-Id: I923886f67e336820bc89f09ea1855387c8dac61a Reviewed-on: https://go-review.googlesource.com/c/go/+/500579 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Randy Reddig <ydnar@shaderlab.com> Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-06-29syscall: stub Getrlimit on wasip1Chris O'Hara
This is a prerequisite to enabling the pure Go resolver for wasip1. Change-Id: Iecd8a18ce4c9eb69a697d29930bedb7175b4f0ce Reviewed-on: https://go-review.googlesource.com/c/go/+/500577 Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-29cmd/asm/internal/lex: fix comment, remove the first "has"Jes Cok
Change-Id: I429f0fa6c99ef576fe83c7bd0d1c1e176ecbb179 GitHub-Last-Rev: fb581b7f271f026182de0737c4fe5c360d5dea96 GitHub-Pull-Request: golang/go#61066 Reviewed-on: https://go-review.googlesource.com/c/go/+/507097 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com>
2023-06-29cmd/compile/internal/types2: make TestIssue43124 match the go/types versionRobert Griesemer
Replace the (flaky) types2.TestIssue43124 with the code of the (stable) go/types version of this test. While at it, replace a handful of syntax.Pos{} with the equivalent nopos, to further reduce differences between the two versions of the issues_test.go file. For #61064. Change-Id: I69f3e4627a48c9928e335d67736cb875ba3835fc Reviewed-on: https://go-review.googlesource.com/c/go/+/507215 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Robert Griesemer <gri@google.com>
2023-06-29net/http: validate Host header before sendingDamien Neil
Verify that the Host header we send is valid. Avoids surprising behavior such as a Host of "go.dev\r\nX-Evil:oops" adding an X-Evil header to HTTP/1 requests. Add a test, skip the test for HTTP/2. HTTP/2 is not vulnerable to header injection in the way HTTP/1 is, but x/net/http2 doesn't validate the header and will go into a retry loop when the server rejects it. CL 506995 adds the necessary validation to x/net/http2. For #60374 Change-Id: I05cb6866a9bead043101954dfded199258c6dd04 Reviewed-on: https://go-review.googlesource.com/c/go/+/506996 Reviewed-by: Tatiana Bradley <tatianabradley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Damien Neil <dneil@google.com>
2023-06-29cmd/{go,compile}: run gofmtThan McIntosh
Ran gofmt on a couple of Go source files that needed it. Change-Id: I0e9f78831f531a728b892a63c6e0c517d92b11a8 Reviewed-on: https://go-review.googlesource.com/c/go/+/507156 Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-29runtime: run wasip1 tests with wazeroChris O'Hara
The latest wazero release supports non-blocking I/O and pre-opened sockets. Unmask the relevant wasip1 tests so that there are multiple WebAssembly runtimes exercising these code paths. Change-Id: I8506ab35186f98fde2cd3ce84634d5fcb7b053f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/503595 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>