瀏覽代碼

daemon/logger/jsonfilelog: 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 年之前
父節點
當前提交
bb5a1eb99d
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 2 2
      daemon/logger/jsonfilelog/jsonfilelog.go
  2. 1 1
      daemon/logger/jsonfilelog/jsonlog/jsonlogbytes.go

+ 2 - 2
daemon/logger/jsonfilelog/jsonfilelog.go

@@ -57,7 +57,7 @@ func New(info logger.Info) (logger.Logger, error) {
 			return nil, fmt.Errorf("max-size must be a positive number")
 			return nil, fmt.Errorf("max-size must be a positive number")
 		}
 		}
 	}
 	}
-	var maxFiles = 1
+	maxFiles := 1
 	if maxFileString, ok := info.Config["max-file"]; ok {
 	if maxFileString, ok := info.Config["max-file"]; ok {
 		var err error
 		var err error
 		maxFiles, err = strconv.Atoi(maxFileString)
 		maxFiles, err = strconv.Atoi(maxFileString)
@@ -104,7 +104,7 @@ func New(info logger.Info) (logger.Logger, error) {
 		}
 		}
 	}
 	}
 
 
-	writer, err := loggerutils.NewLogFile(info.LogPath, capval, maxFiles, compress, decodeFunc, 0640, getTailReader)
+	writer, err := loggerutils.NewLogFile(info.LogPath, capval, maxFiles, compress, decodeFunc, 0o640, getTailReader)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}

+ 1 - 1
daemon/logger/jsonfilelog/jsonlog/jsonlogbytes.go

@@ -20,7 +20,7 @@ type JSONLogs struct {
 // MarshalJSONBuf is an optimized JSON marshaller that avoids reflection
 // MarshalJSONBuf is an optimized JSON marshaller that avoids reflection
 // and unnecessary allocation.
 // and unnecessary allocation.
 func (mj *JSONLogs) MarshalJSONBuf(buf *bytes.Buffer) error {
 func (mj *JSONLogs) MarshalJSONBuf(buf *bytes.Buffer) error {
-	var first = true
+	first := true
 
 
 	buf.WriteString(`{`)
 	buf.WriteString(`{`)
 	if len(mj.Log) != 0 {
 	if len(mj.Log) != 0 {