mirror of https://github.com/containers/podman.git
cmd/podman/pods/create: fix break statement
This code was [somewhat messy but] correct until commit 51fbf3da9e
started to use switch instead of if, and since that time break is
breaking from the inner "switch" (rather than on the outer "for" as
originally intended).
This also fixes the following staticcheck warnings:
> cmd/podman/pods/create.go:242:5: SA4011: ineffective break statement. Did you mean to break out of the outer loop? (staticcheck)
> break
> ^
> cmd/podman/pods/create.go:245:5: SA4011: ineffective break statement. Did you mean to break out of the outer loop? (staticcheck)
> break
> ^
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
2a9b1499db
commit
5f997a70bd
|
@ -233,17 +233,17 @@ func create(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
}
|
||||
sort.Ints(vals)
|
||||
loop:
|
||||
for ind, core := range vals {
|
||||
switch {
|
||||
case core > int(cpuSet):
|
||||
if copy == "" {
|
||||
copy = "0-" + strconv.Itoa(int(cpuSet))
|
||||
infraOptions.CPUSetCPUs = copy
|
||||
break
|
||||
} else {
|
||||
infraOptions.CPUSetCPUs = copy
|
||||
break
|
||||
}
|
||||
break loop
|
||||
case ind != 0:
|
||||
copy += "," + strconv.Itoa(core)
|
||||
default:
|
||||
|
@ -252,6 +252,7 @@ func create(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
createOptions.Cpus = infraOptions.CPUS
|
||||
createOptions.CpusetCpus = infraOptions.CPUSetCPUs
|
||||
|
||||
podSpec := specgen.NewPodSpecGenerator()
|
||||
podSpec, err = entities.ToPodSpecGen(*podSpec, &createOptions)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue