From df9c72155c5c0eac5eeb4fb2061dc4cbc049035d Mon Sep 17 00:00:00 2001 From: alessio Date: Wed, 26 Apr 2017 16:13:11 +0200 Subject: [PATCH 1/2] dep updated #52 fixed --- Gopkg.lock | 91 +++++++++++++++++++++++++++++++++ Gopkg.toml | 28 ++++++++++ lock.json | 138 -------------------------------------------------- manifest.json | 25 --------- 4 files changed, 119 insertions(+), 163 deletions(-) create mode 100644 Gopkg.lock create mode 100644 Gopkg.toml delete mode 100644 lock.json delete mode 100644 manifest.json diff --git a/Gopkg.lock b/Gopkg.lock new file mode 100644 index 0000000..ea471a9 --- /dev/null +++ b/Gopkg.lock @@ -0,0 +1,91 @@ +memo = "4f11729a341d710751e002460e3767a15151cb5aee2e11ba6f70409107016f15" + +[[projects]] + name = "github.com/dgrijalva/jwt-go" + packages = ["."] + revision = "d2709f9f1f31ebcda9651b03077758c1f3a0018c" + version = "v3.0.0" + +[[projects]] + name = "github.com/fatih/color" + packages = ["."] + revision = "9131ab34cf20d2f6d83fdc67168a5430d1c7dc23" + version = "v1.4.1" + +[[projects]] + branch = "master" + name = "github.com/fsnotify/fsnotify" + packages = ["."] + revision = "4da3e2cfbabc9f751898f250b49f2439785783a1" + +[[projects]] + branch = "master" + name = "github.com/labstack/echo" + packages = [".","middleware"] + revision = "4256489c0e1ff50bdb71aedd1a21483fe2d67607" + +[[projects]] + name = "github.com/labstack/gommon" + packages = ["bytes","color","log","random"] + revision = "9cedb429ffbe71a32a3ae7c65fd109cb7ae07804" + version = "v0.2.0" + +[[projects]] + name = "github.com/mattn/go-colorable" + packages = ["."] + revision = "d228849504861217f796da67fae4f6e347643f15" + version = "v0.0.7" + +[[projects]] + name = "github.com/mattn/go-isatty" + packages = ["."] + revision = "fc9e8d8ef48496124e79ae0df75490096eccf6fe" + version = "v0.0.2" + +[[projects]] + branch = "master" + name = "github.com/tockins/interact" + packages = ["."] + revision = "c424f9a549ee8ca6b36332a8cb4374701fff6ecb" + +[[projects]] + branch = "master" + name = "github.com/valyala/bytebufferpool" + packages = ["."] + revision = "e746df99fe4a3986f4d4f79e13c1e0117ce9c2f7" + +[[projects]] + branch = "master" + name = "github.com/valyala/fasttemplate" + packages = ["."] + revision = "dcecefd839c4193db0d35b88ec65b4c12d360ab0" + +[[projects]] + branch = "master" + name = "golang.org/x/crypto" + packages = ["acme","acme/autocert"] + revision = "c7af5bf2638a1164f2eb5467c39c6cffbd13a02e" + +[[projects]] + branch = "master" + name = "golang.org/x/net" + packages = ["websocket"] + revision = "da118f7b8e5954f39d0d2130ab35d4bf0e3cb344" + +[[projects]] + branch = "master" + name = "golang.org/x/sys" + packages = ["unix"] + revision = "9f30dcbe5be197894515a338a9bda9253567ea8f" + +[[projects]] + branch = "v2" + name = "gopkg.in/urfave/cli.v2" + packages = ["."] + revision = "61c3eb6ba1da1df17cd50f1456a9252d92bf5edd" + +[[projects]] + branch = "v2" + name = "gopkg.in/yaml.v2" + packages = ["."] + revision = "cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b" diff --git a/Gopkg.toml b/Gopkg.toml new file mode 100644 index 0000000..86a0a37 --- /dev/null +++ b/Gopkg.toml @@ -0,0 +1,28 @@ + +[[dependencies]] + branch = "master" + name = "github.com/fatih/color" + +[[dependencies]] + branch = "master" + name = "github.com/fsnotify/fsnotify" + +[[dependencies]] + branch = "master" + name = "github.com/labstack/echo" + +[[dependencies]] + branch = "master" + name = "github.com/tockins/interact" + +[[dependencies]] + branch = "master" + name = "golang.org/x/net" + +[[dependencies]] + branch = "v2" + name = "gopkg.in/urfave/cli.v2" + +[[dependencies]] + branch = "v2" + name = "gopkg.in/yaml.v2" diff --git a/lock.json b/lock.json deleted file mode 100644 index e5a03c0..0000000 --- a/lock.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "memo": "0dae7877c338a668c3b0b2c64112895cd2076b90c0792ca2a0edf22fb10d14d2", - "projects": [ - { - "name": "github.com/dgrijalva/jwt-go", - "version": "v3.0.0", - "revision": "d2709f9f1f31ebcda9651b03077758c1f3a0018c", - "packages": [ - "." - ] - }, - { - "name": "github.com/fatih/color", - "version": "v1.4.1", - "revision": "9131ab34cf20d2f6d83fdc67168a5430d1c7dc23", - "packages": [ - "." - ] - }, - { - "name": "github.com/fsnotify/fsnotify", - "branch": "master", - "revision": "4da3e2cfbabc9f751898f250b49f2439785783a1", - "packages": [ - "." - ] - }, - { - "name": "github.com/labstack/echo", - "version": "v3.0.3", - "revision": "8d504c1b699c757b267255c53b3e5219f9974abc", - "packages": [ - ".", - "middleware" - ] - }, - { - "name": "github.com/labstack/gommon", - "version": "v0.2.0", - "revision": "9cedb429ffbe71a32a3ae7c65fd109cb7ae07804", - "packages": [ - "bytes", - "color", - "log", - "random" - ] - }, - { - "name": "github.com/mattn/go-colorable", - "version": "v0.0.7", - "revision": "d228849504861217f796da67fae4f6e347643f15", - "packages": [ - "." - ] - }, - { - "name": "github.com/mattn/go-isatty", - "version": "v0.0.2", - "revision": "fc9e8d8ef48496124e79ae0df75490096eccf6fe", - "packages": [ - "." - ] - }, - { - "name": "github.com/tockins/interact", - "branch": "master", - "revision": "c424f9a549ee8ca6b36332a8cb4374701fff6ecb", - "packages": [ - "." - ] - }, - { - "name": "github.com/tylerb/graceful", - "version": "v1.2.15", - "revision": "4654dfbb6ad53cb5e27f37d99b02e16c1872fbbb", - "packages": [ - "." - ] - }, - { - "name": "github.com/valyala/bytebufferpool", - "branch": "master", - "revision": "e746df99fe4a3986f4d4f79e13c1e0117ce9c2f7", - "packages": [ - "." - ] - }, - { - "name": "github.com/valyala/fasttemplate", - "branch": "master", - "revision": "dcecefd839c4193db0d35b88ec65b4c12d360ab0", - "packages": [ - "." - ] - }, - { - "name": "golang.org/x/crypto", - "branch": "master", - "revision": "cbc3d0884eac986df6e78a039b8792e869bff863", - "packages": [ - "acme", - "acme/autocert" - ] - }, - { - "name": "golang.org/x/net", - "branch": "master", - "revision": "5602c733f70afc6dcec6766be0d5034d4c4f14de", - "packages": [ - "websocket" - ] - }, - { - "name": "golang.org/x/sys", - "branch": "master", - "revision": "f3918c30c5c2cb527c0b071a27c35120a6c0719a", - "packages": [ - "unix" - ] - }, - { - "name": "gopkg.in/urfave/cli.v2", - "branch": "v2", - "revision": "04b2f4ff79cf1fd71e138bafc67df8bbdb5b81c2", - "packages": [ - "." - ] - }, - { - "name": "gopkg.in/yaml.v2", - "branch": "v2", - "revision": "cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b", - "packages": [ - "." - ] - } - ] -} diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 8821db0..0000000 --- a/manifest.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "dependencies": { - "github.com/fatih/color": { - "branch": "master" - }, - "github.com/fsnotify/fsnotify": { - "branch": "master" - }, - "github.com/labstack/echo": { - "version": "^3.0.3" - }, - "github.com/tockins/interact": { - "branch": "master" - }, - "golang.org/x/net": { - "branch": "master" - }, - "gopkg.in/urfave/cli.v2": { - "branch": "v2" - }, - "gopkg.in/yaml.v2": { - "branch": "v2" - } - } -} From 979cb3da36b8cf6314d4a68326cb3c4e48db93eb Mon Sep 17 00:00:00 2001 From: Janis Meybohm Date: Mon, 19 Jun 2017 11:29:30 +0200 Subject: [PATCH 2/2] Support multiple values in GOPATH/GOBIN realize generates wrong GOBIN path in case one has multiple paths in GOPATH (like "/go/foo:/go"). --- watcher/exec.go | 10 +++++----- watcher/utils.go | 12 ++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/watcher/exec.go b/watcher/exec.go index 2797c88..21a2302 100644 --- a/watcher/exec.go +++ b/watcher/exec.go @@ -34,10 +34,10 @@ func (p *Project) goRun(channel chan bool, runner chan bool, wr *sync.WaitGroup) if path != "" { build = exec.Command(path, params...) } else { - if _, err := os.Stat(filepath.Join(os.Getenv("GOBIN"), filepath.Base(p.path))); err == nil { - build = exec.Command(filepath.Join(os.Getenv("GOBIN"), filepath.Base(p.path)), params...) - } else if _, err := os.Stat(filepath.Join(os.Getenv("GOBIN"), filepath.Base(p.path)) + ".exe"); err == nil { - build = exec.Command(filepath.Join(os.Getenv("GOBIN"), filepath.Base(p.path))+".exe", params...) + if _, err := os.Stat(filepath.Join(getEnvPath("GOBIN"), filepath.Base(p.path))); err == nil { + build = exec.Command(filepath.Join(getEnvPath("GOBIN"), filepath.Base(p.path)), params...) + } else if _, err := os.Stat(filepath.Join(getEnvPath("GOBIN"), filepath.Base(p.path)) + ".exe"); err == nil { + build = exec.Command(filepath.Join(getEnvPath("GOBIN"), filepath.Base(p.path))+".exe", params...) } else { p.Buffer.StdLog = append(p.Buffer.StdLog, BufferOut{Time: time.Now(), Text: "Can't run a not compiled project"}) p.Fatal(err, "Can't run a not compiled project", ":") @@ -116,7 +116,7 @@ func (p *Project) goBuild() (string, error) { func (p *Project) goInstall() (string, error) { var out bytes.Buffer var stderr bytes.Buffer - err := os.Setenv("GOBIN", filepath.Join(os.Getenv("GOPATH"), "bin")) + err := os.Setenv("GOBIN", filepath.Join(getEnvPath("GOPATH"), "bin")) if err != nil { return "", err } diff --git a/watcher/utils.go b/watcher/utils.go index 9535a2d..4509080 100644 --- a/watcher/utils.go +++ b/watcher/utils.go @@ -3,6 +3,8 @@ package watcher import ( "errors" "fmt" + "os" + "path/filepath" "time" "github.com/tockins/realize/style" @@ -46,3 +48,13 @@ func inArray(str string, list []string) bool { func (w logWriter) Write(bytes []byte) (int, error) { return fmt.Print(style.Yellow.Regular("[") + time.Now().Format("15:04:05") + style.Yellow.Regular("]") + string(bytes)) } + +// getEnvPath returns the first path found in env or empty string +func getEnvPath(env string) string { + path := filepath.SplitList(os.Getenv(env)) + if len(path) == 0 { + return "" + } else { + return path[0] + } +}