Skip to content

Commit 9bd6440

Browse files
author
sivakami
committed
Lint fix.
1 parent e4f4f48 commit 9bd6440

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/integration/swiftv2/longRunningCluster/datapath.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ var (
3737
ErrBlobNotFound = errors.New("blob not found (404) on private endpoint")
3838
// ErrUnexpectedBlobResponse is returned when blob download response is unexpected
3939
ErrUnexpectedBlobResponse = errors.New("unexpected response from blob download (no 'Hello' or '200 OK' found)")
40+
// ErrInvalidWorkloadType is returned when workload type is invalid
41+
ErrInvalidWorkloadType = errors.New("invalid workload type")
4042
)
4143

4244
func applyTemplate(templatePath string, data interface{}, kubeconfig string) error {
@@ -164,7 +166,7 @@ func isValidWorkloadType(workloadType string) bool {
164166
return false
165167
}
166168
}
167-
return len(workloadType) > 0 && len(workloadType) <= 64
169+
return workloadType != "" && len(workloadType) <= 64
168170
}
169171

170172
// NodePoolInfo holds information about nodes in different pools
@@ -188,7 +190,7 @@ func GetNodesByNicCount(kubeconfig string) (NodePoolInfo, error) {
188190

189191
// Validate workloadType to prevent command injection
190192
if !isValidWorkloadType(workloadType) {
191-
return NodePoolInfo{}, fmt.Errorf("invalid workload type: %s", workloadType)
193+
return NodePoolInfo{}, fmt.Errorf("%w: %s", ErrInvalidWorkloadType, workloadType)
192194
}
193195

194196
fmt.Printf("Filtering nodes by workload-type=%s\n", workloadType)
@@ -758,7 +760,7 @@ func GenerateStorageSASToken(storageAccountName, containerName, blobName string)
758760

759761
out, err = cmd.CombinedOutput()
760762
if err != nil {
761-
return "", fmt.Errorf("%w (both account key and user delegation): %s\n%s", ErrFailedToGenerateSASToken, err, string(out))
763+
return "", fmt.Errorf("%w (both account key and user delegation): %w\n%s", ErrFailedToGenerateSASToken, err, string(out))
762764
}
763765

764766
sasToken = strings.TrimSpace(string(out))

0 commit comments

Comments
 (0)