Browse code

integration-cli: TestContainerAPIGetExport: fix minor linting issues

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2025/07/26 18:13:27
Showing 1 changed files
... ...
@@ -112,10 +112,10 @@ func (s *DockerAPISuite) TestContainerAPIGetExport(c *testing.T) {
112 112
 	found := false
113 113
 	for tarReader := tar.NewReader(body); ; {
114 114
 		h, err := tarReader.Next()
115
-		if err != nil && err == io.EOF {
115
+		if errors.Is(err, io.EOF) {
116 116
 			break
117 117
 		}
118
-		if h.Name == "test" {
118
+		if h != nil && h.Name == "test" {
119 119
 			found = true
120 120
 			break
121 121
 		}
... ...
@@ -177,10 +177,11 @@ func (s *DockerAPISuite) TestGetContainerStats(c *testing.T) {
177 177
 		c.Fatal("stream was not closed after container was removed")
178 178
 	case sr := <-bc:
179 179
 		dec := json.NewDecoder(sr.stats.Body)
180
-		defer sr.stats.Body.Close()
181 180
 		var s *container.StatsResponse
182 181
 		// decode only one object from the stream
183
-		assert.NilError(c, dec.Decode(&s))
182
+		err := dec.Decode(&s)
183
+		_ = sr.stats.Body.Close()
184
+		assert.NilError(c, err)
184 185
 	}
185 186
 }
186 187