You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gopls/internal/analysis/modernize: replace WithCancel with t.Cancel
This CL adds a modernizer to replace calls to context.WithCancel with
calls to t.Cancel, where t is the *testing.T (or B, or F) for the
relevant surrounding test function.
Example:
func TestFoo(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel
...
}
=>
func TestFoo(t *testing.T) {
ctx := t.Context()
}
Also, factor out an analysisinternal.IsPointerNamed helper to assist
with identifying pointers to named types. This slightly alters the
behavior of the bloop pass, as it was previously tolerant implicitly
referenced testing.B variables, but that seems unimportant.
Updates golang/go#70815
Change-Id: Id10b5feb85a43e71d5ad740198d27135e8a3e6cf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/641440
Auto-Submit: Robert Findley <[email protected]>
Reviewed-by: Alan Donovan <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
0 commit comments