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

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

View as plain text