...

Text file src/cmd/go/testdata/script/work_reject_modfile.txt

Documentation: cmd/go/testdata/script

     1# Test that -modfile=path/to/go.mod is rejected in workspace mode.
     2
     3! go list -m -modfile=./a/go.alt.mod
     4stderr 'go: -modfile cannot be used in workspace mode'
     5
     6env GOFLAGS=-modfile=./a/go.alt.mod
     7! go list -m
     8stderr 'go: -modfile cannot be used in workspace mode'
     9
    10-- go.work --
    11go 1.20
    12
    13use (
    14    ./a
    15)
    16
    17-- a/go.mod --
    18module example.com/foo
    19
    20go 1.20
    21
    22-- a/go.alt.mod --
    23module example.com/foo
    24
    25go 1.20
    26
    27-- a/main.go --
    28package main
    29
    30import "fmt"
    31
    32func main() {
    33	fmt.Println("Hello world!")
    34}

View as plain text