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

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

View as plain text