Browse Source

daemon/graphdriver: use strconv instead of fmt.Sprintf

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 years ago
parent
commit
7fbf321c2a

+ 3 - 2
daemon/graphdriver/aufs/aufs.go

@@ -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))},
-		{"Dirperm1 Supported", fmt.Sprintf("%v", useDirperm())},
+		{"Dirs", strconv.Itoa(len(ids))},
+		{"Dirperm1 Supported", strconv.FormatBool(useDirperm())},
 	}
 	}
 }
 }
 
 

+ 3 - 2
daemon/graphdriver/aufs/aufs_test.go

@@ -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)
-			current = fmt.Sprintf("%d", i)
+			parent  = strconv.Itoa(i - 1)
+			current = strconv.Itoa(i)
 		)
 		)
 
 
 		if parent == "0" {
 		if parent == "0" {

+ 1 - 1
daemon/graphdriver/btrfs/btrfs.go

@@ -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
 }
 }

+ 1 - 1
daemon/graphdriver/zfs/zfs.go

@@ -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 {