mirror of https://github.com/golang/go.git
Moved module env var check to modcmd from modinit
This commit is contained in:
parent
226e846627
commit
ada1aba2cb
|
|
@ -35,6 +35,9 @@ func runInit(cmd *base.Command, args []string) {
|
|||
if len(args) == 1 {
|
||||
modload.CmdModModule = args[0]
|
||||
}
|
||||
if os.Getenv("GO111MODULE") == "off" {
|
||||
base.Fatalf("go mod init: modules disabled by GO111MODULE=off; see 'go help modules'")
|
||||
}
|
||||
if _, err := os.Stat("go.mod"); err == nil {
|
||||
base.Fatalf("go mod init: go.mod already exists")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,8 @@ func Init() {
|
|||
case "on", "":
|
||||
mustUseModules = true
|
||||
case "off":
|
||||
die()
|
||||
mustUseModules = false
|
||||
return
|
||||
}
|
||||
|
||||
// Disable any prompting for passwords by Git.
|
||||
|
|
|
|||
Loading…
Reference in New Issue