]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/go/internal/modload/init.go
cmd/go/internal/modload: ignore $GOPATH/go.mod
[gostls13.git] / src / cmd / go / internal / modload / init.go
index b9d9d2e55278fbe80015f8f1a55fd635a2d44e41..f4f4a68254b1663a3b3743eac90ecbb3bad16a6f 100644 (file)
@@ -485,7 +485,13 @@ func Init() {
        if len(list) > 0 && list[0] != "" {
                gopath = list[0]
                if _, err := fsys.Stat(filepath.Join(gopath, "go.mod")); err == nil {
-                       base.Fatalf("$GOPATH/go.mod exists but should not")
+                       fmt.Fprintf(os.Stderr, "go: warning: ignoring go.mod in $GOPATH %v\n", gopath)
+                       if RootMode == NeedRoot {
+                               base.Fatal(ErrNoModRoot)
+                       }
+                       if !mustUseModules {
+                               return
+                       }
                }
        }
 }