From 95fded2840ca214673265ef833817554a1bc605b Mon Sep 17 00:00:00 2001 From: qiantao Date: Wed, 6 Mar 2019 09:58:33 +0800 Subject: [PATCH] fix: fix build faild with code check! --- cmd/commands/dlv/dlv_amd64.go | 2 +- cmd/commands/pack/pack.go | 2 +- cmd/commands/run/watch.go | 2 +- generate/swaggergen/g_docs.go | 2 +- utils/utils.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/commands/dlv/dlv_amd64.go b/cmd/commands/dlv/dlv_amd64.go index 9879fc3..7466ba6 100644 --- a/cmd/commands/dlv/dlv_amd64.go +++ b/cmd/commands/dlv/dlv_amd64.go @@ -228,7 +228,7 @@ func startWatcher(paths []string, ch chan int) { // Wait 1s before re-build until there is no file change scheduleTime := time.Now().Add(1 * time.Second) - time.Sleep(scheduleTime.Sub(time.Now())) + time.Sleep(time.Until(scheduleTime)) _, err := buildDebug() if err != nil { utils.Notify("Build Failed: "+err.Error(), "bee") diff --git a/cmd/commands/pack/pack.go b/cmd/commands/pack/pack.go index 4ad9bf9..4adc978 100644 --- a/cmd/commands/pack/pack.go +++ b/cmd/commands/pack/pack.go @@ -511,7 +511,7 @@ func packApp(cmd *commands.Command, args []string) int { fmt.Fprintf(output, "\t%s%s+ go %s%s%s\n", "\x1b[32m", "\x1b[1m", strings.Join(args, " "), "\x1b[21m", "\x1b[0m") } - execmd := exec.Command(string(cmdName), args...) + execmd := exec.Command(cmdName, args...) execmd.Env = append(os.Environ(), envs...) execmd.Stdout = os.Stdout execmd.Stderr = os.Stderr diff --git a/cmd/commands/run/watch.go b/cmd/commands/run/watch.go index 09f9fec..b9b9e74 100644 --- a/cmd/commands/run/watch.go +++ b/cmd/commands/run/watch.go @@ -85,7 +85,7 @@ func NewWatcher(paths []string, files []string, isgenerate bool) { go func() { // Wait 1s before autobuild until there is no file change. scheduleTime = time.Now().Add(1 * time.Second) - time.Sleep(scheduleTime.Sub(time.Now())) + time.Sleep(time.Until(scheduleTime)) AutoBuild(files, isgenerate) if config.Conf.EnableReload { diff --git a/generate/swaggergen/g_docs.go b/generate/swaggergen/g_docs.go index 351a289..9d77b62 100644 --- a/generate/swaggergen/g_docs.go +++ b/generate/swaggergen/g_docs.go @@ -116,7 +116,7 @@ func ParsePackagesFromDir(dirpath string) { err = parsePackageFromDir(fpath) if err != nil { // Send the error to through the channel and continue walking - c <- fmt.Errorf("Error while parsing directory: %s", err.Error()) + c <- fmt.Errorf("error while parsing directory: %s", err.Error()) return nil } } diff --git a/utils/utils.go b/utils/utils.go index 13e50b1..75b6898 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -328,7 +328,7 @@ func CheckEnv(appname string) (apppath, packpath string, err error) { apppath = filepath.Join(gosrcpath, appname) if _, e := os.Stat(apppath); !os.IsNotExist(e) { - err = fmt.Errorf("Cannot create application without removing '%s' first", apppath) + err = fmt.Errorf("cannot create application without removing '%s' first", apppath) beeLogger.Log.Errorf("Path '%s' already exists", apppath) return }