...

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

Documentation: cmd/go/testdata/script

     1# Test 'go get' with a local module with a name that is not valid for network lookup.
     2[short] skip
     3
     4env GO111MODULE=on
     5go mod edit -fmt
     6cp go.mod go.mod.orig
     7
     8# 'go get -u' within the main module should work, even if it has a local-only name.
     9cp go.mod.orig go.mod
    10go get -u ./...
    11grep 'rsc.io/quote.*v1.5.2' go.mod
    12grep 'golang.org/x/text.*v0.3.0' go.mod
    13cp go.mod go.mod.implicitmod
    14
    15# 'go get -u local/...' should be equivalent to 'go get -u ./...'
    16# (assuming no nested modules)
    17cp go.mod.orig go.mod
    18go get -u local/...
    19cmp go.mod go.mod.implicitmod
    20
    21# For the main module, @patch should be a no-op.
    22cp go.mod.orig go.mod
    23go get -u local/...@patch
    24cmp go.mod go.mod.implicitmod
    25
    26# 'go get -u' in the empty root of the main module should fail.
    27# 'go get -u .' should also fail.
    28cp go.mod.orig go.mod
    29! go get -u
    30! go get -u .
    31
    32# 'go get -u .' within a package in the main module updates the dependencies
    33# of that package.
    34cp go.mod.orig go.mod
    35cd uselang
    36go get -u .
    37cd ..
    38grep 'rsc.io/quote.*v1.3.0' go.mod
    39grep 'golang.org/x/text.*v0.3.0' go.mod
    40cp go.mod go.mod.dotpkg
    41
    42# 'go get -u' with an explicit package in the main module updates the
    43# dependencies of that package.
    44cp go.mod.orig go.mod
    45go get -u local/uselang
    46cmp go.mod go.mod.dotpkg
    47
    48-- go.mod --
    49module local
    50
    51require (
    52	golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c
    53	rsc.io/quote v1.3.0
    54)
    55
    56-- uselang/uselang.go --
    57package uselang
    58import _ "golang.org/x/text/language"
    59
    60-- usequote/usequote.go --
    61package usequote
    62import _ "rsc.io/quote"

View as plain text