Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/go/testdata/script

     1  # go list should succeed to load a package ending with ".go" if the path does
     2  # not correspond to an existing local file. Listing a pattern ending with
     3  # ".go/" should try to list a package regardless of whether a file exists at the
     4  # path without the suffixed "/" or not.
     5  go list example.com/dotgo.go
     6  stdout ^example.com/dotgo.go$
     7  go list example.com/dotgo.go/
     8  stdout ^example.com/dotgo.go$
     9  
    10  # go get -d should succeed in either case, with or without a version.
    11  # Arguments are interpreted as packages or package patterns with versions,
    12  # not source files.
    13  go get -d example.com/dotgo.go
    14  go get -d example.com/dotgo.go/
    15  go get -d example.com/dotgo.go@v1.0.0
    16  go get -d example.com/dotgo.go/@v1.0.0
    17  
    18  # go get (without -d) should also succeed in either case.
    19  [short] skip
    20  go get example.com/dotgo.go
    21  go get example.com/dotgo.go/
    22  go get example.com/dotgo.go@v1.0.0
    23  go get example.com/dotgo.go/@v1.0.0
    24  
    25  -- go.mod --
    26  module m
    27  
    28  go 1.13
    29  
    30  require example.com/dotgo.go v1.0.0
    31  -- go.sum --
    32  example.com/dotgo.go v1.0.0 h1:XKJfs0V8x2PvY2tX8bJBCEbCDLnt15ma2onwhVpew/I=
    33  example.com/dotgo.go v1.0.0/go.mod h1:Qi6z/X3AC5vHiuMt6HF2ICx3KhIBGrMdrA7YoPDKqR0=
    34  -- use.go --
    35  package use
    36  
    37  import _ "example.com/dotgo.go"
    38  

View as plain text