Browse code

integration/plugin: format code with gofumpt

Formatting the code with https://github.com/mvdan/gofumpt

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

Sebastiaan van Stijn authored on 2022/01/20 21:55:27
Showing 8 changed files
... ...
@@ -55,11 +55,11 @@ func setupTestV1(t *testing.T) func() {
55 55
 	ctrl = &authorizationController{}
56 56
 	teardown := setupTest(t)
57 57
 
58
-	err := os.MkdirAll("/etc/docker/plugins", 0755)
58
+	err := os.MkdirAll("/etc/docker/plugins", 0o755)
59 59
 	assert.NilError(t, err)
60 60
 
61 61
 	fileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", testAuthZPlugin)
62
-	err = os.WriteFile(fileName, []byte(server.URL), 0644)
62
+	err = os.WriteFile(fileName, []byte(server.URL), 0o644)
63 63
 	assert.NilError(t, err)
64 64
 
65 65
 	return func() {
... ...
@@ -231,7 +231,7 @@ func TestPluginsWithRuntimes(t *testing.T) {
231 231
 	exec runc $@
232 232
 	`, dir)
233 233
 
234
-	assert.NilError(t, os.WriteFile(p, []byte(script), 0777))
234
+	assert.NilError(t, os.WriteFile(p, []byte(script), 0o777))
235 235
 
236 236
 	type config struct {
237 237
 		Runtimes map[string]types.Runtime `json:"runtimes"`
... ...
@@ -244,7 +244,7 @@ func TestPluginsWithRuntimes(t *testing.T) {
244 244
 		},
245 245
 	})
246 246
 	configPath := filepath.Join(dir, "config.json")
247
-	os.WriteFile(configPath, cfg, 0644)
247
+	os.WriteFile(configPath, cfg, 0o644)
248 248
 
249 249
 	t.Run("No Args", func(t *testing.T) {
250 250
 		d.Restart(t, "--default-runtime=myrt", "--config-file="+configPath)
... ...
@@ -344,11 +344,11 @@ func setupPlugin(t *testing.T, ec map[string]*graphEventsCounter, ext string, mu
344 344
 		respond(w, &graphDriverResponse{Size: size})
345 345
 	})
346 346
 
347
-	err = os.MkdirAll("/etc/docker/plugins", 0755)
347
+	err = os.MkdirAll("/etc/docker/plugins", 0o755)
348 348
 	assert.NilError(t, err)
349 349
 
350 350
 	specFile := "/etc/docker/plugins/" + name + "." + ext
351
-	err = os.WriteFile(specFile, b, 0644)
351
+	err = os.WriteFile(specFile, b, 0o644)
352 352
 	assert.NilError(t, err)
353 353
 }
354 354
 
... ...
@@ -8,9 +8,7 @@ import (
8 8
 	"github.com/docker/docker/testutil/environment"
9 9
 )
10 10
 
11
-var (
12
-	testEnv *environment.Execution
13
-)
11
+var testEnv *environment.Execution
14 12
 
15 13
 func TestMain(m *testing.M) {
16 14
 	var err error
... ...
@@ -27,7 +27,7 @@ func main() {
27 27
 			return
28 28
 		}
29 29
 
30
-		f, err := os.OpenFile(startReq.File, os.O_RDONLY, 0600)
30
+		f, err := os.OpenFile(startReq.File, os.O_RDONLY, 0o600)
31 31
 		if err != nil {
32 32
 			http.Error(w, err.Error(), http.StatusInternalServerError)
33 33
 			return
... ...
@@ -37,7 +37,7 @@ func handle(mux *http.ServeMux) {
37 37
 			return
38 38
 		}
39 39
 
40
-		f, err := os.OpenFile(req.File, syscall.O_RDONLY, 0700)
40
+		f, err := os.OpenFile(req.File, syscall.O_RDONLY, 0o700)
41 41
 		if err != nil {
42 42
 			respond(err, w)
43 43
 		}
... ...
@@ -8,9 +8,7 @@ import (
8 8
 	"github.com/docker/docker/testutil/environment"
9 9
 )
10 10
 
11
-var (
12
-	testEnv *environment.Execution
13
-)
11
+var testEnv *environment.Execution
14 12
 
15 13
 func TestMain(m *testing.M) {
16 14
 	var err error
... ...
@@ -8,9 +8,7 @@ import (
8 8
 	"github.com/docker/docker/testutil/environment"
9 9
 )
10 10
 
11
-var (
12
-	testEnv *environment.Execution
13
-)
11
+var testEnv *environment.Execution
14 12
 
15 13
 func TestMain(m *testing.M) {
16 14
 	var err error