]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/modload: suppress the 'go mod init' hint for GOROOT more aggressively
authorBryan C. Mills <bcmills@google.com>
Fri, 13 Mar 2020 16:51:09 +0000 (12:51 -0400)
committerBryan C. Mills <bcmills@google.com>
Fri, 13 Mar 2020 20:43:12 +0000 (20:43 +0000)
commite2a9ea035d73df84c813132417366e8e01777c8d
treeb2f29eb2711acb3943babd23ce67c861e9293d2a
parentcbcb031fe8b26be9d40c5fbb0c1934b0afdcf422
cmd/go/internal/modload: suppress the 'go mod init' hint for GOROOT more aggressively

Previously, we suppressed a `to create a module there, run: … go mod
init' warning only if the config file itself (such as .git/config) was
found in GOROOT. However, our release tarballs don't include the
.git/config, so that case was not encountered, and the warning could
occur based on a config file found in some parent directory (outside
of GOROOT entirely).

Instead, skip the directory walk completely if the working directory
is anywhere in GOROOT.

Fixes #34191

Change-Id: I9f774901bfbb53b700407c4882f37d6339d023fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/223340
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/modload/init.go
src/cmd/go/testdata/script/mod_convert_git.txt