diff --git a/cmd/ctr/commands/snapshots/snapshots.go b/cmd/ctr/commands/snapshots/snapshots.go index 4f74fe774..c8ace2d5b 100644 --- a/cmd/ctr/commands/snapshots/snapshots.go +++ b/cmd/ctr/commands/snapshots/snapshots.go @@ -23,6 +23,7 @@ import ( "io" "os" "path/filepath" + "strconv" "strings" "text/tabwriter" "time" @@ -207,7 +208,7 @@ var usageCommand = cli.Command{ var displaySize func(int64) string if context.Bool("b") { displaySize = func(s int64) string { - return fmt.Sprintf("%d", s) + return strconv.FormatInt(s, 10) } } else { displaySize = func(s int64) string { diff --git a/integration/client/daemon_config_linux_test.go b/integration/client/daemon_config_linux_test.go index 86f9dc3f9..f45d619b8 100644 --- a/integration/client/daemon_config_linux_test.go +++ b/integration/client/daemon_config_linux_test.go @@ -18,9 +18,9 @@ package client import ( "bufio" - "fmt" "os" "path/filepath" + "strconv" "strings" "syscall" "testing" @@ -133,7 +133,7 @@ func TestDaemonCustomCgroup(t *testing.T) { t.Skip("skip TestDaemonCustomCgroup since no cgroup path available") } - customCgroup := fmt.Sprintf("%d", time.Now().Nanosecond()) + customCgroup := strconv.Itoa(time.Now().Nanosecond()) configTOML := ` version = 2 [cgroup] diff --git a/integration/nri_test.go b/integration/nri_test.go index a2fe2e7dc..22ceccf8d 100644 --- a/integration/nri_test.go +++ b/integration/nri_test.go @@ -602,7 +602,7 @@ func (tc *nriTest) setup() { tc.prefix = strings.ToLower(tc.name) } if tc.namespace == "" { - tc.namespace = tc.prefix + "-" + fmt.Sprintf("%d", os.Getpid()) + tc.namespace = tc.prefix + "-" + strconv.Itoa(os.Getpid()) } tc.sbCfg = make(map[string]*runtime.PodSandboxConfig) diff --git a/pkg/cri/sbserver/helpers.go b/pkg/cri/sbserver/helpers.go index 44b5141cb..68abc1e4d 100644 --- a/pkg/cri/sbserver/helpers.go +++ b/pkg/cri/sbserver/helpers.go @@ -151,7 +151,7 @@ func makeContainerName(c *runtime.ContainerMetadata, s *runtime.PodSandboxMetada s.Name, // 1: pod name s.Namespace, // 2: pod namespace s.Uid, // 3: pod uid - strconv.FormatUint(uint64(s.Attempt), 10), // 4: attempt number of creating the container + strconv.FormatUint(uint64(c.Attempt), 10), // 4: attempt number of creating the container }, nameDelimiter) } diff --git a/pkg/cri/server/helpers.go b/pkg/cri/server/helpers.go index c72e25376..447e97088 100644 --- a/pkg/cri/server/helpers.go +++ b/pkg/cri/server/helpers.go @@ -112,7 +112,7 @@ func makeContainerName(c *runtime.ContainerMetadata, s *runtime.PodSandboxMetada s.Name, // 1: pod name s.Namespace, // 2: pod namespace s.Uid, // 3: pod uid - strconv.FormatUint(uint64(s.Attempt), 10), // 4: attempt number of creating the container + strconv.FormatUint(uint64(c.Attempt), 10), // 4: attempt number of creating the container }, nameDelimiter) }