]> Cypherpunks repositories - gostls13.git/commitdiff
all: fix "result not used" vet warnings
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 7 Jul 2016 22:32:49 +0000 (15:32 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 16 Aug 2016 14:15:10 +0000 (14:15 +0000)
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: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/math/big/decimal_test.go
src/net/dnsmsg_test.go
src/net/ip_test.go
src/time/time_test.go

index 15bdb181e725742bca198443dc720aaa3f06a0e0..13452f83436c56edf5c8e7fee995b78647674a04 100644 (file)
@@ -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()
                }
        }
 }
index 25bd98cff7695055b30333cb9751db717331f977..26e9485b20d5ff8f95ef426b49469a18b9838a5c 100644 (file)
@@ -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)
        }
index b6ac26da05b84abfd666af7954274c3a87f76fbc..0ef46ee33403a7eab87604aca8473f1a579fffe2 100644 (file)
@@ -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()
                }
        }
 }
index b7ebb372967169123d0ae5c67fc150965531f684..fcc28ee99c7e345eabd479783991d8948f6e5e17 100644 (file)
@@ -891,7 +891,7 @@ func TestLocationRace(t *testing.T) {
        go func() {
                c <- Now().String()
        }()
-       Now().String()
+       _ = Now().String()
        <-c
        Sleep(100 * Millisecond)