Skip to content

Commit 8c1e8de

Browse files
authored
accounts/keystore: fix staticcheck warnings (#20373)
* accounts/keystore: fix staticcheck warnings * review feedback
1 parent b26eedf commit 8c1e8de

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

accounts/keystore/passphrase.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ func (ks keyStorePassphrase) StoreKey(filename string, key *Key, auth string) er
123123
"Please file a ticket at:\n\n" +
124124
"https://github.com/ethereum/go-ethereum/issues." +
125125
"The error was : %s"
126+
//lint:ignore ST1005 This is a message for the user
126127
return fmt.Errorf(msg, tmpName, err)
127128
}
128129
}
@@ -237,7 +238,7 @@ func DecryptKey(keyjson []byte, auth string) (*Key, error) {
237238

238239
func DecryptDataV3(cryptoJson CryptoJSON, auth string) ([]byte, error) {
239240
if cryptoJson.Cipher != "aes-128-ctr" {
240-
return nil, fmt.Errorf("Cipher not supported: %v", cryptoJson.Cipher)
241+
return nil, fmt.Errorf("cipher not supported: %v", cryptoJson.Cipher)
241242
}
242243
mac, err := hex.DecodeString(cryptoJson.MAC)
243244
if err != nil {
@@ -273,7 +274,7 @@ func DecryptDataV3(cryptoJson CryptoJSON, auth string) ([]byte, error) {
273274

274275
func decryptKeyV3(keyProtected *encryptedKeyJSONV3, auth string) (keyBytes []byte, keyId []byte, err error) {
275276
if keyProtected.Version != version {
276-
return nil, nil, fmt.Errorf("Version not supported: %v", keyProtected.Version)
277+
return nil, nil, fmt.Errorf("version not supported: %v", keyProtected.Version)
277278
}
278279
keyId = uuid.Parse(keyProtected.Id)
279280
plainText, err := DecryptDataV3(keyProtected.Crypto, auth)
@@ -335,13 +336,13 @@ func getKDFKey(cryptoJSON CryptoJSON, auth string) ([]byte, error) {
335336
c := ensureInt(cryptoJSON.KDFParams["c"])
336337
prf := cryptoJSON.KDFParams["prf"].(string)
337338
if prf != "hmac-sha256" {
338-
return nil, fmt.Errorf("Unsupported PBKDF2 PRF: %s", prf)
339+
return nil, fmt.Errorf("unsupported PBKDF2 PRF: %s", prf)
339340
}
340341
key := pbkdf2.Key(authArray, salt, c, dkLen, sha256.New)
341342
return key, nil
342343
}
343344

344-
return nil, fmt.Errorf("Unsupported KDF: %s", cryptoJSON.KDF)
345+
return nil, fmt.Errorf("unsupported KDF: %s", cryptoJSON.KDF)
345346
}
346347

347348
// TODO: can we do without this when unmarshalling dynamic JSON?

0 commit comments

Comments
 (0)