refactor: return an int32 for scale count

This commit is contained in:
Jose Diaz-Gonzalez
2024-01-18 19:23:57 -05:00
parent 3f96a250a2
commit 6bcb4a016d
2 changed files with 6 additions and 6 deletions

View File

@@ -390,8 +390,8 @@ func ParseReportArgs(pluginName string, arguments []string) ([]string, string, e
}
// ParseScaleOutput allows golang plugins to properly parse the output of ps-current-scale
func ParseScaleOutput(b []byte) (map[string]int, error) {
scale := make(map[string]int)
func ParseScaleOutput(b []byte) (map[string]int32, error) {
scale := make(map[string]int32)
for _, line := range strings.Split(string(b), "\n") {
s := strings.SplitN(line, "=", 2)
@@ -399,11 +399,11 @@ func ParseScaleOutput(b []byte) (map[string]int, error) {
return scale, fmt.Errorf("invalid scale output stored by dokku: %v", line)
}
processType := s[0]
count, err := strconv.Atoi(s[1])
count, err := strconv.ParseInt(s[1], 10, 32)
if err != nil {
return scale, err
}
scale[processType] = count
scale[processType] = int32(count)
}
return scale, nil