accounts: fix go vet warnings

pull/2284/head
Felix Lange 9 years ago
parent 85e6c40c00
commit 4e6d8b348d
  1. 2
      accounts/accounts_test.go
  2. 4
      accounts/key_store_passphrase.go
  3. 4
      accounts/key_store_passphrase_test.go

@ -120,7 +120,7 @@ func TestSignRace(t *testing.T) {
} }
if err := am.TimedUnlock(a1.Address, "", 15*time.Millisecond); err != nil { if err := am.TimedUnlock(a1.Address, "", 15*time.Millisecond); err != nil {
t.Fatalf("could not unlock the test account", err) t.Fatal("could not unlock the test account", err)
} }
end := time.Now().Add(500 * time.Millisecond) end := time.Now().Add(500 * time.Millisecond)
for time.Now().Before(end) { for time.Now().Before(end) {

@ -295,13 +295,13 @@ func getKDFKey(cryptoJSON cryptoJSON, auth string) ([]byte, error) {
c := ensureInt(cryptoJSON.KDFParams["c"]) c := ensureInt(cryptoJSON.KDFParams["c"])
prf := cryptoJSON.KDFParams["prf"].(string) prf := cryptoJSON.KDFParams["prf"].(string)
if prf != "hmac-sha256" { if prf != "hmac-sha256" {
return nil, fmt.Errorf("Unsupported PBKDF2 PRF: ", prf) return nil, fmt.Errorf("Unsupported PBKDF2 PRF: %s", prf)
} }
key := pbkdf2.Key(authArray, salt, c, dkLen, sha256.New) key := pbkdf2.Key(authArray, salt, c, dkLen, sha256.New)
return key, nil return key, nil
} }
return nil, fmt.Errorf("Unsupported KDF: ", cryptoJSON.KDF) return nil, fmt.Errorf("Unsupported KDF: %s", cryptoJSON.KDF)
} }
// TODO: can we do without this when unmarshalling dynamic JSON? // TODO: can we do without this when unmarshalling dynamic JSON?

@ -32,7 +32,7 @@ func TestKeyEncryptDecrypt(t *testing.T) {
for i := 0; i < 3; i++ { for i := 0; i < 3; i++ {
// Try a bad password first // Try a bad password first
if _, err := DecryptKey(keyjson, password+"bad"); err == nil { if _, err := DecryptKey(keyjson, password+"bad"); err == nil {
t.Error("test %d: json key decrypted with bad password", i) t.Errorf("test %d: json key decrypted with bad password", i)
} }
// Decrypt with the correct password // Decrypt with the correct password
key, err := DecryptKey(keyjson, password) key, err := DecryptKey(keyjson, password)
@ -45,7 +45,7 @@ func TestKeyEncryptDecrypt(t *testing.T) {
// Recrypt with a new password and start over // Recrypt with a new password and start over
password += "new data appended" password += "new data appended"
if keyjson, err = EncryptKey(key, password, LightScryptN, LightScryptP); err != nil { if keyjson, err = EncryptKey(key, password, LightScryptN, LightScryptP); err != nil {
t.Errorf("test %d: failed to recrypt key %v", err) t.Errorf("test %d: failed to recrypt key %v", i, err)
} }
} }
} }

Loading…
Cancel
Save