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

     1  env GO111MODULE=off
     2  env GOPATH=$WORK/gopath/src/shadow/root1${:}$WORK/gopath/src/shadow/root2
     3  
     4  # The math in root1 is not "math" because the standard math is.
     5  go list -f '({{.ImportPath}}) ({{.ConflictDir}})' ./shadow/root1/src/math
     6  stdout '^\(.*(\\|/)src(\\|/)shadow(\\|/)root1(\\|/)src(\\|/)math\) \('$GOROOT'(\\|/)?src(\\|/)math\)$'
     7  
     8  # The foo in root1 is "foo".
     9  go list -f '({{.ImportPath}}) ({{.ConflictDir}})' ./shadow/root1/src/foo
    10  stdout '^\(foo\) \(\)$'
    11  
    12  # The foo in root2 is not "foo" because the foo in root1 got there first.
    13  go list -f '({{.ImportPath}}) ({{.ConflictDir}})' ./shadow/root2/src/foo
    14  stdout '^\(.*gopath(\\|/)src(\\|/)shadow(\\|/)root2(\\|/)src(\\|/)foo\) \('$WORK'(\\|/)?gopath(\\|/)src(\\|/)shadow(\\|/)root1(\\|/)src(\\|/)foo\)$'
    15  
    16  # The error for go install should mention the conflicting directory.
    17  ! go install -n ./shadow/root2/src/foo
    18  stderr 'go: no install location for '$WORK'(\\|/)?gopath(\\|/)src(\\|/)shadow(\\|/)root2(\\|/)src(\\|/)foo: hidden by '$WORK'(\\|/)?gopath(\\|/)src(\\|/)shadow(\\|/)root1(\\|/)src(\\|/)foo'
    19  
    20  -- shadow/root1/src/foo/foo.go --
    21  package foo
    22  -- shadow/root1/src/math/math.go --
    23  package math
    24  -- shadow/root2/src/foo/foo.go --
    25  package foo

View as plain text