...

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

Documentation: cmd/go/testdata/script

     1# test go get -tool
     2go get -tool example.com/tools/cmd/hello@v1.0.0
     3cmp go.mod go.mod.want
     4
     5go get -u tool
     6cmp go.mod go.mod.upgraded
     7
     8# test -tool with @none
     9go get -tool example.com/tools/cmd/hello@none
    10cmp go.mod go.mod.gone
    11
    12go mod tidy
    13cmp go.mod go.mod.empty
    14
    15# test -tool with wildcards
    16go get -tool ./cmd/...
    17cmp go.mod go.mod.wildcard
    18! go get -tool ./cmd/...@none
    19stderr 'can''t request explicit version "none" of path "./cmd/..." in main module'
    20
    21# test -tool with all
    22! go get -tool all
    23stderr 'go get -tool does not work with "all"'
    24
    25# test tool@none
    26! go get tool@none
    27stderr 'can''t request explicit version of "tool" pattern'
    28
    29-- main.go --
    30package main
    31
    32func main() {}
    33
    34-- go.mod --
    35module example.com/foo
    36go 1.24
    37
    38-- go.mod.want --
    39module example.com/foo
    40
    41go 1.24
    42
    43tool example.com/tools/cmd/hello
    44
    45require example.com/tools v1.0.0 // indirect
    46-- go.mod.upgraded --
    47module example.com/foo
    48
    49go 1.24
    50
    51tool example.com/tools/cmd/hello
    52
    53require example.com/tools v1.1.0 // indirect
    54-- go.mod.gone --
    55module example.com/foo
    56
    57go 1.24
    58
    59require example.com/tools v1.1.0 // indirect
    60-- go.mod.empty --
    61module example.com/foo
    62
    63go 1.24
    64-- go.mod.wildcard --
    65module example.com/foo
    66
    67go 1.24
    68
    69tool (
    70	example.com/foo/cmd/a
    71	example.com/foo/cmd/b
    72)
    73-- cmd/a/a.go --
    74package a
    75
    76func main() {}
    77
    78-- cmd/b/b.go --
    79package b
    80
    81func main() {}

View as plain text