...

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

Documentation: cmd/go/testdata/script

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

View as plain text