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

     1  # Test that mod=vendor is disabled in workspace mode, even
     2  # with a single workspace module.
     3  
     4  cd workspace
     5  
     6  # Base case: ensure the module would default to mod=vendor
     7  # outside of workspace mode.
     8  env GOWORK=off
     9  go list -f '{{.Dir}}' example.com/dep
    10  stdout $GOPATH[\\/]src[\\/]workspace[\\/]vendor[\\/]example.com[\\/]dep
    11  
    12  # Test case: endure the module does not enter mod=vendor outside
    13  # worspace mode.
    14  env GOWORK=''
    15  go list -f '{{.Dir}}' example.com/dep
    16  stdout $GOPATH[\\/]src[\\/]dep
    17  
    18  -- workspace/go.work --
    19  use .
    20  replace example.com/dep => ../dep
    21  -- workspace/main.go --
    22  package main
    23  
    24  import "example.com/dep"
    25  
    26  func main() {
    27  	dep.Dep()
    28  }
    29  -- workspace/go.mod --
    30  module example.com/mod
    31  
    32  go 1.20
    33  
    34  require example.com/dep v1.0.0
    35  -- workspace/vendor/example.com/dep/dep.go --
    36  package dep
    37  
    38  import "fmt"
    39  
    40  func Dep() {
    41  	fmt.Println("the vendored dep")
    42  }
    43  -- workspace/vendor/modules.txt --
    44  # example.com/dep v1.0.0
    45  ## explicit
    46  example.com/dep
    47  -- dep/go.mod --
    48  module example.com/dep
    49  -- dep/dep.go --
    50  package dep
    51  
    52  import "fmt"
    53  
    54  func Dep () {
    55      fmt.Println("the real dep")
    56  }
    57  

View as plain text