Skip to content

Commit

Permalink
libpod: exposed port use old loop syntax
Browse files Browse the repository at this point in the history
The range over int syntax was only added in go 1.22, this branch is
currently build with go 1.21 in RHEL so we need to convert it back to
the old syntax.

And add the missing "fmt" import in the test file.

Signed-off-by: Paul Holzinger <[email protected]>
  • Loading branch information
Luap99 committed Oct 25, 2024
1 parent a8c07f8 commit 0889c74
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libpod/container_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func (c *Container) generateInspectContainerConfig(spec *spec.Spec) *define.Insp
}
}
for _, mapping := range c.config.PortMappings {
for i := range mapping.Range {
for i := uint16(0); i < mapping.Range; i++ {
exposedPorts[fmt.Sprintf("%d/%s", mapping.ContainerPort+i, mapping.Protocol)] = struct{}{}
}
}
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/container_inspect_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package integration

import (
"fmt"

"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/annotations"
. "github.com/containers/podman/v4/test/utils"
Expand Down

0 comments on commit 0889c74

Please sign in to comment.