@@ -11,10 +11,10 @@ import (
|
||||
// GoBin returns a path of GOBIN.
|
||||
func GoBin() string {
|
||||
def := build.Default
|
||||
goroot := os.Getenv("GOROOT")
|
||||
goroot := os.Getenv("GOPATH")
|
||||
bin := filepath.Join(goroot, "bin")
|
||||
if !pathx.FileExists(bin) {
|
||||
gopath := os.Getenv("GOPATH")
|
||||
gopath := os.Getenv("GOROOT")
|
||||
bin = filepath.Join(gopath, "bin")
|
||||
}
|
||||
if !pathx.FileExists(bin) {
|
||||
|
||||
@@ -23,8 +23,11 @@ func Install(cacheDir string) (string, error) {
|
||||
}
|
||||
|
||||
func Exists() bool {
|
||||
_, err := env.LookUpProtocGenGo()
|
||||
return err == nil
|
||||
ver, err := Version()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return len(ver) > 0
|
||||
}
|
||||
|
||||
// Version is used to get the version of the protoc-gen-go plugin. For older versions, protoc-gen-go does not support
|
||||
|
||||
Reference in New Issue
Block a user