-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go/analysis/passes/testinggoroutine: update for generics
Update the testinggoroutine analyzer to find bad calls via instantiated function calls. For golang/go#48704 Change-Id: I39ef43090a0e5dd04dfe094376517ac25441ad27 Reviewed-on: https://go-review.googlesource.com/c/tools/+/359401 Trust: Robert Findley <rfindley@google.com> Trust: Zvonimir Pavlinovic <zpavlinovic@google.com> Run-TryBot: Robert Findley <rfindley@google.com> Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
- Loading branch information
Showing
3 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
go/analysis/passes/testinggoroutine/testdata/src/typeparams/typeparams.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2021 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package typeparams | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func f[P any](t *testing.T) { | ||
t.Fatal("failed") | ||
} | ||
|
||
func TestBadFatalf[P any](t *testing.T) { | ||
go f[int](t) // want "call to .+T.+Fatal from a non-test goroutine" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters