Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commands: strconv.Atoi instead of strconv.ParseInt for ints #1446

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions commands/activations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func TestActivationsList(t *testing.T) {
}

if k == "limit" {
limit, _ = strconv.ParseInt(v, 0, 64)
limit, _ = strconv.Atoi(v)
}

if k == "since" {
Expand All @@ -378,7 +378,7 @@ func TestActivationsList(t *testing.T) {
}

if k == "skip" {
skip, _ = strconv.ParseInt(v, 0, 64)
skip, _ = strconv.Atoi(v)
}

if v == "" {
Expand Down Expand Up @@ -414,11 +414,11 @@ func TestActivationsList(t *testing.T) {
expectedListOptions.Name = config.Args[0]
}
if limit != nil {
expectedListOptions.Limit = int(limit.(int64))
expectedListOptions.Limit = limit.(int)
}

if skip != nil {
expectedListOptions.Skip = int(skip.(int64))
expectedListOptions.Skip = skip.(int)
}
tm.serverless.EXPECT().ListActivations(expectedListOptions).Return(theActivations, nil)
}
Expand Down Expand Up @@ -472,7 +472,7 @@ func TestActivationsLogs(t *testing.T) {
if tt.doctlFlags != nil {
for k, v := range tt.doctlFlags {
if k == "limit" {
limit, _ = strconv.ParseInt(v, 0, 64)
limit, _ = strconv.Atoi(v)
}

if k == "follow" {
Expand Down Expand Up @@ -504,7 +504,7 @@ func TestActivationsLogs(t *testing.T) {
} else {
expectedListOptions := whisk.ActivationListOptions{Docs: true}
if limit != nil {
expectedListOptions.Limit = int(limit.(int64))
expectedListOptions.Limit = limit.(int)
}

if funcName != nil {
Expand Down
12 changes: 6 additions & 6 deletions commands/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -1778,11 +1778,11 @@ func parseNodePoolString(nodePool, defaultName, defaultSize string, defaultCount
case "size":
out.Size = value
case "count":
count, err := strconv.ParseInt(value, 10, 64)
count, err := strconv.Atoi(value)
if err != nil {
return nil, errors.New("Node pool count must be a valid integer.")
}
out.Count = int(count)
out.Count = count
case "tag":
out.Tags = append(out.Tags, value)
case "label":
Expand All @@ -1806,17 +1806,17 @@ func parseNodePoolString(nodePool, defaultName, defaultSize string, defaultCount
}
out.AutoScale = autoScale
case "min-nodes":
minNodes, err := strconv.ParseInt(value, 10, 64)
minNodes, err := strconv.Atoi(value)
if err != nil {
return nil, errors.New("Node pool min-nodes must be a valid integer.")
}
out.MinNodes = int(minNodes)
out.MinNodes = minNodes
case "max-nodes":
maxNodes, err := strconv.ParseInt(value, 10, 64)
maxNodes, err := strconv.Atoi(value)
if err != nil {
return nil, errors.New("Node pool max-nodes must be a valid integer.")
}
out.MaxNodes = int(maxNodes)
out.MaxNodes = maxNodes
default:
return nil, fmt.Errorf("Unsupported node pool argument %q", key)
}
Expand Down