aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vet
AgeCommit message (Collapse)Author
2025-11-14std: fix printf("%q", int) mistakesAlan Donovan
For #72850 Change-Id: I07e64f05c82a34b1dadb9a72e16f5045e68cbd24 Reviewed-on: https://go-review.googlesource.com/c/go/+/720642 Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-10-17cmd/fix: add modernize and inline analyzersAlan Donovan
We ran 'go mod vendor' to pull in the newly used packages. Also, add a cmd/go script test that minimally exercises each analyzer, analogous to the cmd/vet test. For #75266 For #75267 For #71859 Change-Id: I334daea048e3d2f614a1788292a3175acf173932 Reviewed-on: https://go-review.googlesource.com/c/go/+/710995 Reviewed-by: Michael Matloob <matloob@golang.org> Auto-Submit: Alan Donovan <adonovan@google.com> TryBot-Bypass: Alan Donovan <adonovan@google.com> Reviewed-by: Michael Matloob <matloob@google.com>
2025-10-10cmd/go: unify "go fix" and "go vet"Alan Donovan
This change unifies the fix and vet subcommands; they use the same run function, action graph, and external tool (-vettool for go vet and -fixtool for go fix). go fix runs the tool with the -fix flag, whereas although go vet also supports -fix, it is not the default. The two tools have different (overlapping) suites of analyzers. The high-level parts are fully parameterized over the vet/fix distinction; the lower-level parts (the action graph) continue to use only the "vet" terminology. The cmd/{vet,fix} executable is referred to as the "tool". The tool is generally invoked in -json mode, regardless of whether -json was requested, so that the tool produces a cacheable JSON blob on stdout. When the go user did not request -json, this blob is parsed and printed to stderr by logic in the go vet command. (Formerly the tool would print diagnostics to stderr, but this interacts poorly with the build cache.) go fix's legacy -fix=fixer,... flag is now a no-op that prints a warning that the flag is obsolete. The unitchecker's -c=n flag (to display n lines of context around each diagnostic) is reimplemented in go vet based on the JSON information, to avoid reliance on the stderr output of the tool. cmd/fix is added to dist's prebuilt set of tools since go fix cannot build it dynamically (though ideally it would). Updates #71859 For #75432 Change-Id: I0a84746720b59d05d662ed57826747c5598dca44 Reviewed-on: https://go-review.googlesource.com/c/go/+/700795 Reviewed-by: Michael Matloob <matloob@google.com> Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Michael Matloob <matloob@golang.org> TryBot-Bypass: Alan Donovan <adonovan@google.com>
2025-08-13all: update vendored dependencies [generated]Dmitri Shuralyov
The tree has opened for Go 1.26 development. This is a time to update all golang.org/x/... module versions that contribute packages to the std and cmd modules in the standard library to latest master versions. For #36905. [git-generate] go install golang.org/x/build/cmd/updatestd@latest go install golang.org/x/tools/cmd/bundle@latest updatestd -goroot=$(pwd) -branch=master # Update a cmd/vet test case. patch <<EOF --- src/cmd/vet/testdata/assign/assign.go +++ src/cmd/vet/testdata/assign/assign.go @@ -18 +18 @@ func (s *ST) SetX(x int, ch chan int) { - x = x // ERROR "self-assignment of x to x" + x = x // ERROR "self-assignment of x" @@ -20 +20 @@ func (s *ST) SetX(x int, ch chan int) { - s.x = s.x // ERROR "self-assignment of s.x to s.x" + s.x = s.x // ERROR "self-assignment of s.x" @@ -22 +22 @@ func (s *ST) SetX(x int, ch chan int) { - s.l[0] = s.l[0] // ERROR "self-assignment of s.l.0. to s.l.0." + s.l[0] = s.l[0] // ERROR "self-assignment of s.l.0." EOF Change-Id: I3fc77d49fa7b47803d363287910b0e37bedefb60 Reviewed-on: https://go-review.googlesource.com/c/go/+/694536 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2025-04-23cmd/vet: add hostport analyzerAlan Donovan
+ test, release note Fixes #28308 Change-Id: I190e2fe513eeb6b90b0398841f67bf52510b5f59 Reviewed-on: https://go-review.googlesource.com/c/go/+/667596 Auto-Submit: Alan Donovan <adonovan@google.com> Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-04-01cmd/vet: add waitgroup analyzerAlan Donovan
+ relnote Fixes #18022 Change-Id: I92d1939e9d9f16824655c6c909a5f58ed9500014 Reviewed-on: https://go-review.googlesource.com/c/go/+/661519 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Alan Donovan <adonovan@google.com>
2025-04-01cmd/vendor: update golang.org/x/tools to v0.31.1-0.20250328151535-a857356d5cc5Alan Donovan
Also, sys@v0.31.1. Updates #18022 Change-Id: I15a6d1979cc1e71d3065bc50f09dc8d3f6c6cdc0 Reviewed-on: https://go-review.googlesource.com/c/go/+/661518 Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Commit-Queue: Alan Donovan <adonovan@google.com>
2025-02-12vet: add regression test for printf checker regressionAlan Donovan
Updates golang/go#68796 Change-Id: I5bfa80216deff76fd9aabe9882f93fbfaebef957 Reviewed-on: https://go-review.googlesource.com/c/go/+/610737 Auto-Submit: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org>
2025-02-12all: update vendored dependencies [generated]Dmitri Shuralyov
The tree has opened for Go 1.25 development. This is a time to update all golang.org/x/... module versions that contribute packages to the std and cmd modules in the standard library to latest master versions. For #36905. [git-generate] go install golang.org/x/build/cmd/updatestd@latest go install golang.org/x/tools/cmd/bundle@latest updatestd -goroot=$(pwd) -branch=master # Update a cmd/vet test case. cat <<EOF | patch diff --git a/src/cmd/vet/testdata/print/print.go b/src/cmd/vet/testdata/print/print.go index a2ad0f1298..fffe571163 100644 --- a/src/cmd/vet/testdata/print/print.go +++ b/src/cmd/vet/testdata/print/print.go @@ -200,8 +200,8 @@ func PrintfTests() { // Bad argument reorderings. Printf("%[xd", 3) // ERROR "Printf format %\[xd is missing closing \]" Printf("%[x]d x", 3) // ERROR "Printf format has invalid argument index \[x\]" - Printf("%[3]*s x", "hi", 2) // ERROR "Printf format has invalid argument index \[3\]" - _ = fmt.Sprintf("%[3]d x", 2) // ERROR "Sprintf format has invalid argument index \[3\]" + Printf("%[3]*s x", "hi", 2) // ERROR "Printf format %\[3\]\*s reads arg #3, but call has 2 args" + _ = fmt.Sprintf("%[3]d x", 2) // ERROR "Sprintf format %\[3\]d reads arg #3, but call has 1 arg" Printf("%[2]*.[1]*[3]d x", 2, "hi", 4) // ERROR "Printf format %\[2]\*\.\[1\]\*\[3\]d uses non-int \x22hi\x22 as argument of \*" Printf("%[0]s x", "arg1") // ERROR "Printf format has invalid argument index \[0\]" Printf("%[0]d x", 1) // ERROR "Printf format has invalid argument index \[0\]" EOF # Temporarily hold x/net back to leave out CL 643780 because it's # causing an import cycle in net/http's generated h2_bundle.go. cd src sed -i '' 's|"golang.org/x/net/internal/httpcommon"||' net/http/h2_bundle.go go get golang.org/x/net@v0.34.1-0.20250123000230-c72e89d6a9e4 # version before CL 643780 go mod tidy go mod vendor go generate net/http Change-Id: I91967ceb797bbc741af024cd2d2dba29dc558384 Reviewed-on: https://go-review.googlesource.com/c/go/+/648735 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2024-12-17cmd, go: fix some typoswangshuo
Change-Id: I0fd54ae5294eb4ef30cdef05adb8825f69077b14 GitHub-Last-Rev: ccfa48cbe4525dc2bd60e9ac7e2c150e480ba13f GitHub-Pull-Request: golang/go#70823 Reviewed-on: https://go-review.googlesource.com/c/go/+/635915 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-03cmd: use testenv.Executable helperKir Kolyshkin
Change-Id: I25ac0e8d25d760bfde3bb7700f0feaa23f3e8ab1 Reviewed-on: https://go-review.googlesource.com/c/go/+/609302 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-21cmd/internal: separate counter package from telemetry packageMichael Matloob
Move the code that opens and increments counters out of the cmd/internal/telemetry package into cmd/internal/telemetry/counter. The telemetry package has dependencies on the upload code, which we do not want to pull into the rest of the go toolchain. For #68109 Change-Id: I463c106819b169177a783de4a7d93377e81f4e3e Reviewed-on: https://go-review.googlesource.com/c/go/+/593976 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
2024-06-13cmd/go: call telemetry.MaybeChild at start of go commandMichael Matloob
Call the new telemetry.MaybeChild function at the start of the go command so that the child process logic can be run immediately without running toolchain selection if this is the child process. The Start function in the telemetry shim package has been renamed to OpenCounters to make it clear that that's its only function. The StartWithUpload function in the telemetry shim package has been renamed to MaybeParent because that's its actual effective behavior in cmd/go, the only place it's called: it won't run as the child because MaybeChild has already been called and would have run as the child if the program was the telemetry child, and it won't open counters because telemetry.Start has been called. Checks are added that those functions are always called before so that the function name and comment are accurate. It might make sense to add a true telemetry.MaybeParent function that doesn't try to start the child or open counters to make things a little simpler. Change-Id: Ie81e2418af85cef18ec41f75db66365f6597b8b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/592535 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-14cmd: add telemetry for commands in cmdMichael Matloob
This change modifies the commands in cmd to open counter files, increment invocations counters and to increment counters for the names of the flags that were passed in. cmd/pprof and cmd/vet are both wrappers around tools defined in other modules which do their own flag processing so we can't directly increment flag counters right after flags are parsed. For those two commands we wait to increment counters until after the programs have returned. cmd/dist is built with the bootstrap go so it can't depend on telemetry yet. We can add telemetry support to it once 1.23 is the minimum bootstrap version. For #58894 Change-Id: Ic7f6009992465e55c56ad4dc6451bcb1ca51374a Reviewed-on: https://go-review.googlesource.com/c/go/+/585235 Reviewed-by: Sam Thanawalla <samthanawalla@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-03cmd/vet: add stdversion analyzerAlan Donovan
+ release note, test Fixes #46136 Change-Id: Ib157c5343dde379f8d6f67bdfa64b3f6a6432bab Reviewed-on: https://go-review.googlesource.com/c/go/+/582556 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org>
2024-04-02cmd: update vendored x/tools to 904c6baAlan Donovan
This fixes one of the many obstacles to enabling types.Alias by updating vet. The 'loopclosure' checker (formerly 'rangeloop') no longer reports any findings with go1.22, so the test needed work to ensure that it still runs on files with go1.21 semantics. Updates #65294 Change-Id: I987ff529d4e165b56b7241563c6003e63bf92bb1 Reviewed-on: https://go-review.googlesource.com/c/go/+/575315 Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-11-21cmd/vet: add lost checks in docAnton Telyshev
Change-Id: Iacbcb582e263149fede734822cba2df4b8162968 Reviewed-on: https://go-review.googlesource.com/c/go/+/544015 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Tim King <taking@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-10-03cmd: add a new analyzer for check missing values after appendcui fliter
If there is no second parameter added during append, there will be no prompt when executing go vet. Add an analyzer to detect this situation Update #60448 Change-Id: If9848835424f310c54e3e9377aaaad4a1516871a Reviewed-on: https://go-review.googlesource.com/c/go/+/498416 Run-TryBot: shuang cui <imcusg@gmail.com> Run-TryBot: Tim King <taking@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Tim King <taking@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2023-09-25cmd/vet: add defers analysis passAaron Delaney
Fixes #60048 Change-Id: I1553de35d5ebd9c7df9727242e888de91caca4ea Reviewed-on: https://go-review.googlesource.com/c/go/+/527095 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Tim King <taking@google.com> Reviewed-by: Tim King <taking@google.com>
2023-05-22cmd/vet: add slog checkerJonathan Amsterdam
Add the slog static analysis pass to `go vet`. Vendor in golang.org/x/tools@master to pick up the pass. Tweak a test in slog to avoid triggering the vet check. Change-Id: I55ceac9a4e6876c8385897784542761ea0af2481 Reviewed-on: https://go-review.googlesource.com/c/go/+/496156 Reviewed-by: Alan Donovan <adonovan@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-09cmd: go get golang.org/x/tools@8f7fb01dd429 and revendorRuss Cox
go get golang.org/x/tools@8f7fb01dd429 # CL 493619 go mod tidy go mod vendor The goal is to set up for importing the bisect command, for use in tests, in a follow-up CL. This also updates x/sys and x/net, including in std, because x/tools now depends on newer versions of those. Change-Id: I24c283cc165464d9c873ba7a9a4e75a9d02919b2 Reviewed-on: https://go-review.googlesource.com/c/go/+/493596 Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Russ Cox <rsc@golang.org>
2023-01-30cmd/vet: add directive analyzerRuss Cox
For #56986, add the new directive analyzer that catches misplaced //go:debug lines. Ran 'go mod vendor' after adding the import in vet to bring in the vendored files. A followup CL will enable it by default in 'go test'. Change-Id: I12c46e292b31bdbf5ceb86ba4474545e78a83a47 Reviewed-on: https://go-review.googlesource.com/c/go/+/462201 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Russ Cox <rsc@golang.org>
2022-11-15cmd/vet: use testenv.Command instead of exec.Command in testsBryan C. Mills
testenv.Command sets a default timeout based on the test's deadline and sends SIGQUIT (where supported) in case of a hang. Change-Id: I973be280cd0a7f495b491bfb0e04771389562e04 Reviewed-on: https://go-review.googlesource.com/c/go/+/450711 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com>
2022-11-15cmd/vet: use the test binary as 'vet' instead of rebuilding itBryan C. Mills
This not only reduces the latency of the test, but also respects build flags like '-race' and '-cover' passed to the 'go test' command. Change-Id: I4914870396f90097f45d00012e5601fe42655899 Reviewed-on: https://go-review.googlesource.com/c/go/+/450710 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2022-11-15cmd/vet: enable timeformat analyzerTim King
Fixes #48801 Change-Id: I6230b62f77252a9a694b79caacb38ef15af36e39 Reviewed-on: https://go-review.googlesource.com/c/go/+/450495 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Tim King <taking@google.com>
2022-11-07cmd/vet: remove unused constYasuhiro Matsumoto
Change-Id: I1f713bbb35917ab50b0cde24a81340aa16c2ed03 Reviewed-on: https://go-review.googlesource.com/c/go/+/448195 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27all: replace [0-9] with \d in regexpsTomCao New Macbook Pro
1. replace [0-9] with \d in regexps 2. replace [a-zA-Z0-9_] with \w in regexps Change-Id: I9e260538252a0c1071e76aeb1c5f885c6843a431 GitHub-Last-Rev: 286e1a4619c4bdda7f461afbd6d30b9f312c0486 GitHub-Pull-Request: golang/go#54874 Reviewed-on: https://go-review.googlesource.com/c/go/+/428435 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-07cmd/vet: use strings.Buildercuiweixie
Change-Id: I583e167dac033037e82e55a9ae6c6f0c47a34c7f Reviewed-on: https://go-review.googlesource.com/c/go/+/428293 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Tim King <taking@google.com> Run-TryBot: Tim King <taking@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-04-11all: gofmt main repoRuss Cox
[This CL is part of a sequence implementing the proposal #51082. The design doc is at https://go.dev/s/godocfmt-design.] Run the updated gofmt, which reformats doc comments, on the main repository. Vendored files are excluded. For #51082. Change-Id: I7332f099b60f716295fb34719c98c04eb1a85407 Reviewed-on: https://go-review.googlesource.com/c/go/+/384268 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-10-06all: use bytes.Cut, strings.CutRuss Cox
Many uses of Index/IndexByte/IndexRune/Split/SplitN can be written more clearly using the new Cut functions. Do that. Also rewrite to other functions if that's clearer. For #46336. Change-Id: I68d024716ace41a57a8bf74455c62279bde0f448 Reviewed-on: https://go-review.googlesource.com/c/go/+/351711 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-08-12[dev.typeparams] all: merge master (46fd547) into dev.typeparamsMatthew Dempsky
Conflicts: - src/go/types/check_test.go CL 324730 on dev.typeparams changed the directory paths in TestCheck, TestExamples, and TestFixedbugs and renamed checkFiles to testFiles; whereas CL 337529 on master added a new test case just above them and that used checkFiles. Merge List: + 2021-08-12 46fd547d89 internal/goversion: update Version to 1.18 + 2021-08-12 5805efc78e doc/go1.17: remove draft notice + 2021-08-12 39634e7dae CONTRIBUTORS: update for the Go 1.17 release + 2021-08-12 095bb790e1 os/exec: re-enable LookPathTest/16 + 2021-08-11 dea23e9ca8 src/make.*: make --no-clean flag a no-op that prints a warning + 2021-08-11 d4c0ed26ac doc/go1.17: linker passes -I to extld as -Wl,--dynamic-linker + 2021-08-10 1f9c9d8530 doc: use "high address/low address" instead of "top/bottom" + 2021-08-09 f1dce319ff cmd/go: with -mod=vendor, don't panic if there are duplicate requirements + 2021-08-09 7aeaad5c86 runtime/cgo: when using msan explicitly unpoison cgoCallers + 2021-08-08 507cc341ec doc: add example for conversion from slice expressions to array ptr + 2021-08-07 891547e2d4 doc/go1.17: fix a typo introduced in CL 335135 + 2021-08-06 8eaf4d16bc make.bash: do not overwrite GO_LDSO if already set + 2021-08-06 63b968f4f8 doc/go1.17: clarify Modules changes + 2021-08-06 70546f6404 runtime: allow arm64 SEH to be called if illegal instruction + 2021-08-05 fd45e267c2 runtime: warn that KeepAlive is not an unsafe.Pointer workaround + 2021-08-04 6e738868a7 net/http: speed up and deflake TestCancelRequestWhenSharingConnection + 2021-08-02 8a7ee4c51e io/fs: don't use absolute path in DirEntry.Name doc + 2021-07-31 b8ca6e59ed all: gofmt + 2021-07-30 b7a85e0003 net/http/httputil: close incoming ReverseProxy request body + 2021-07-29 70fd4e47d7 runtime: avoid possible preemption when returning from Go to C + 2021-07-28 9eee0ed439 cmd/go: fix go.mod file name printed in error messages for replacements + 2021-07-28 b39e0f461c runtime: don't crash on nil pointers in checkptrAlignment + 2021-07-27 7cd10c1149 cmd/go: use .mod instead of .zip to determine if version has go.mod file + 2021-07-27 c8cf0f74e4 cmd/go: add missing flag in UsageLine + 2021-07-27 7ba8e796c9 testing: clarify T.Name returns a distinct name of the running test + 2021-07-27 33ff155970 go/types: preserve untyped constants on the RHS of a shift expression + 2021-07-26 840e583ff3 runtime: correct variable name in comment + 2021-07-26 bfbb288574 runtime: remove adjustTimers counter + 2021-07-26 9c81fd53b3 cmd/vet: add missing copyright header Change-Id: Ia80604d24c6f4205265683024e3100769cf32065
2021-08-10[dev.typeparams] cmd: update vendored golang.org/x/tools to 337cebd2c151Cherry Mui
Update vendored golang.org/x/tools repo to pick up CL 339250 for assembly function check for register ABI. This is done with cd GOROOT/cmd go get golang.org/x/tools@master go mod tidy go mod vendor Update cmd/vet tests as the error ouput changes in CL 301949. The error message now includes full package-qualified name. Change-Id: I52dc7223aee9e011214254488bacf02dc5b4c2ef Reviewed-on: https://go-review.googlesource.com/c/go/+/341149 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2021-07-26cmd/vet: add missing copyright header180909
Change-Id: I78942dde77547f91daebe763328f52b4c476ddaf GitHub-Last-Rev: 423f1683fc7db8c1764383cf0a61c54ee21c06f2 GitHub-Pull-Request: golang/go#47334 Reviewed-on: https://go-review.googlesource.com/c/go/+/336434 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Than McIntosh <thanm@google.com>
2021-03-08cmd/vet: bring in sigchanyzer to report unbuffered channels to signal.NotifyEmmanuel T Odeke
Brings in the static analyzer "sigchanyzer", that we created at Orijtech, Inc, and already submitted in CL 274352, as golang.org/x/tools/go/analysis/passes/sigchanyzer and add it to cmd/vet as one of the passes. Fixes #9399 Change-Id: I83708b8ea5ca8ede5ee31efab55cbce7419434ab Reviewed-on: https://go-review.googlesource.com/c/go/+/299532 Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Bryan C. Mills <bcmills@google.com>
2021-02-20cmd/vet: update buildtag check for //go:build linesRuss Cox
Brings in golang.org/x/tools@2363391a and adjusts, adds cmd/vet tests accordingly. Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild This brings in the new //go:build checks in cmd/vet. Change-Id: I8a9735cc014171691012b307ec30e94c81aadfe1 Reviewed-on: https://go-review.googlesource.com/c/go/+/240609 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-12-09all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTempRuss Cox
As part of #42026, these helpers from io/ioutil were moved to os. (ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.) Update the Go tree to use the preferred names. As usual, code compiled with the Go 1.4 bootstrap toolchain and code vendored from other sources is excluded. ReadDir changes are in a separate CL, because they are not a simple search and replace. For #42026. Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/266365 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-08cmd/vet: vendor in x/tools, enable framepointer vet checkKeith Randall
Vendor in latest x/tools. Add framepointer vet check to vet. Fixes #43014 Change-Id: Ife72f85b1261aa60c0028041c58040d60a40918a Reviewed-on: https://go-review.googlesource.com/c/go/+/276372 Trust: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2020-11-01cmd/vet: bring in pass to catch invalid uses of testing.T in goroutinesEmmanuel T Odeke
Add "go/analysis/passes/testinggoroutine" from x/tools and vendor its source in. This pass will catch misuses of: * testing.T.Fail* * testing.T.Fatal* * testing.T.Skip* inside goroutines explicitly started by the go keyword. The pass was implemented in CL 212920. While here, found 2 misuses in: * database/sql/sql_test.go * runtime/syscall_windows_test.go and fixed them in CL 235527. Fixes #5746 Change-Id: I1740ad3f1d677bb5d78dc5d8d66bac6ec287a2b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/235677 Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2020-03-10cmd/vet: add ifaceassert and stringintconv checkssmasher164
This change re-vendors x/tools to add the ifaceassert and stringintconv checks to cmd/vet. Fixes #32479. Updates #4483. Change-Id: I6bd30b0a3278592dfab4bd247036404ddaff09e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/221339 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-11-05cmd/vet: add test for loading complex values with a single instructionKeith Randall
Actual fix will be submitted to x/tools and vendored. This is just an end-to-end test for vet after that is done. Update #35264 Change-Id: I1a63f607e7cfa7aafee23c2c081086c276d3c38c Reviewed-on: https://go-review.googlesource.com/c/go/+/204538 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
2019-10-19cmd/vet: re-vendor x/tools upstream for printf verb fixCaleb Spare
This pulls in the x/tools fix from https://go-review.googlesource.com/c/tools/+/202041 so that cmd/vet won't flag %x/%X verbs incorrectly for floating-point and complex types. Fixes #34993 Change-Id: I68d89a19d95fe6ad336e87d12d56f03556974086 Reviewed-on: https://go-review.googlesource.com/c/go/+/202083 Run-TryBot: Caleb Spare <cespare@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
2019-06-11cmd/vet: include the errors.As check from upstream x/toolsBryan C. Mills
This change revendors golang.org/x/tools to include the check and modifies cmd/vet to add it to the command. CL 179977 will enable the check by default for 'go test'. Commands run (starting in GOROOT/src): cd cmd emacs vet/main.go go get -u=patch golang.org/x/tools/go/analysis/passes/errorsas@latest go mod tidy go mod vendor cd .. ./make.bash go test all Updates #31213 Change-Id: Ic2ba9bd2d31c4c5fd9e7c42ca14e8dc38520c93b Reviewed-on: https://go-review.googlesource.com/c/go/+/181717 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2019-05-16cmd/vet/all: deleteRuss Cox
The work of running full vet on std and cmd during local development has moved to go test, which of course runs during all.bash. For errors in other GOOS/GOARCH combinations, the misc-compile builders (running buildall.bash) also now run go vet std cmd. The vetall builder need not do anything anymore. Make it a no-op until it can be retired, and remove cmd/vet/all and its special case in the go command. Fixes #31916. Change-Id: I8f30d184c382ea7c2c8f520e5618f680db633968 Reviewed-on: https://go-review.googlesource.com/c/go/+/176440 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-09runtime: fix vet complaints for js/wasmRuss Cox
Change-Id: Ifc8a731a2efd94fdc4fc6f26ca6e16f0c0292211 Reviewed-on: https://go-review.googlesource.com/c/go/+/176178 Reviewed-by: Austin Clements <austin@google.com>
2019-05-09runtime: fix vet complaints for all naclRuss Cox
Working toward making the tree vet-safe instead of having so many exceptions in cmd/vet/all/whitelist. This CL makes "go vet -unsafeptr=false runtime" happy for nacl/*, while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too. For #31916. Change-Id: I6adb4a7b0c2b03d901fba37f9c05e74e5b7b6691 Reviewed-on: https://go-review.googlesource.com/c/go/+/176107 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-09runtime, crypto/x509: fix vet complaints for all windowsRuss Cox
Working toward making the tree vet-safe instead of having so many exceptions in cmd/vet/all/whitelist. This CL makes "go vet -unsafeptr=false runtime" happy for windows/*, while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too. For #31916. Change-Id: If37ab2b3f6fca4696b8a6afb2ef11ba6c4fb42e0 Reviewed-on: https://go-review.googlesource.com/c/go/+/176106 Reviewed-by: Austin Clements <austin@google.com>
2019-05-09runtime: fix vet complaints for all freebsd, netbsd, openbsdRuss Cox
Working toward making the tree vet-safe instead of having so many exceptions in cmd/vet/all/whitelist. This CL makes "go vet -unsafeptr=false runtime" happy for these GOOSes, while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too. For #31916. Change-Id: I63c4805bdd44b301072da66c77086940e2a2765e Reviewed-on: https://go-review.googlesource.com/c/go/+/176105 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-09syscall: fix vet complaints for all dragonfly, freebsd, netbsd, openbsdRuss Cox
Working toward making the tree vet-safe instead of having so many exceptions in cmd/vet/all/whitelist. This CL makes "go vet -unsafeptr=false runtime" happy for these GOOSes, while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too. For #31916. Change-Id: Id2e1223497bd0cd6e880cd81f3ece6363e58219f Reviewed-on: https://go-review.googlesource.com/c/go/+/176104 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2019-05-09runtime: fix vet complaints for solaris/amd64, illumos/amd64Russ Cox
Working toward making the tree vet-safe instead of having so many exceptions in cmd/vet/all/whitelist. This CL makes "go vet -unsafeptr=false runtime" happy for these GOOS/GOARCHes, while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too. For #31916. Change-Id: Ic64f7f4034695dd4c32c9b7f258960faf3742a83 Reviewed-on: https://go-review.googlesource.com/c/go/+/176103 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-09runtime: fix vet complaints for linux/arm64, linux/mips*, linux/ppc64*, ↵Russ Cox
linux/s390x Working toward making the tree vet-safe instead of having so many exceptions in cmd/vet/all/whitelist. This CL makes "go vet -unsafeptr=false runtime" happy for these GOOS/GOARCHes, except for an unresolved complaint on mips/mipsle that is a bug in vet, while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too. For #31916. Change-Id: I6ef7e982a2fdbbfbc22cee876ca37ac54d8109e5 Reviewed-on: https://go-review.googlesource.com/c/go/+/176102 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Austin Clements <austin@google.com>