Static errors

This commit is contained in:
Moein Nemati 2023-06-28 14:37:00 +03:00
parent e016e7112d
commit a32d1d0f2a
No known key found for this signature in database
GPG Key ID: A893D5BF4D5FAE12

View File

@ -1,6 +1,7 @@
package plugin
import (
"errors"
"fmt"
"os"
"strings"
@ -193,14 +194,14 @@ func getSecretFileCmdArg(kvp string) (string, error) {
func getSecretCmdArg(kvp string, file bool) (string, error) {
delimIndex := strings.IndexByte(kvp, '=')
if delimIndex == -1 {
return "", fmt.Errorf("%s is not a valid secret", kvp)
return "", errors.New("invalid secret")
}
key := kvp[:delimIndex]
value := kvp[delimIndex+1:]
if key == "" || value == "" {
return "", fmt.Errorf("%s is not a valid secret", kvp)
return "", errors.New("invalid secret")
}
if file {