cmd/go/internal/vgo: report failure when $GOPATH/go.mod exists

Fixes golang/go#24106.

Change-Id: I00c223ae9208577a1dff6a2b6ba250315fd602a7
Reviewed-on: https://go-review.googlesource.com/108379
Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/vendor/cmd/go/internal/vgo/init.go b/vendor/cmd/go/internal/vgo/init.go
index 269e425..4a9b5bf 100644
--- a/vendor/cmd/go/internal/vgo/init.go
+++ b/vendor/cmd/go/internal/vgo/init.go
@@ -113,6 +113,9 @@
 		base.Fatalf("missing $GOPATH")
 	}
 	gopath = list[0]
+	if _, err := os.Stat(filepath.Join(gopath, "go.mod")); err == nil {
+		base.Fatalf("$GOPATH/go.mod exists but should not")
+	}
 	srcV = filepath.Join(list[0], "src/v")
 	codehost.WorkRoot = filepath.Join(srcV, "cache/vcswork")