github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/mod_auth.txt (about)

     1  [!net] skip
     2  
     3  env GO111MODULE=on
     4  env GOPROXY=direct
     5  env GOSUMDB=off
     6  
     7  # Without credentials, downloading a module from a path that requires HTTPS
     8  # basic auth should fail.
     9  env NETRC=$WORK/empty
    10  ! go list all
    11  stderr '^\tserver response: ACCESS DENIED, buddy$'
    12  stderr '^\tserver response: File\? What file\?$'
    13  
    14  # With credentials from a netrc file, it should succeed.
    15  env NETRC=$WORK/netrc
    16  go mod tidy
    17  go list all
    18  stdout vcs-test.golang.org/auth/or401
    19  stdout vcs-test.golang.org/auth/or404
    20  
    21  -- go.mod --
    22  module private.example.com
    23  -- main.go --
    24  package useprivate
    25  
    26  import (
    27  	_ "vcs-test.golang.org/auth/or401"
    28  	_ "vcs-test.golang.org/auth/or404"
    29  )
    30  -- $WORK/empty --
    31  -- $WORK/netrc --
    32  machine vcs-test.golang.org
    33  	login aladdin
    34  	password opensesame