Skip to content

Commit 7fafbe6

Browse files
committed
improve gopath resolution
1 parent 617ad7f commit 7fafbe6

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/build
33
.idea/
44
*.ovpn
5+
**/testdataoutput/*

ci/util/cmd.go

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package util
22

33
import (
4+
"go/build"
45
"os"
56
"path"
67

@@ -14,6 +15,9 @@ func GetGoBinaryPath(binaryName string) (string, error) {
1415
return res, nil
1516
}
1617
gopath := os.Getenv("GOPATH")
18+
if gopath == "" {
19+
gopath = build.Default.GOPATH
20+
}
1721
binaryUnderGopath := path.Join(gopath, "bin", binaryName)
1822
if _, err := os.Stat(binaryUnderGopath); os.IsNotExist(err) {
1923
return "", err

0 commit comments

Comments
 (0)