瀏覽代碼

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 3 年之前
父節點
當前提交
4b3900a257
共有 4 個文件被更改,包括 17 次插入10 次删除
  1. 13 2
      daemon/logger/copier_test.go
  2. 1 1
      daemon/logger/plugin.go
  3. 1 1
      daemon/logger/plugin_unix.go
  4. 2 6
      daemon/logger/proxy.go

+ 13 - 2
daemon/logger/copier_test.go

@@ -412,8 +412,7 @@ func TestCopierWithPartial(t *testing.T) {
 	}
 }
 
-type BenchmarkLoggerDummy struct {
-}
+type BenchmarkLoggerDummy struct{}
 
 func (l *BenchmarkLoggerDummy) Log(m *Message) error { PutMessage(m); return nil }
 
@@ -424,39 +423,51 @@ func (l *BenchmarkLoggerDummy) Name() string { return "dummy" }
 func BenchmarkCopier64(b *testing.B) {
 	benchmarkCopier(b, 1<<6)
 }
+
 func BenchmarkCopier128(b *testing.B) {
 	benchmarkCopier(b, 1<<7)
 }
+
 func BenchmarkCopier256(b *testing.B) {
 	benchmarkCopier(b, 1<<8)
 }
+
 func BenchmarkCopier512(b *testing.B) {
 	benchmarkCopier(b, 1<<9)
 }
+
 func BenchmarkCopier1K(b *testing.B) {
 	benchmarkCopier(b, 1<<10)
 }
+
 func BenchmarkCopier2K(b *testing.B) {
 	benchmarkCopier(b, 1<<11)
 }
+
 func BenchmarkCopier4K(b *testing.B) {
 	benchmarkCopier(b, 1<<12)
 }
+
 func BenchmarkCopier8K(b *testing.B) {
 	benchmarkCopier(b, 1<<13)
 }
+
 func BenchmarkCopier16K(b *testing.B) {
 	benchmarkCopier(b, 1<<14)
 }
+
 func BenchmarkCopier32K(b *testing.B) {
 	benchmarkCopier(b, 1<<15)
 }
+
 func BenchmarkCopier64K(b *testing.B) {
 	benchmarkCopier(b, 1<<16)
 }
+
 func BenchmarkCopier128K(b *testing.B) {
 	benchmarkCopier(b, 1<<17)
 }
+
 func BenchmarkCopier256K(b *testing.B) {
 	benchmarkCopier(b, 1<<18)
 }

+ 1 - 1
daemon/logger/plugin.go

@@ -77,7 +77,7 @@ func makePluginCreator(name string, l logPlugin, scopePath func(s string) string
 
 		unscopedPath := filepath.Join("/", "run", "docker", "logging")
 		logRoot := scopePath(unscopedPath)
-		if err := os.MkdirAll(logRoot, 0700); err != nil {
+		if err := os.MkdirAll(logRoot, 0o700); err != nil {
 			return nil, err
 		}
 

+ 1 - 1
daemon/logger/plugin_unix.go

@@ -15,7 +15,7 @@ func openPluginStream(a *pluginAdapter) (io.WriteCloser, error) {
 	// Make sure to also open with read (in addition to write) to avoid borken pipe errors on plugin failure.
 	// It is up to the plugin to keep track of pipes that it should re-attach to, however.
 	// If the plugin doesn't open for reads, then the container will block once the pipe is full.
-	f, err := fifo.OpenFifo(context.Background(), a.fifoPath, unix.O_RDWR|unix.O_CREAT|unix.O_NONBLOCK, 0700)
+	f, err := fifo.OpenFifo(context.Background(), a.fifoPath, unix.O_RDWR|unix.O_CREAT|unix.O_NONBLOCK, 0o700)
 	if err != nil {
 		return nil, errors.Wrapf(err, "error creating i/o pipe for log plugin: %s", a.Name())
 	}

+ 2 - 6
daemon/logger/proxy.go

@@ -74,9 +74,7 @@ type logPluginProxyCapabilitiesResponse struct {
 }
 
 func (pp *logPluginProxy) Capabilities() (cap Capability, err error) {
-	var (
-		ret logPluginProxyCapabilitiesResponse
-	)
+	var ret logPluginProxyCapabilitiesResponse
 
 	if err = pp.Call("LogDriver.Capabilities", nil, &ret); err != nil {
 		return
@@ -97,9 +95,7 @@ type logPluginProxyReadLogsRequest struct {
 }
 
 func (pp *logPluginProxy) ReadLogs(info Info, config ReadConfig) (stream io.ReadCloser, err error) {
-	var (
-		req logPluginProxyReadLogsRequest
-	)
+	var req logPluginProxyReadLogsRequest
 
 	req.Info = info
 	req.Config = config