Merge pull request #103 from mingrammer/use-default-gopath
Supports using the default GOPATH
This commit is contained in:
commit
77ed5fdd3f
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"github.com/fatih/color"
|
||||
"github.com/tockins/interact"
|
||||
"go/build"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
"log"
|
||||
"os"
|
||||
|
@ -1137,10 +1138,13 @@ func before(*cli.Context) error {
|
|||
log.SetFlags(0)
|
||||
log.SetOutput(logWriter{})
|
||||
// Before of every exec of a cli method
|
||||
gopath := os.Getenv("GOPATH")
|
||||
gopath := build.Default.GOPATH
|
||||
if gopath == "" {
|
||||
return errors.New("$GOPATH isn't set properly")
|
||||
}
|
||||
if err := os.Setenv("GOPATH", gopath); err != nil {
|
||||
return err
|
||||
}
|
||||
// new realize instance
|
||||
r = new()
|
||||
// read if exist
|
||||
|
|
Loading…
Reference in New Issue