Skip to content

Commit c815795

Browse files
committed
resolve linters
1 parent e01929b commit c815795

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pkg/file/azure.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@ func newAzureFile(c *AzureConfig, filename string, mode Mode) (*azure, error) {
6363
return nil, err
6464
}
6565

66-
if pl>=0 && pl<= math.MaxUint16{
67-
azFile.parallelism = uint16(pl)
68-
} else {
69-
azFile.parallelism = uint16(0)
70-
}
66+
azFile.parallelism = validateAndConvertToUint16(pl)
7167
}
7268

7369
return azFile, nil
@@ -105,3 +101,11 @@ func randomString() string {
105101
r := rand.New(rand.NewSource(time.Now().UnixNano())) //nolint:gosec // Use of weak random number generator
106102
return strconv.Itoa(r.Int())
107103
}
104+
105+
func validateAndConvertToUint16(num int) uint16 {
106+
if num >= 0 && num <= math.MaxUint16 {
107+
return uint16(num)
108+
}
109+
110+
return uint16(0)
111+
}

0 commit comments

Comments
 (0)