Commit 40cf4ad0 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

all: fix "result not used" vet warnings

For tests, assign to _.
For benchmarks, assign to a sink.

Updates #11041

Change-Id: I87c5543245c7bc74dceb38902f4551768dd37948
Reviewed-on: https://go-review.googlesource.com/27116
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent c70bdd37
......@@ -105,12 +105,14 @@ func TestDecimalRounding(t *testing.T) {
}
}
var sink string
func BenchmarkDecimalConversion(b *testing.B) {
for i := 0; i < b.N; i++ {
for shift := -100; shift <= +100; shift++ {
var d decimal
d.init(natOne, shift)
d.String()
sink = d.String()
}
}
}
......@@ -117,7 +117,7 @@ func TestDNSParseSRVReply(t *testing.T) {
if !ok {
t.Fatal("unpacking packet failed")
}
msg.String() // exercise this code path
_ = msg.String() // exercise this code path
if g, e := len(msg.answer), 5; g != e {
t.Errorf("len(msg.answer) = %d; want %d", g, e)
}
......@@ -165,7 +165,7 @@ func TestDNSParseCorruptSRVReply(t *testing.T) {
if !ok {
t.Fatal("unpacking packet failed")
}
msg.String() // exercise this code path
_ = msg.String() // exercise this code path
if g, e := len(msg.answer), 5; g != e {
t.Errorf("len(msg.answer) = %d; want %d", g, e)
}
......
......@@ -242,13 +242,15 @@ func TestIPString(t *testing.T) {
}
}
var sink string
func BenchmarkIPString(b *testing.B) {
testHookUninstaller.Do(uninstallTestHooks)
for i := 0; i < b.N; i++ {
for _, tt := range ipStringTests {
if tt.in != nil {
tt.in.String()
sink = tt.in.String()
}
}
}
......@@ -299,7 +301,7 @@ func BenchmarkIPMaskString(b *testing.B) {
for i := 0; i < b.N; i++ {
for _, tt := range ipMaskStringTests {
tt.in.String()
sink = tt.in.String()
}
}
}
......
......@@ -891,7 +891,7 @@ func TestLocationRace(t *testing.T) {
go func() {
c <- Now().String()
}()
Now().String()
_ = Now().String()
<-c
Sleep(100 * Millisecond)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment