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

     1  
     2  cd a
     3  ! go build
     4  stderr '^ambiguous import: found package image in multiple modules:\s+image\s+.+\s.+image.+\s$'
     5  
     6  
     7  cd ../b
     8  ! go build -mod=vendor
     9  stderr '^main.go:4:5: ambiguous import: found package image in multiple directories:\s+.+image\s+.+image\s+$'
    10  
    11  cd ../c
    12  ! go build -mod=vendor
    13  stderr 'main.go:4:5: package p is not in std'
    14  
    15  -- a/go.mod --
    16  module image
    17  
    18  -- a/main.go --
    19  package main
    20  
    21  func main() {
    22      println("hello world!")
    23  }
    24  
    25  -- b/go.mod --
    26  module test
    27  
    28  -- b/vendor/image/b.go --
    29  package image
    30  func Add(a, b int) int {
    31      return a + b
    32  }
    33  
    34  -- b/main.go --
    35  package main
    36  
    37  import (
    38      "image"
    39  )
    40  
    41  func main() {
    42      println(image.Add(1,1))
    43  }
    44  
    45  -- c/go.mod --
    46  module test
    47  
    48  -- c/main.go --
    49  package main
    50  
    51  import (
    52      "p"
    53  )
    54  
    55  func main() {
    56      println(p.Add(1,1))
    57  }

View as plain text