...

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

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2
     3# tidy removes unused y, but everything else is used
     4go mod tidy -v
     5stderr '^unused y.1'
     6! stderr '^unused [^y]'
     7
     8grep 'go 1.10' go.mod
     9
    10go list -m all
    11! stdout '^y'
    12stdout '^w.1 v1.2.0'
    13stdout '^z.1 v1.2.0'
    14
    15# empty tidy should not crash
    16cd triv
    17! grep 'go ' go.mod
    18go mod tidy
    19
    20# tidy should add missing go line
    21grep 'go ' go.mod
    22
    23-- go.mod --
    24module m
    25
    26go 1.10
    27
    28require (
    29	x.1 v1.0.0
    30	y.1 v1.0.0
    31	w.1 v1.2.0
    32)
    33
    34replace x.1 v1.0.0 => ./x
    35replace y.1 v1.0.0 => ./y
    36replace z.1 v1.1.0 => ./z
    37replace z.1 v1.2.0 => ./z
    38replace w.1 => ./w
    39
    40-- m.go --
    41package m
    42
    43import _ "x.1"
    44import _ "z.1/sub"
    45
    46-- w/go.mod --
    47module w
    48
    49-- w/w.go --
    50package w
    51
    52-- x/go.mod --
    53module x
    54require w.1 v1.1.0
    55require z.1 v1.1.0
    56
    57-- x/x.go --
    58package x
    59import _ "w.1"
    60
    61-- y/go.mod --
    62module y
    63require z.1 v1.2.0
    64
    65-- z/go.mod --
    66module z
    67
    68-- z/sub/sub.go --
    69package sub
    70
    71-- triv/go.mod --
    72module triv

View as plain text