Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/go/testdata/script

     1  env GO111MODULE=on
     2  
     3  [short] skip
     4  
     5  # get should add modules needed to build packages, even if those
     6  # dependencies are in sources excluded by build tags.
     7  # All build tags are considered true except "ignore".
     8  go mod init m
     9  go get -d .
    10  go list -m all
    11  stdout 'example.com/version v1.1.0'
    12  stdout 'rsc.io/quote v1.5.2'
    13  
    14  [short] skip
    15  
    16  # Packages that are only imported in excluded files should not be built.
    17  env GOCACHE=$WORK/gocache  # Looking for compile commands, so need a clean cache.
    18  go get -n -x .
    19  stderr 'compile.* -p m '
    20  ! stderr 'compile.* -p example.com/version '
    21  ! stderr 'compile.* -p rsc.io/quote '
    22  
    23  -- empty.go --
    24  package m
    25  
    26  -- excluded.go --
    27  // +build windows,mips
    28  
    29  package m
    30  
    31  import _ "example.com/version"
    32  
    33  -- tools.go --
    34  // +build tools
    35  
    36  package tools
    37  
    38  import _ "rsc.io/quote"
    39  
    40  -- ignore.go --
    41  // +build ignore
    42  
    43  package ignore
    44  
    45  import _ "example.com/doesnotexist"
    46  

View as plain text