Chore: Fix issues found by staticcheck (#28802)
* Fix linting issues Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -57,7 +57,7 @@ func DecodeBasicAuthHeader(header string) (string, string, error) {
|
||||
|
||||
userAndPass := strings.SplitN(string(decoded), ":", 2)
|
||||
if len(userAndPass) != 2 {
|
||||
return "", "", errors.New("Invalid basic auth header")
|
||||
return "", "", errors.New("invalid basic auth header")
|
||||
}
|
||||
|
||||
return userAndPass[0], userAndPass[1], nil
|
||||
|
||||
@@ -63,7 +63,7 @@ func walk(path string, info os.FileInfo, resolvedPath string, symlinkPathsFollow
|
||||
// vout("SymLink Path: %v, links to: %v", resolvedPath, path2)
|
||||
if symlinkPathsFollowed != nil {
|
||||
if _, ok := symlinkPathsFollowed[path2]; ok {
|
||||
errMsg := "Potential SymLink Infinite Loop. Path: %v, Link To: %v"
|
||||
errMsg := "potential symLink infinite loop, path: %v, link to: %v"
|
||||
return fmt.Errorf(errMsg, resolvedPath, path2)
|
||||
}
|
||||
symlinkPathsFollowed[path2] = true
|
||||
|
||||
@@ -53,7 +53,7 @@ func SplitHostPortDefault(input, defaultHost, defaultPort string) (NetworkAddres
|
||||
addrEnd := strings.LastIndex(input, "]")
|
||||
if addrEnd < 0 {
|
||||
// Malformed address
|
||||
return addr, fmt.Errorf("Malformed IPv6 address: '%s'", input)
|
||||
return addr, fmt.Errorf("malformed IPv6 address: '%s'", input)
|
||||
}
|
||||
|
||||
start = addrEnd
|
||||
@@ -83,7 +83,7 @@ func SplitHostPortDefault(input, defaultHost, defaultPort string) (NetworkAddres
|
||||
// SplitHostPort splits ip address/hostname string by host and port
|
||||
func SplitHostPort(input string) (NetworkAddress, error) {
|
||||
if len(input) == 0 {
|
||||
return NetworkAddress{}, fmt.Errorf("Input is empty")
|
||||
return NetworkAddress{}, fmt.Errorf("input is empty")
|
||||
}
|
||||
return SplitHostPortDefault(input, "", "")
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ func TestParseIPAddress_Invalid(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
input: "[::1",
|
||||
err: "failed to split network address \"[::1\" by host and port: Malformed IPv6 address: '[::1'",
|
||||
err: "failed to split network address \"[::1\" by host and port: malformed IPv6 address: '[::1'",
|
||||
},
|
||||
{
|
||||
input: "::1]",
|
||||
@@ -40,7 +40,7 @@ func TestParseIPAddress_Invalid(t *testing.T) {
|
||||
},
|
||||
{
|
||||
input: "",
|
||||
err: "failed to split network address \"\" by host and port: Input is empty",
|
||||
err: "failed to split network address \"\" by host and port: input is empty",
|
||||
},
|
||||
}
|
||||
for _, testcase := range tests {
|
||||
|
||||
Reference in New Issue
Block a user