diff options
Diffstat (limited to 'src/cmd/go/testdata/script/work_reject_modfile.txt')
-rw-r--r-- | src/cmd/go/testdata/script/work_reject_modfile.txt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/cmd/go/testdata/script/work_reject_modfile.txt b/src/cmd/go/testdata/script/work_reject_modfile.txt new file mode 100644 index 0000000..f0cfa3b --- /dev/null +++ b/src/cmd/go/testdata/script/work_reject_modfile.txt @@ -0,0 +1,34 @@ +# Test that -modfile=path/to/go.mod is rejected in workspace mode. + +! go list -m -modfile=./a/go.alt.mod +stderr 'go: -modfile cannot be used in workspace mode' + +env GOFLAGS=-modfile=./a/go.alt.mod +! go list -m +stderr 'go: -modfile cannot be used in workspace mode' + +-- go.work -- +go 1.20 + +use ( + ./a +) + +-- a/go.mod -- +module example.com/foo + +go 1.20 + +-- a/go.alt.mod -- +module example.com/foo + +go 1.20 + +-- a/main.go -- +package main + +import "fmt" + +func main() { + fmt.Println("Hello world!") +} |