aboutsummaryrefslogtreecommitdiff
path: root/src/context
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2023-05-08 14:03:02 -0400
committerRuss Cox <rsc@golang.org>2023-05-08 20:18:40 +0000
commit91ebed3fd2e0857eec7775835cd6c2a0c0635a03 (patch)
tree6a358445051c2ea54439ee71b43c75be80344e08 /src/context
parent4576184b438125966dc761e2384a728f07fb8da8 (diff)
downloadgo-91ebed3fd2e0857eec7775835cd6c2a0c0635a03.tar.xz
all: make safe for new vet analyzer
The unused analyzer handles dot imports now, so a few tests have picked up vet errors. This CL errors like: context/x_test.go:524:47: result of context.WithValue call not used Change-Id: I711a62fd7b50381f8ea45ac526bf0c946a171047 Reviewed-on: https://go-review.googlesource.com/c/go/+/493598 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'src/context')
-rw-r--r--src/context/x_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/context/x_test.go b/src/context/x_test.go
index bf0af674c1..57fe60b4ee 100644
--- a/src/context/x_test.go
+++ b/src/context/x_test.go
@@ -521,26 +521,26 @@ func TestWithCancelSimultaneouslyCanceledParent(t *testing.T) {
}
func TestWithValueChecksKey(t *testing.T) {
- panicVal := recoveredValue(func() { WithValue(Background(), []byte("foo"), "bar") })
+ panicVal := recoveredValue(func() { _ = WithValue(Background(), []byte("foo"), "bar") })
if panicVal == nil {
t.Error("expected panic")
}
- panicVal = recoveredValue(func() { WithValue(Background(), nil, "bar") })
+ panicVal = recoveredValue(func() { _ = WithValue(Background(), nil, "bar") })
if got, want := fmt.Sprint(panicVal), "nil key"; got != want {
t.Errorf("panic = %q; want %q", got, want)
}
}
func TestInvalidDerivedFail(t *testing.T) {
- panicVal := recoveredValue(func() { WithCancel(nil) })
+ panicVal := recoveredValue(func() { _, _ = WithCancel(nil) })
if panicVal == nil {
t.Error("expected panic")
}
- panicVal = recoveredValue(func() { WithDeadline(nil, time.Now().Add(shortDuration)) })
+ panicVal = recoveredValue(func() { _, _ = WithDeadline(nil, time.Now().Add(shortDuration)) })
if panicVal == nil {
t.Error("expected panic")
}
- panicVal = recoveredValue(func() { WithValue(nil, "foo", "bar") })
+ panicVal = recoveredValue(func() { _ = WithValue(nil, "foo", "bar") })
if panicVal == nil {
t.Error("expected panic")
}