Skip to content

Commit f34f40f

Browse files
author
Jeff Peeler
committed
Don't terminate if GOPATH env var is unset
From version 1.8 onwards a default GOPATH is assumed, so use that if one isn't explicitly set.
1 parent 2d1d976 commit f34f40f

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)