1
0
mirror of https://github.com/beego/bee.git synced 2025-06-26 19:10:19 +00:00

Only contents in "CompareExcept" are excluded during comparison

This commit is contained in:
wangle
2020-07-26 15:48:36 +08:00
committed by askuy
parent 174d2ab2e8
commit a9d3de0872
3 changed files with 35 additions and 19 deletions

View File

@ -130,7 +130,8 @@ func (r *RenderFile) Exec(name string) {
}
// Replace or create when content changes
output := []byte(buf)
if r.Option.EnableFormat && filepath.Ext(r.FlushFile) == ".go" {
ext := filepath.Ext(r.FlushFile)
if r.Option.EnableFormat && ext == ".go" {
// format code
var bts []byte
bts, err = format.Source([]byte(buf))
@ -141,7 +142,7 @@ func (r *RenderFile) Exec(name string) {
output = bts
}
if FileContentChange(orgContent,output) {
if FileContentChange(orgContent,output,GetSeg(ext)) {
err = r.write(r.FlushFile, output)
if err != nil {
beeLogger.Log.Fatalf("Could not create file: %s", err)