From 87ba3f3cd3e0890af254676b40087bca1f8ebece Mon Sep 17 00:00:00 2001 From: ia Date: Sun, 17 Jun 2018 00:47:51 +0200 Subject: [PATCH] all: gofmt Run standard gofmt command on project root. - go version go1.10.3 darwin/amd64 Signed-off-by: ia --- app.go | 4 ++-- httplib/httplib.go | 2 ++ logs/accesslog.go | 4 ++-- logs/logger.go | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app.go b/app.go index 0c07117a..04fac65e 100644 --- a/app.go +++ b/app.go @@ -24,8 +24,8 @@ import ( "net/http/fcgi" "os" "path" - "time" "strings" + "time" "github.com/astaxie/beego/grace" "github.com/astaxie/beego/logs" @@ -101,7 +101,7 @@ func (app *App) Run(mws ...MiddleWare) { } app.Server.Handler = app.Handlers - for i:=len(mws)-1;i>=0;i-- { + for i := len(mws) - 1; i >= 0; i-- { if mws[i] == nil { continue } diff --git a/httplib/httplib.go b/httplib/httplib.go index 5d82ab33..8a9bbea7 100644 --- a/httplib/httplib.go +++ b/httplib/httplib.go @@ -317,6 +317,7 @@ func (b *BeegoHTTPRequest) Body(data interface{}) *BeegoHTTPRequest { } return b } + // XMLBody adds request raw body encoding by XML. func (b *BeegoHTTPRequest) XMLBody(obj interface{}) (*BeegoHTTPRequest, error) { if b.req.Body == nil && obj != nil { @@ -330,6 +331,7 @@ func (b *BeegoHTTPRequest) XMLBody(obj interface{}) (*BeegoHTTPRequest, error) { } return b, nil } + // JSONBody adds request raw body encoding by JSON. func (b *BeegoHTTPRequest) JSONBody(obj interface{}) (*BeegoHTTPRequest, error) { if b.req.Body == nil && obj != nil { diff --git a/logs/accesslog.go b/logs/accesslog.go index cf799dc1..08c64280 100644 --- a/logs/accesslog.go +++ b/logs/accesslog.go @@ -17,8 +17,8 @@ package logs import ( "bytes" "encoding/json" - "time" "fmt" + "time" ) const ( @@ -55,7 +55,7 @@ func (r *AccessLogRecord) json() ([]byte, error) { func disableEscapeHTML(i interface{}) { e, ok := i.(interface { SetEscapeHTML(bool) - }); + }) if ok { e.SetEscapeHTML(false) } diff --git a/logs/logger.go b/logs/logger.go index 1700901f..6c2dd3f9 100644 --- a/logs/logger.go +++ b/logs/logger.go @@ -93,7 +93,7 @@ const ( func formatTimeHeader(when time.Time) ([]byte, int) { y, mo, d := when.Date() h, mi, s := when.Clock() - ns := when.Nanosecond()/1000000 + ns := when.Nanosecond() / 1000000 //len("2006/01/02 15:04:05.123 ")==24 var buf [24]byte