feat: modernize statement using max()
This commit is contained in:
@@ -203,10 +203,7 @@ func uniqueUsername(t *testing.T, prefix string) string {
|
|||||||
fullPrefix := fmt.Sprintf("%s_%s", filePrefix, prefix)
|
fullPrefix := fmt.Sprintf("%s_%s", filePrefix, prefix)
|
||||||
username := fmt.Sprintf("%s_%s", fullPrefix, uniqueTestID(t))
|
username := fmt.Sprintf("%s_%s", fullPrefix, uniqueTestID(t))
|
||||||
if len(username) > 50 {
|
if len(username) > 50 {
|
||||||
maxIDLength := 50 - len(fullPrefix) - 1
|
maxIDLength := max(50-len(fullPrefix)-1, 0)
|
||||||
if maxIDLength < 0 {
|
|
||||||
maxIDLength = 0
|
|
||||||
}
|
|
||||||
testID := uniqueTestID(t)
|
testID := uniqueTestID(t)
|
||||||
if len(testID) > maxIDLength {
|
if len(testID) > maxIDLength {
|
||||||
testID = testID[:maxIDLength]
|
testID = testID[:maxIDLength]
|
||||||
|
|||||||
Reference in New Issue
Block a user