For some reason, `go vet` and `go fmt` validate does not capture
several issues.
The following was the output of `go vet`:
```
ubuntu@ubuntu:~/docker$ go vet ./... 2>&1 | grep -v ^vendor | grep -v '^exit status 1$'
cli/command/formatter/container_test.go:393: possible formatting directive in Log call
volume/volume_test.go:257: arg mp.RW for printf verb %s of wrong type: bool
```
The following was the output of `go fmt -s`:
```
ubuntu@ubuntu:~/docker$ gofmt -s -l . | grep -v ^vendor
cli/command/stack/list.go
daemon/commit.go
```
Fixed above issues with `go vet` and `go fmt -s`
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
| ... | ... |
@@ -372,7 +372,7 @@ func TestContainerContextWriteJSONField(t *testing.T) {
|
| 372 | 372 |
} |
| 373 | 373 |
|
| 374 | 374 |
func TestContainerBackCompat(t *testing.T) {
|
| 375 |
- containers := []types.Container{types.Container{ID: "brewhaha"}}
|
|
| 375 |
+ containers := []types.Container{{ID: "brewhaha"}}
|
|
| 376 | 376 |
cases := []string{
|
| 377 | 377 |
"ID", |
| 378 | 378 |
"Names", |
| ... | ... |
@@ -390,7 +390,7 @@ func TestContainerBackCompat(t *testing.T) {
|
| 390 | 390 |
for _, c := range cases {
|
| 391 | 391 |
ctx := Context{Format: Format(fmt.Sprintf("{{ .%s }}", c)), Output: buf}
|
| 392 | 392 |
if err := ContainerWrite(ctx, containers); err != nil {
|
| 393 |
- t.Log("could not render template for field '%s': %v", c, err)
|
|
| 393 |
+ t.Logf("could not render template for field '%s': %v", c, err)
|
|
| 394 | 394 |
t.Fail() |
| 395 | 395 |
} |
| 396 | 396 |
buf.Reset() |
| ... | ... |
@@ -240,8 +240,8 @@ func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str |
| 240 | 240 |
} |
| 241 | 241 |
|
| 242 | 242 |
attributes := map[string]string{
|
| 243 |
- "comment": c.Comment, |
|
| 244 |
- "imageID": id.String(), |
|
| 243 |
+ "comment": c.Comment, |
|
| 244 |
+ "imageID": id.String(), |
|
| 245 | 245 |
"imageRef": imageRef, |
| 246 | 246 |
} |
| 247 | 247 |
daemon.LogContainerEventWithAttributes(container, "commit", attributes) |
| ... | ... |
@@ -254,7 +254,7 @@ func TestParseMountSpec(t *testing.T) {
|
| 254 | 254 |
t.Fatalf("Expected mount source to match. Expected: '%s', Actual: '%s'", c.expected.Source, mp.Source)
|
| 255 | 255 |
} |
| 256 | 256 |
if c.expected.RW != mp.RW {
|
| 257 |
- t.Fatalf("Expected mount writable to match. Expected: '%v', Actual: '%s'", c.expected.RW, mp.RW)
|
|
| 257 |
+ t.Fatalf("Expected mount writable to match. Expected: '%v', Actual: '%v'", c.expected.RW, mp.RW)
|
|
| 258 | 258 |
} |
| 259 | 259 |
if c.expected.Propagation != mp.Propagation {
|
| 260 | 260 |
t.Fatalf("Expected mount propagation to match. Expected: '%v', Actual: '%s'", c.expected.Propagation, mp.Propagation)
|