Browse code

daemon/logger: 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 22:24:59
Showing 4 changed files
... ...
@@ -412,8 +412,7 @@ func TestCopierWithPartial(t *testing.T) {
412 412
 	}
413 413
 }
414 414
 
415
-type BenchmarkLoggerDummy struct {
416
-}
415
+type BenchmarkLoggerDummy struct{}
417 416
 
418 417
 func (l *BenchmarkLoggerDummy) Log(m *Message) error { PutMessage(m); return nil }
419 418
 
... ...
@@ -424,39 +423,51 @@ func (l *BenchmarkLoggerDummy) Name() string { return "dummy" }
424 424
 func BenchmarkCopier64(b *testing.B) {
425 425
 	benchmarkCopier(b, 1<<6)
426 426
 }
427
+
427 428
 func BenchmarkCopier128(b *testing.B) {
428 429
 	benchmarkCopier(b, 1<<7)
429 430
 }
431
+
430 432
 func BenchmarkCopier256(b *testing.B) {
431 433
 	benchmarkCopier(b, 1<<8)
432 434
 }
435
+
433 436
 func BenchmarkCopier512(b *testing.B) {
434 437
 	benchmarkCopier(b, 1<<9)
435 438
 }
439
+
436 440
 func BenchmarkCopier1K(b *testing.B) {
437 441
 	benchmarkCopier(b, 1<<10)
438 442
 }
443
+
439 444
 func BenchmarkCopier2K(b *testing.B) {
440 445
 	benchmarkCopier(b, 1<<11)
441 446
 }
447
+
442 448
 func BenchmarkCopier4K(b *testing.B) {
443 449
 	benchmarkCopier(b, 1<<12)
444 450
 }
451
+
445 452
 func BenchmarkCopier8K(b *testing.B) {
446 453
 	benchmarkCopier(b, 1<<13)
447 454
 }
455
+
448 456
 func BenchmarkCopier16K(b *testing.B) {
449 457
 	benchmarkCopier(b, 1<<14)
450 458
 }
459
+
451 460
 func BenchmarkCopier32K(b *testing.B) {
452 461
 	benchmarkCopier(b, 1<<15)
453 462
 }
463
+
454 464
 func BenchmarkCopier64K(b *testing.B) {
455 465
 	benchmarkCopier(b, 1<<16)
456 466
 }
467
+
457 468
 func BenchmarkCopier128K(b *testing.B) {
458 469
 	benchmarkCopier(b, 1<<17)
459 470
 }
471
+
460 472
 func BenchmarkCopier256K(b *testing.B) {
461 473
 	benchmarkCopier(b, 1<<18)
462 474
 }
... ...
@@ -77,7 +77,7 @@ func makePluginCreator(name string, l logPlugin, scopePath func(s string) string
77 77
 
78 78
 		unscopedPath := filepath.Join("/", "run", "docker", "logging")
79 79
 		logRoot := scopePath(unscopedPath)
80
-		if err := os.MkdirAll(logRoot, 0700); err != nil {
80
+		if err := os.MkdirAll(logRoot, 0o700); err != nil {
81 81
 			return nil, err
82 82
 		}
83 83
 
... ...
@@ -15,7 +15,7 @@ func openPluginStream(a *pluginAdapter) (io.WriteCloser, error) {
15 15
 	// Make sure to also open with read (in addition to write) to avoid borken pipe errors on plugin failure.
16 16
 	// It is up to the plugin to keep track of pipes that it should re-attach to, however.
17 17
 	// If the plugin doesn't open for reads, then the container will block once the pipe is full.
18
-	f, err := fifo.OpenFifo(context.Background(), a.fifoPath, unix.O_RDWR|unix.O_CREAT|unix.O_NONBLOCK, 0700)
18
+	f, err := fifo.OpenFifo(context.Background(), a.fifoPath, unix.O_RDWR|unix.O_CREAT|unix.O_NONBLOCK, 0o700)
19 19
 	if err != nil {
20 20
 		return nil, errors.Wrapf(err, "error creating i/o pipe for log plugin: %s", a.Name())
21 21
 	}
... ...
@@ -74,9 +74,7 @@ type logPluginProxyCapabilitiesResponse struct {
74 74
 }
75 75
 
76 76
 func (pp *logPluginProxy) Capabilities() (cap Capability, err error) {
77
-	var (
78
-		ret logPluginProxyCapabilitiesResponse
79
-	)
77
+	var ret logPluginProxyCapabilitiesResponse
80 78
 
81 79
 	if err = pp.Call("LogDriver.Capabilities", nil, &ret); err != nil {
82 80
 		return
... ...
@@ -97,9 +95,7 @@ type logPluginProxyReadLogsRequest struct {
97 97
 }
98 98
 
99 99
 func (pp *logPluginProxy) ReadLogs(info Info, config ReadConfig) (stream io.ReadCloser, err error) {
100
-	var (
101
-		req logPluginProxyReadLogsRequest
102
-	)
100
+	var req logPluginProxyReadLogsRequest
103 101
 
104 102
 	req.Info = info
105 103
 	req.Config = config