1
0
mirror of https://github.com/beego/bee.git synced 2025-07-20 23:45:33 +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

@@ -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