all: fix some vet warnings
Change-Id: I85c2912a6862c6c251450f2a0926ecd33a9fb8e7
Reviewed-on: https://go-review.googlesource.com/34815
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/openpgp/keys.go b/openpgp/keys.go
index fd9bbd2..68b14c6 100644
--- a/openpgp/keys.go
+++ b/openpgp/keys.go
@@ -307,8 +307,6 @@
return
}
}
-
- panic("unreachable")
}
// ReadEntity reads an entity (public key, identities, subkeys etc) from the
diff --git a/openpgp/keys_test.go b/openpgp/keys_test.go
index fbc8fc2..f768e68 100644
--- a/openpgp/keys_test.go
+++ b/openpgp/keys_test.go
@@ -300,7 +300,7 @@
for _, identity := range entity.Identities {
if len(identity.SelfSignature.PreferredHash) != 0 {
- t.Fatal("Expected preferred hash to be empty but got length %d", len(identity.SelfSignature.PreferredHash))
+ t.Fatalf("Expected preferred hash to be empty but got length %d", len(identity.SelfSignature.PreferredHash))
}
}
}
diff --git a/openpgp/packet/packet.go b/openpgp/packet/packet.go
index e2bde11..3eded93 100644
--- a/openpgp/packet/packet.go
+++ b/openpgp/packet/packet.go
@@ -273,8 +273,6 @@
return
}
}
-
- panic("unreachable")
}
// packetType represents the numeric ids of the different OpenPGP packet types. See
diff --git a/openpgp/packet/public_key.go b/openpgp/packet/public_key.go
index c769933..ead2623 100644
--- a/openpgp/packet/public_key.go
+++ b/openpgp/packet/public_key.go
@@ -540,7 +540,6 @@
default:
return errors.SignatureError("Unsupported public key algorithm used in signature")
}
- panic("unreachable")
}
// VerifySignatureV3 returns nil iff sig is a valid signature, made by this
@@ -585,7 +584,6 @@
default:
panic("shouldn't happen")
}
- panic("unreachable")
}
// keySignatureHash returns a Hash of the message that needs to be signed for
diff --git a/openpgp/packet/public_key_v3.go b/openpgp/packet/public_key_v3.go
index 26337f5..5daf7b6 100644
--- a/openpgp/packet/public_key_v3.go
+++ b/openpgp/packet/public_key_v3.go
@@ -216,7 +216,6 @@
// V3 public keys only support RSA.
panic("shouldn't happen")
}
- panic("unreachable")
}
// VerifyUserIdSignatureV3 returns nil iff sig is a valid signature, made by this
diff --git a/openpgp/write_test.go b/openpgp/write_test.go
index 2161ebc..f2d50a0 100644
--- a/openpgp/write_test.go
+++ b/openpgp/write_test.go
@@ -80,7 +80,7 @@
t.Errorf("failed to find bit length: %s", err)
}
if int(bl) != defaultRSAKeyBits {
- t.Errorf("BitLength %v, expected %v", defaultRSAKeyBits)
+ t.Errorf("BitLength %v, expected %v", int(bl), defaultRSAKeyBits)
}
// Check bit-length with a config.
@@ -238,7 +238,7 @@
signKey, _ := kring[0].signingKey(testTime)
expectedKeyId := signKey.PublicKey.KeyId
if md.SignedByKeyId != expectedKeyId {
- t.Errorf("#%d: message signed by wrong key id, got: %d, want: %d", i, *md.SignedBy, expectedKeyId)
+ t.Errorf("#%d: message signed by wrong key id, got: %v, want: %v", i, *md.SignedBy, expectedKeyId)
}
if md.SignedBy == nil {
t.Errorf("#%d: failed to find the signing Entity", i)
diff --git a/ssh/terminal/terminal.go b/ssh/terminal/terminal.go
index f816773..0c5bd56 100644
--- a/ssh/terminal/terminal.go
+++ b/ssh/terminal/terminal.go
@@ -772,8 +772,6 @@
t.remainder = t.inBuf[:n+len(t.remainder)]
}
-
- panic("unreachable") // for Go 1.0.
}
// SetPrompt sets the prompt to be used when reading subsequent lines.