Skip to content

Commit 6308e83

Browse files
authored
Merge pull request #120 from jpeeler/fallback-default-gopath
Don't terminate if GOPATH env var is unset
2 parents 225cbc3 + f34f40f commit 6308e83

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmd/kubebuilder/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package main
1818

1919
import (
20+
gobuild "go/build"
2021
"log"
2122
"os"
2223
"path/filepath"
@@ -38,7 +39,7 @@ func main() {
3839
util.CheckInstall()
3940
gopath := os.Getenv("GOPATH")
4041
if len(gopath) == 0 {
41-
log.Fatal("GOPATH not defined")
42+
gopath = gobuild.Default.GOPATH
4243
}
4344
util.GoSrc = filepath.Join(gopath, "src")
4445

0 commit comments

Comments
 (0)