Commit 1c94e727 authored by Mohit Agarwal's avatar Mohit Agarwal Committed by Brad Fitzpatrick

net: fix vet warnings

Updates #11041

Change-Id: I12c20beab75d7981efe470eb418e4b58dc8eb066
Reviewed-on: https://go-review.googlesource.com/20002Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 0d1a98e2
...@@ -28,7 +28,7 @@ func TestStructPackUnpack(t *testing.T) { ...@@ -28,7 +28,7 @@ func TestStructPackUnpack(t *testing.T) {
t.Fatal("unpacking failed") t.Fatal("unpacking failed")
} }
if n != len(buf) { if n != len(buf) {
t.Error("unpacked different amount than packed: got n = %d, want = %d", n, len(buf)) t.Errorf("unpacked different amount than packed: got n = %d, want = %d", n, len(buf))
} }
if !reflect.DeepEqual(got, want) { if !reflect.DeepEqual(got, want) {
t.Errorf("got = %+v, want = %+v", got, want) t.Errorf("got = %+v, want = %+v", got, want)
...@@ -69,7 +69,7 @@ func TestDomainNamePackUnpack(t *testing.T) { ...@@ -69,7 +69,7 @@ func TestDomainNamePackUnpack(t *testing.T) {
continue continue
} }
if n != len(buf) { if n != len(buf) {
t.Error( t.Errorf(
"unpacked different amount than packed for %s: got n = %d, want = %d", "unpacked different amount than packed for %s: got n = %d, want = %d",
test.in, test.in,
n, n,
......
...@@ -95,6 +95,6 @@ func TestServerCloseClientConnections(t *testing.T) { ...@@ -95,6 +95,6 @@ func TestServerCloseClientConnections(t *testing.T) {
res, err := http.Get(s.URL) res, err := http.Get(s.URL)
if err == nil { if err == nil {
res.Body.Close() res.Body.Close()
t.Fatal("Unexpected response: %#v", res) t.Fatalf("Unexpected response: %#v", res)
} }
} }
...@@ -561,24 +561,24 @@ func TestInterfaceHardwareAddrWithGetmac(t *testing.T) { ...@@ -561,24 +561,24 @@ func TestInterfaceHardwareAddrWithGetmac(t *testing.T) {
if bytes.Contains(line, []byte("Connection Name:")) { if bytes.Contains(line, []byte("Connection Name:")) {
f := bytes.Split(line, []byte{':'}) f := bytes.Split(line, []byte{':'})
if len(f) != 2 { if len(f) != 2 {
t.Fatal("unexpected \"Connection Name\" line: %q", line) t.Fatalf("unexpected \"Connection Name\" line: %q", line)
} }
name = string(bytes.TrimSpace(f[1])) name = string(bytes.TrimSpace(f[1]))
if name == "" { if name == "" {
t.Fatal("empty name on \"Connection Name\" line: %q", line) t.Fatalf("empty name on \"Connection Name\" line: %q", line)
} }
} }
if bytes.Contains(line, []byte("Physical Address:")) { if bytes.Contains(line, []byte("Physical Address:")) {
if name == "" { if name == "" {
t.Fatal("no matching name found: %q", string(out)) t.Fatalf("no matching name found: %q", string(out))
} }
f := bytes.Split(line, []byte{':'}) f := bytes.Split(line, []byte{':'})
if len(f) != 2 { if len(f) != 2 {
t.Fatal("unexpected \"Physical Address\" line: %q", line) t.Fatalf("unexpected \"Physical Address\" line: %q", line)
} }
addr := string(bytes.ToLower(bytes.TrimSpace(f[1]))) addr := string(bytes.ToLower(bytes.TrimSpace(f[1])))
if addr == "" { if addr == "" {
t.Fatal("empty address on \"Physical Address\" line: %q", line) t.Fatalf("empty address on \"Physical Address\" line: %q", line)
} }
if addr == "disabled" || addr == "n/a" { if addr == "disabled" || addr == "n/a" {
continue continue
......
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