diff options
author | Emmanuel T Odeke <emmanuel@orijtech.com> | 2020-05-29 02:17:38 -0700 |
---|---|---|
committer | Emmanuel Odeke <emmanuel@orijtech.com> | 2020-11-01 01:58:43 +0000 |
commit | 5a267c840ae16c1cc7352caa14da5f500d03d338 (patch) | |
tree | f24d82edc3b182ecb16814a86d5e386666448b04 /src/cmd/vet/main.go | |
parent | 063a91c0abef445154df1ba34ffb500eeccfe8bc (diff) | |
download | go-5a267c840ae16c1cc7352caa14da5f500d03d338.tar.gz go-5a267c840ae16c1cc7352caa14da5f500d03d338.zip |
cmd/vet: bring in pass to catch invalid uses of testing.T in goroutines
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>
Diffstat (limited to 'src/cmd/vet/main.go')
-rw-r--r-- | src/cmd/vet/main.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cmd/vet/main.go b/src/cmd/vet/main.go index 6381de840c..bad3807039 100644 --- a/src/cmd/vet/main.go +++ b/src/cmd/vet/main.go @@ -24,6 +24,7 @@ import ( "golang.org/x/tools/go/analysis/passes/stdmethods" "golang.org/x/tools/go/analysis/passes/stringintconv" "golang.org/x/tools/go/analysis/passes/structtag" + "golang.org/x/tools/go/analysis/passes/testinggoroutine" "golang.org/x/tools/go/analysis/passes/tests" "golang.org/x/tools/go/analysis/passes/unmarshal" "golang.org/x/tools/go/analysis/passes/unreachable" @@ -55,6 +56,7 @@ func main() { stringintconv.Analyzer, structtag.Analyzer, tests.Analyzer, + testinggoroutine.Analyzer, unmarshal.Analyzer, unreachable.Analyzer, unsafeptr.Analyzer, |