Przeglądaj źródła

Fix go vet errors

Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)

Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
LK4D4 11 lat temu
rodzic
commit
f08cd445b0

+ 1 - 1
api/client/commands.go

@@ -91,7 +91,7 @@ func (cli *DockerCli) CmdHelp(args ...string) error {
 
 
 // FIXME: 'insert' is deprecated.
 // FIXME: 'insert' is deprecated.
 func (cli *DockerCli) CmdInsert(args ...string) error {
 func (cli *DockerCli) CmdInsert(args ...string) error {
-	fmt.Fprintf(os.Stderr, "Warning: '%s' is deprecated and will be removed in a future version. Please use 'docker build' and 'ADD' instead.\n")
+	fmt.Fprintf(os.Stderr, "Warning: 'insert' is deprecated and will be removed in a future version. Please use 'docker build' and 'ADD' instead.\n")
 	cmd := cli.Subcmd("insert", "IMAGE URL PATH", "Insert a file from URL in the IMAGE at PATH")
 	cmd := cli.Subcmd("insert", "IMAGE URL PATH", "Insert a file from URL in the IMAGE at PATH")
 	if err := cmd.Parse(args); err != nil {
 	if err := cmd.Parse(args); err != nil {
 		return nil
 		return nil

+ 1 - 1
archive/archive_test.go

@@ -164,6 +164,6 @@ func TestUntarUstarGnuConflict(t *testing.T) {
 		}
 		}
 	}
 	}
 	if !found {
 	if !found {
-		t.Fatal("%s not found in the archive", "root/.cpanm/work/1395823785.24209/Plack-1.0030/blib/man3/Plack::Middleware::LighttpdScriptNameFix.3pm")
+		t.Fatalf("%s not found in the archive", "root/.cpanm/work/1395823785.24209/Plack-1.0030/blib/man3/Plack::Middleware::LighttpdScriptNameFix.3pm")
 	}
 	}
 }
 }

+ 1 - 1
daemon/graphdriver/devmapper/deviceset.go

@@ -55,7 +55,7 @@ type DevInfo struct {
 }
 }
 
 
 type MetaData struct {
 type MetaData struct {
-	Devices     map[string]*DevInfo `json:devices`
+	Devices     map[string]*DevInfo `json:"Devices"`
 	devicesLock sync.Mutex          `json:"-"` // Protects all read/writes to Devices map
 	devicesLock sync.Mutex          `json:"-"` // Protects all read/writes to Devices map
 }
 }
 
 

+ 4 - 3
daemon/graphdriver/graphtest/graphtest.go

@@ -1,12 +1,13 @@
 package graphtest
 package graphtest
 
 
 import (
 import (
-	"github.com/dotcloud/docker/daemon/graphdriver"
 	"io/ioutil"
 	"io/ioutil"
 	"os"
 	"os"
 	"path"
 	"path"
 	"syscall"
 	"syscall"
 	"testing"
 	"testing"
+
+	"github.com/dotcloud/docker/daemon/graphdriver"
 )
 )
 
 
 var (
 var (
@@ -94,10 +95,10 @@ func verifyFile(t *testing.T, path string, mode os.FileMode, uid, gid uint32) {
 
 
 	if stat, ok := fi.Sys().(*syscall.Stat_t); ok {
 	if stat, ok := fi.Sys().(*syscall.Stat_t); ok {
 		if stat.Uid != uid {
 		if stat.Uid != uid {
-			t.Fatal("%s no owned by uid %d", path, uid)
+			t.Fatalf("%s no owned by uid %d", path, uid)
 		}
 		}
 		if stat.Gid != gid {
 		if stat.Gid != gid {
-			t.Fatal("%s not owned by gid %d", path, gid)
+			t.Fatalf("%s not owned by gid %d", path, gid)
 		}
 		}
 	}
 	}
 
 

+ 1 - 1
engine/streams_test.go

@@ -141,7 +141,7 @@ func TestOutputAdd(t *testing.T) {
 		t.Fatalf("Expected %d, got %d", len(input), n)
 		t.Fatalf("Expected %d, got %d", len(input), n)
 	}
 	}
 	if output := b.String(); output != input {
 	if output := b.String(); output != input {
-		t.Fatal("Received wrong data from Add.\nExpected: '%s'\nGot:     '%s'", input, output)
+		t.Fatalf("Received wrong data from Add.\nExpected: '%s'\nGot:     '%s'", input, output)
 	}
 	}
 }
 }
 
 

+ 0 - 1
engine/table.go

@@ -137,5 +137,4 @@ func (t *Table) ReadFrom(src io.Reader) (n int64, err error) {
 		}
 		}
 		t.Add(env)
 		t.Add(env)
 	}
 	}
-	return 0, nil
 }
 }

+ 4 - 4
integration-cli/docker_cli_images_test.go

@@ -27,14 +27,14 @@ func TestCLIImageTagRemove(t *testing.T) {
 	{
 	{
 		imagesAfter, _, _ := cmd(t, "images", "-a")
 		imagesAfter, _, _ := cmd(t, "images", "-a")
 		if nLines(imagesAfter) != nLines(imagesBefore)+3 {
 		if nLines(imagesAfter) != nLines(imagesBefore)+3 {
-			t.Fatalf("before: %#s\n\nafter: %#s\n", imagesBefore, imagesAfter)
+			t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter)
 		}
 		}
 	}
 	}
 	cmd(t, "rmi", "utest/docker:tag2")
 	cmd(t, "rmi", "utest/docker:tag2")
 	{
 	{
 		imagesAfter, _, _ := cmd(t, "images", "-a")
 		imagesAfter, _, _ := cmd(t, "images", "-a")
 		if nLines(imagesAfter) != nLines(imagesBefore)+2 {
 		if nLines(imagesAfter) != nLines(imagesBefore)+2 {
-			t.Fatalf("before: %#s\n\nafter: %#s\n", imagesBefore, imagesAfter)
+			t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter)
 		}
 		}
 
 
 	}
 	}
@@ -42,7 +42,7 @@ func TestCLIImageTagRemove(t *testing.T) {
 	{
 	{
 		imagesAfter, _, _ := cmd(t, "images", "-a")
 		imagesAfter, _, _ := cmd(t, "images", "-a")
 		if nLines(imagesAfter) != nLines(imagesBefore)+1 {
 		if nLines(imagesAfter) != nLines(imagesBefore)+1 {
-			t.Fatalf("before: %#s\n\nafter: %#s\n", imagesBefore, imagesAfter)
+			t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter)
 		}
 		}
 
 
 	}
 	}
@@ -50,7 +50,7 @@ func TestCLIImageTagRemove(t *testing.T) {
 	{
 	{
 		imagesAfter, _, _ := cmd(t, "images", "-a")
 		imagesAfter, _, _ := cmd(t, "images", "-a")
 		if nLines(imagesAfter) != nLines(imagesBefore)+0 {
 		if nLines(imagesAfter) != nLines(imagesBefore)+0 {
-			t.Fatalf("before: %#s\n\nafter: %#s\n", imagesBefore, imagesAfter)
+			t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter)
 		}
 		}
 
 
 	}
 	}

+ 5 - 5
integration-cli/docker_cli_run_test.go

@@ -450,32 +450,32 @@ func TestVolumeWithSymlink(t *testing.T) {
 	buildCmd.Dir = buildDirectory
 	buildCmd.Dir = buildDirectory
 	err := buildCmd.Run()
 	err := buildCmd.Run()
 	if err != nil {
 	if err != nil {
-		t.Fatal("could not build 'docker-test-volumewithsymlink': %v", err)
+		t.Fatalf("could not build 'docker-test-volumewithsymlink': %v", err)
 	}
 	}
 
 
 	cmd := exec.Command(dockerBinary, "run", "-v", "/bar/foo", "--name", "test-volumewithsymlink", "docker-test-volumewithsymlink", "sh", "-c", "mount | grep -q /foo/foo")
 	cmd := exec.Command(dockerBinary, "run", "-v", "/bar/foo", "--name", "test-volumewithsymlink", "docker-test-volumewithsymlink", "sh", "-c", "mount | grep -q /foo/foo")
 	exitCode, err := runCommand(cmd)
 	exitCode, err := runCommand(cmd)
 	if err != nil || exitCode != 0 {
 	if err != nil || exitCode != 0 {
-		t.Fatal("[run] err: %v, exitcode: %d", err, exitCode)
+		t.Fatalf("[run] err: %v, exitcode: %d", err, exitCode)
 	}
 	}
 
 
 	var volPath string
 	var volPath string
 	cmd = exec.Command(dockerBinary, "inspect", "-f", "{{range .Volumes}}{{.}}{{end}}", "test-volumewithsymlink")
 	cmd = exec.Command(dockerBinary, "inspect", "-f", "{{range .Volumes}}{{.}}{{end}}", "test-volumewithsymlink")
 	volPath, exitCode, err = runCommandWithOutput(cmd)
 	volPath, exitCode, err = runCommandWithOutput(cmd)
 	if err != nil || exitCode != 0 {
 	if err != nil || exitCode != 0 {
-		t.Fatal("[inspect] err: %v, exitcode: %d", err, exitCode)
+		t.Fatalf("[inspect] err: %v, exitcode: %d", err, exitCode)
 	}
 	}
 
 
 	cmd = exec.Command(dockerBinary, "rm", "-v", "test-volumewithsymlink")
 	cmd = exec.Command(dockerBinary, "rm", "-v", "test-volumewithsymlink")
 	exitCode, err = runCommand(cmd)
 	exitCode, err = runCommand(cmd)
 	if err != nil || exitCode != 0 {
 	if err != nil || exitCode != 0 {
-		t.Fatal("[rm] err: %v, exitcode: %d", err, exitCode)
+		t.Fatalf("[rm] err: %v, exitcode: %d", err, exitCode)
 	}
 	}
 
 
 	f, err := os.Open(volPath)
 	f, err := os.Open(volPath)
 	defer f.Close()
 	defer f.Close()
 	if !os.IsNotExist(err) {
 	if !os.IsNotExist(err) {
-		t.Fatal("[open] (expecting 'file does not exist' error) err: %v, volPath: %s", err, volPath)
+		t.Fatalf("[open] (expecting 'file does not exist' error) err: %v, volPath: %s", err, volPath)
 	}
 	}
 
 
 	deleteImages("docker-test-volumewithsymlink")
 	deleteImages("docker-test-volumewithsymlink")

+ 3 - 2
pkg/graphdb/graphdb_test.go

@@ -1,13 +1,14 @@
 package graphdb
 package graphdb
 
 
 import (
 import (
-	_ "code.google.com/p/gosqlite/sqlite3"
 	"database/sql"
 	"database/sql"
 	"fmt"
 	"fmt"
 	"os"
 	"os"
 	"path"
 	"path"
 	"strconv"
 	"strconv"
 	"testing"
 	"testing"
+
+	_ "code.google.com/p/gosqlite/sqlite3"
 )
 )
 
 
 func newTestDb(t *testing.T) (*Database, string) {
 func newTestDb(t *testing.T) (*Database, string) {
@@ -535,6 +536,6 @@ func TestConcurrentWrites(t *testing.T) {
 		}
 		}
 	}
 	}
 	if any {
 	if any {
-		t.Fatal()
+		t.Fail()
 	}
 	}
 }
 }

+ 2 - 2
pkg/mflag/example/example.go

@@ -28,8 +28,8 @@ func main() {
 		flag.PrintDefaults()
 		flag.PrintDefaults()
 	} else {
 	} else {
 		fmt.Printf("s/#hidden/-string: %s\n", str)
 		fmt.Printf("s/#hidden/-string: %s\n", str)
-		fmt.Printf("b: %b\n", b)
-		fmt.Printf("-bool: %b\n", b2)
+		fmt.Printf("b: %t\n", b)
+		fmt.Printf("-bool: %t\n", b2)
 		fmt.Printf("s/#hidden/-string(via lookup): %s\n", flag.Lookup("s").Value.String())
 		fmt.Printf("s/#hidden/-string(via lookup): %s\n", flag.Lookup("s").Value.String())
 		fmt.Printf("ARGS: %v\n", flag.Args())
 		fmt.Printf("ARGS: %v\n", flag.Args())
 	}
 	}

+ 2 - 2
registry/registry_test.go

@@ -264,7 +264,7 @@ func TestAddRequiredHeadersToRedirectedRequests(t *testing.T) {
 		AddRequiredHeadersToRedirectedRequests(reqTo, []*http.Request{reqFrom})
 		AddRequiredHeadersToRedirectedRequests(reqTo, []*http.Request{reqFrom})
 
 
 		if len(reqTo.Header) != 1 {
 		if len(reqTo.Header) != 1 {
-			t.Fatal("Expected 1 headers, got %d", len(reqTo.Header))
+			t.Fatalf("Expected 1 headers, got %d", len(reqTo.Header))
 		}
 		}
 
 
 		if reqTo.Header.Get("Content-Type") != "application/json" {
 		if reqTo.Header.Get("Content-Type") != "application/json" {
@@ -288,7 +288,7 @@ func TestAddRequiredHeadersToRedirectedRequests(t *testing.T) {
 		AddRequiredHeadersToRedirectedRequests(reqTo, []*http.Request{reqFrom})
 		AddRequiredHeadersToRedirectedRequests(reqTo, []*http.Request{reqFrom})
 
 
 		if len(reqTo.Header) != 2 {
 		if len(reqTo.Header) != 2 {
-			t.Fatal("Expected 2 headers, got %d", len(reqTo.Header))
+			t.Fatalf("Expected 2 headers, got %d", len(reqTo.Header))
 		}
 		}
 
 
 		if reqTo.Header.Get("Content-Type") != "application/json" {
 		if reqTo.Header.Get("Content-Type") != "application/json" {

+ 3 - 2
utils/tarsum_test.go

@@ -4,11 +4,12 @@ import (
 	"bytes"
 	"bytes"
 	"crypto/rand"
 	"crypto/rand"
 	"fmt"
 	"fmt"
-	"github.com/dotcloud/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
 	"io"
 	"io"
 	"io/ioutil"
 	"io/ioutil"
 	"os"
 	"os"
 	"testing"
 	"testing"
+
+	"github.com/dotcloud/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
 )
 )
 
 
 type testLayer struct {
 type testLayer struct {
@@ -109,7 +110,7 @@ func TestTarSums(t *testing.T) {
 			fh = sizedTar(*layer.options)
 			fh = sizedTar(*layer.options)
 		} else {
 		} else {
 			// What else is there to test?
 			// What else is there to test?
-			t.Errorf("what to do with %#V", layer)
+			t.Errorf("what to do with %#v", layer)
 			continue
 			continue
 		}
 		}
 		if file, ok := fh.(*os.File); ok {
 		if file, ok := fh.(*os.File); ok {