daemon/graphdriver: use strconv instead of fmt.Sprintf

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-10-05 16:24:46 +02:00
parent c218211012
commit 7fbf321c2a
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
4 changed files with 8 additions and 6 deletions

View File

@ -32,6 +32,7 @@ import (
"os/exec" "os/exec"
"path" "path"
"path/filepath" "path/filepath"
"strconv"
"strings" "strings"
"sync" "sync"
@ -209,8 +210,8 @@ func (a *Driver) Status() [][2]string {
return [][2]string{ return [][2]string{
{"Root Dir", a.rootPath()}, {"Root Dir", a.rootPath()},
{"Backing Filesystem", backingFs}, {"Backing Filesystem", backingFs},
{"Dirs", fmt.Sprintf("%d", len(ids))}, {"Dirs", strconv.Itoa(len(ids))},
{"Dirperm1 Supported", fmt.Sprintf("%v", useDirperm())}, {"Dirperm1 Supported", strconv.FormatBool(useDirperm())},
} }
} }

View File

@ -10,6 +10,7 @@ import (
"os" "os"
"path" "path"
"path/filepath" "path/filepath"
"strconv"
"sync" "sync"
"testing" "testing"
@ -651,8 +652,8 @@ func testMountMoreThan42Layers(t *testing.T, mountPath string) {
for i := 1; i < 127; i++ { for i := 1; i < 127; i++ {
expected++ expected++
var ( var (
parent = fmt.Sprintf("%d", i-1) parent = strconv.Itoa(i - 1)
current = fmt.Sprintf("%d", i) current = strconv.Itoa(i)
) )
if parent == "0" { if parent == "0" {

View File

@ -156,7 +156,7 @@ func (d *Driver) Status() [][2]string {
status = append(status, [2]string{"Build Version", bv}) status = append(status, [2]string{"Build Version", bv})
} }
if lv := btrfsLibVersion(); lv != -1 { if lv := btrfsLibVersion(); lv != -1 {
status = append(status, [2]string{"Library Version", fmt.Sprintf("%d", lv)}) status = append(status, [2]string{"Library Version", strconv.Itoa(lv)})
} }
return status return status
} }

View File

@ -231,7 +231,7 @@ func (d *Driver) GetMetadata(id string) (map[string]string, error) {
} }
func (d *Driver) cloneFilesystem(name, parentName string) error { func (d *Driver) cloneFilesystem(name, parentName string) error {
snapshotName := fmt.Sprintf("%d", time.Now().Nanosecond()) snapshotName := strconv.Itoa(time.Now().Nanosecond())
parentDataset := zfs.Dataset{Name: parentName} parentDataset := zfs.Dataset{Name: parentName}
snapshot, err := parentDataset.Snapshot(snapshotName /*recursive */, false) snapshot, err := parentDataset.Snapshot(snapshotName /*recursive */, false)
if err != nil { if err != nil {