cmd/go-contrib-init: drop unneeded GOPATH checks in module mode
Fixes golang/go#72773
Change-Id: I72728446de0e7ddb01c2219523533e7f7f0cb910
Reviewed-on: https://go-review.googlesource.com/c/tools/+/656515
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
diff --git a/cmd/go-contrib-init/contrib.go b/cmd/go-contrib-init/contrib.go
index 9254b86..0ab93c9 100644
--- a/cmd/go-contrib-init/contrib.go
+++ b/cmd/go-contrib-init/contrib.go
@@ -160,44 +160,6 @@
}
return
}
-
- gopath := firstGoPath()
- if gopath == "" {
- log.Fatal("Your GOPATH is not set, please set it")
- }
-
- rightdir := filepath.Join(gopath, "src", "golang.org", "x", *repo)
- if !strings.HasPrefix(wd, rightdir) {
- dirExists, err := exists(rightdir)
- if err != nil {
- log.Fatal(err)
- }
- if !dirExists {
- log.Fatalf("The repo you want to work on is currently not on your system.\n"+
- "Run %q to obtain this repo\n"+
- "then go to the directory %q\n",
- "go get -d golang.org/x/"+*repo, rightdir)
- }
- log.Fatalf("Your current directory is:%q\n"+
- "Working on golang/x/%v requires you be in %q\n",
- wd, *repo, rightdir)
- }
-}
-
-func firstGoPath() string {
- list := filepath.SplitList(build.Default.GOPATH)
- if len(list) < 1 {
- return ""
- }
- return list[0]
-}
-
-func exists(path string) (bool, error) {
- _, err := os.Stat(path)
- if os.IsNotExist(err) {
- return false, nil
- }
- return true, err
}
func inGoPath(wd string) bool {