Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/go/testdata/script

     1  # Imports
     2  env GO111MODULE=off
     3  go list -f  '{{.ImportPath}} {{.Imports}}' 'vend/...' 'vend/vendor/...' 'vend/x/vendor/...'
     4  cmp stdout want_vendor_imports.txt
     5  
     6  -- want_vendor_imports.txt --
     7  vend [vend/vendor/p r]
     8  vend/dir1 []
     9  vend/hello [fmt vend/vendor/strings]
    10  vend/subdir [vend/vendor/p r]
    11  vend/x [vend/x/vendor/p vend/vendor/q vend/x/vendor/r vend/dir1 vend/vendor/vend/dir1/dir2]
    12  vend/x/invalid [vend/x/invalid/vendor/foo]
    13  vend/vendor/p []
    14  vend/vendor/q []
    15  vend/vendor/strings []
    16  vend/vendor/vend/dir1/dir2 []
    17  vend/x/vendor/p []
    18  vend/x/vendor/p/p [notfound]
    19  vend/x/vendor/r []
    20  -- vend/bad.go --
    21  package vend
    22  
    23  import _ "r"
    24  -- vend/dir1/dir1.go --
    25  package dir1
    26  -- vend/good.go --
    27  package vend
    28  
    29  import _ "p"
    30  -- vend/hello/hello.go --
    31  package main
    32  
    33  import (
    34  	"fmt"
    35  	"strings" // really ../vendor/strings
    36  )
    37  
    38  func main() {
    39  	fmt.Printf("%s\n", strings.Msg)
    40  }
    41  -- vend/hello/hello_test.go --
    42  package main
    43  
    44  import (
    45  	"strings" // really ../vendor/strings
    46  	"testing"
    47  )
    48  
    49  func TestMsgInternal(t *testing.T) {
    50  	if strings.Msg != "hello, world" {
    51  		t.Fatalf("unexpected msg: %v", strings.Msg)
    52  	}
    53  }
    54  -- vend/hello/hellox_test.go --
    55  package main_test
    56  
    57  import (
    58  	"strings" // really ../vendor/strings
    59  	"testing"
    60  )
    61  
    62  func TestMsgExternal(t *testing.T) {
    63  	if strings.Msg != "hello, world" {
    64  		t.Fatalf("unexpected msg: %v", strings.Msg)
    65  	}
    66  }
    67  -- vend/subdir/bad.go --
    68  package subdir
    69  
    70  import _ "r"
    71  -- vend/subdir/good.go --
    72  package subdir
    73  
    74  import _ "p"
    75  -- vend/vendor/p/p.go --
    76  package p
    77  -- vend/vendor/q/q.go --
    78  package q
    79  -- vend/vendor/strings/msg.go --
    80  package strings
    81  
    82  var Msg = "hello, world"
    83  -- vend/vendor/vend/dir1/dir2/dir2.go --
    84  package dir2
    85  -- vend/x/invalid/invalid.go --
    86  package invalid
    87  
    88  import "vend/x/invalid/vendor/foo"
    89  -- vend/x/vendor/p/p/p.go --
    90  package p
    91  
    92  import _ "notfound"
    93  -- vend/x/vendor/p/p.go --
    94  package p
    95  -- vend/x/vendor/r/r.go --
    96  package r
    97  -- vend/x/x.go --
    98  package x
    99  
   100  import _ "p"
   101  import _ "q"
   102  import _ "r"
   103  import _ "vend/dir1"      // not vendored
   104  import _ "vend/dir1/dir2" // vendored
   105  

View as plain text