Skip to content

Commit

Permalink
Use sprintf to generate port numbers while committing
Browse files Browse the repository at this point in the history
Casting integers to strings is definitely not correct, so let the
standard library handle matters.

Fixes containers#2066

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
  • Loading branch information
mheon committed Jan 2, 2019
1 parent 7438b7b commit 9c7d512
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libpod/container_commit.go
Expand Up @@ -2,6 +2,7 @@ package libpod

import (
"context"
"fmt"
"strings"

"github.com/containers/buildah"
Expand Down Expand Up @@ -101,7 +102,7 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai
}
// Expose ports
for _, p := range c.config.PortMappings {
importBuilder.SetPort(string(p.ContainerPort))
importBuilder.SetPort(fmt.Sprintf("%d", p.ContainerPort))
}
// Labels
for k, v := range c.Labels() {
Expand Down

0 comments on commit 9c7d512

Please sign in to comment.