Skip to content

Commit bf70295

Browse files
committed
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>
1 parent 381d68d commit bf70295

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

cmd/go-contrib-init/contrib.go

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -160,44 +160,6 @@ GOPATH: %s
160160
}
161161
return
162162
}
163-
164-
gopath := firstGoPath()
165-
if gopath == "" {
166-
log.Fatal("Your GOPATH is not set, please set it")
167-
}
168-
169-
rightdir := filepath.Join(gopath, "src", "golang.org", "x", *repo)
170-
if !strings.HasPrefix(wd, rightdir) {
171-
dirExists, err := exists(rightdir)
172-
if err != nil {
173-
log.Fatal(err)
174-
}
175-
if !dirExists {
176-
log.Fatalf("The repo you want to work on is currently not on your system.\n"+
177-
"Run %q to obtain this repo\n"+
178-
"then go to the directory %q\n",
179-
"go get -d golang.org/x/"+*repo, rightdir)
180-
}
181-
log.Fatalf("Your current directory is:%q\n"+
182-
"Working on golang/x/%v requires you be in %q\n",
183-
wd, *repo, rightdir)
184-
}
185-
}
186-
187-
func firstGoPath() string {
188-
list := filepath.SplitList(build.Default.GOPATH)
189-
if len(list) < 1 {
190-
return ""
191-
}
192-
return list[0]
193-
}
194-
195-
func exists(path string) (bool, error) {
196-
_, err := os.Stat(path)
197-
if os.IsNotExist(err) {
198-
return false, nil
199-
}
200-
return true, err
201163
}
202164

203165
func inGoPath(wd string) bool {

0 commit comments

Comments
 (0)