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

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

View as plain text