```
integration-cli/docker_cli_registry_user_agent_test.go:78:2: SA5001: should check returned error before deferring reg.Close() (staticcheck)
integration-cli/docker_cli_v2_only_test.go:30:2: SA5001: should check returned error before deferring reg.Close() (staticcheck)
integration-cli/docker_api_containers_test.go:392:3: SA5001: should check returned error before deferring resp.Body.Close() (staticcheck)
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -75,8 +75,9 @@ func (s *DockerRegistrySuite) TestUserAgentPassThrough(c *testing.T) {
|
| 75 | 75 |
var ua string |
| 76 | 76 |
|
| 77 | 77 |
reg, err := registry.NewMock(c) |
| 78 |
- defer reg.Close() |
|
| 79 | 78 |
assert.NilError(c, err) |
| 79 |
+ defer reg.Close() |
|
| 80 |
+ |
|
| 80 | 81 |
registerUserAgentHandler(reg, &ua) |
| 81 | 82 |
repoName := fmt.Sprintf("%s/busybox", reg.URL())
|
| 82 | 83 |
|
| ... | ... |
@@ -27,8 +27,8 @@ func makefile(path string, contents string) (string, error) {
|
| 27 | 27 |
// attempt to contact any v1 registry endpoints. |
| 28 | 28 |
func (s *DockerRegistrySuite) TestV2Only(c *testing.T) {
|
| 29 | 29 |
reg, err := registry.NewMock(c) |
| 30 |
- defer reg.Close() |
|
| 31 | 30 |
assert.NilError(c, err) |
| 31 |
+ defer reg.Close() |
|
| 32 | 32 |
|
| 33 | 33 |
reg.RegisterHandler("/v2/", func(w http.ResponseWriter, r *http.Request) {
|
| 34 | 34 |
w.WriteHeader(404) |
| ... | ... |
@@ -49,11 +49,10 @@ func (s *DockerRegistrySuite) TestV2Only(c *testing.T) {
|
| 49 | 49 |
dockerfileName, err := makefile(tmp, fmt.Sprintf("FROM %s/busybox", reg.URL()))
|
| 50 | 50 |
assert.NilError(c, err, "Unable to create test dockerfile") |
| 51 | 51 |
|
| 52 |
- s.d.Cmd("build", "--file", dockerfileName, tmp)
|
|
| 53 |
- |
|
| 54 |
- s.d.Cmd("run", repoName)
|
|
| 55 |
- s.d.Cmd("login", "-u", "richard", "-p", "testtest", reg.URL())
|
|
| 56 |
- s.d.Cmd("tag", "busybox", repoName)
|
|
| 57 |
- s.d.Cmd("push", repoName)
|
|
| 58 |
- s.d.Cmd("pull", repoName)
|
|
| 52 |
+ _, _ = s.d.Cmd("build", "--file", dockerfileName, tmp)
|
|
| 53 |
+ _, _ = s.d.Cmd("run", repoName)
|
|
| 54 |
+ _, _ = s.d.Cmd("login", "-u", "richard", "-p", "testtest", reg.URL())
|
|
| 55 |
+ _, _ = s.d.Cmd("tag", "busybox", repoName)
|
|
| 56 |
+ _, _ = s.d.Cmd("push", repoName)
|
|
| 57 |
+ _, _ = s.d.Cmd("pull", repoName)
|
|
| 59 | 58 |
} |