func export support

支持快捷函数导出。
This commit is contained in:
谢小军
2020-01-09 20:04:33 +08:00
parent 204164e8b9
commit 1ff17da96f
15 changed files with 932 additions and 44 deletions

View File

@@ -1,6 +1,9 @@
package gtools
import (
"fmt"
"os/exec"
"github.com/xxjwxc/gormt/data/view/model"
"github.com/xxjwxc/gormt/data/config"
@@ -28,12 +31,12 @@ func Execute() {
path := config.GetOutDir() + "/" + v.FileName
tools.WriteFile(path, []string{v.FileCtx}, true)
// fmt.Println("formatting differs from goimport's:")
// cmd, _ := exec.Command("goimports", "-l", "-w", path).Output()
// fmt.Println(string(cmd))
fmt.Println("formatting differs from goimport's:")
cmd, _ := exec.Command("goimports", "-l", "-w", path).Output()
fmt.Println(string(cmd))
// fmt.Println("formatting differs from gofmt's:")
// cmd, _ = exec.Command("gofmt", "-l", "-w", path).Output()
// fmt.Println(string(cmd))
fmt.Println("formatting differs from gofmt's:")
cmd, _ = exec.Command("gofmt", "-l", "-w", path).Output()
fmt.Println(string(cmd))
}
}