1
0
mirror of https://github.com/beego/bee.git synced 2024-11-05 06:50:53 +00:00

Formatting code

This commit is contained in:
wangle 2020-07-27 23:39:01 +08:00
parent 877c2b2b80
commit 147e776afb
3 changed files with 4 additions and 6 deletions

View File

@ -1,7 +1,6 @@
package beegopro
import (
"errors"
"github.com/beego/bee/internal/pkg/system"
beeLogger "github.com/beego/bee/logger"
"github.com/davecgh/go-spew/spew"
@ -136,8 +135,7 @@ func (r *RenderFile) Exec(name string) {
var bts []byte
bts, err = format.Source([]byte(buf))
if err != nil {
err = errors.New("format buf error " + err.Error())
return
beeLogger.Log.Warnf("format buf error %s", err.Error())
}
output = bts
}

View File

@ -58,12 +58,12 @@ func (c *RenderFile) write(filename string, buf []byte) (err error) {
return
}
output := []byte(buf)
var output []byte
if c.Option.EnableFormat && filepath.Ext(filename) == ".go" {
// format code
var bts []byte
bts, err = format.Source([]byte(buf))
bts, err = format.Source(buf)
if err != nil {
err = errors.New("format buf error " + err.Error())
return

View File

@ -522,7 +522,7 @@ func goGetBee() {
select {
case <-done:
return
case <-time.After(time.Duration(30 * time.Second)):
case <-time.After(time.Second * 30):
beeLogger.Log.Warn("Update Bee timeout!!!")
}
}