Enable go install by default to reduce build time without gopm.

This commit is contained in:
Sergey Lanzman 2016-12-12 22:30:50 +02:00
parent 2ff99d4ea7
commit aa195ecd46
2 changed files with 9 additions and 2 deletions

View File

@ -33,7 +33,7 @@ var defaultConf = `{
"enable": false,
"install": false
},
"go_install": false,
"go_install": true,
"watch_ext": [],
"dir_structure": {
"watch_all": false,

View File

@ -132,7 +132,14 @@ func AutoBuild(files []string, isgenerate bool) {
var err error
// For applications use full import path like "github.com/.../.."
// are able to use "go install" to reduce build time.
if conf.GoInstall || conf.Gopm.Install {
if conf.GoInstall {
icmd := exec.Command(cmdName, "install", "-v")
icmd.Stdout = os.Stdout
icmd.Stderr = os.Stderr
icmd.Env = append(os.Environ(), "GOGC=off")
icmd.Run()
}
if conf.Gopm.Install {
icmd := exec.Command("go", "list", "./...")
buf := bytes.NewBuffer([]byte(""))
icmd.Stdout = buf