Skip to content

Commit

Permalink
Don't terminate if GOPATH env var is unset
Browse files Browse the repository at this point in the history
From version 1.8 onwards a default GOPATH is assumed, so use that if one
isn't explicitly set.
  • Loading branch information
jpeeler committed May 2, 2018
1 parent 2d1d976 commit f34f40f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/kubebuilder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package main

import (
gobuild "go/build"
"log"
"os"
"path/filepath"
Expand All @@ -38,7 +39,7 @@ func main() {
util.CheckInstall()
gopath := os.Getenv("GOPATH")
if len(gopath) == 0 {
log.Fatal("GOPATH not defined")
gopath = gobuild.Default.GOPATH
}
util.GoSrc = filepath.Join(gopath, "src")

Expand Down

0 comments on commit f34f40f

Please sign in to comment.