Use sprintf to generate port numbers while committing

Casting integers to strings is definitely not correct, so let the
standard library handle matters.

Fixes #2066

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
Matthew Heon
2019-01-02 10:26:34 -05:00
parent 7438b7bd3a
commit 9c7d512136

View File

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