github.com/jmigpin/editor@v1.6.0/core/godebug/testdata/gomod08_modinit.txt (about) 1 cd main 2 3 # opt-out of default proxy service (ex: goes to github.com directly) 4 #setenv GOPROXY direct 5 6 # no proxy to use only what is available locally 7 setenv GOPROXY off 8 9 # without a go.mod 10 fail exec go mod init 11 contains stderr "go: cannot determine module path for source directory" 12 13 # suggests using "go mod tidy" 14 exec go mod init example.com 15 16 # cannot find module because goproxy=off, shouldn't it be able to find it locally? 17 fail exec go mod tidy 18 contains stderr "cannot find module" 19 20 fail exec go mod download golang.org/x/example/stringutil 21 contains stderr "not a known dependency" 22 23 fail exec go mod download golang.org/x/example 24 25 # TODO: should be able to solve this with goproxy=off 26 27 # set goproxy to empty to get default behaviour (golang.org) 28 setenv GOPROXY 29 30 exec go mod tidy 31 contains stderr "go: finding" 32 contains stderr "go: found" 33 34 # suggests using "go mod download" 35 exec go run main.go 36 contains stderr "cba" 37 38 ucmd godebugtester run main.go 39 #ucmd godebugtester run -verbose -work main.go 40 contains stdout "println(\"cba\")" 41 # inside the external pkg 42 contains stdout "=> len([99 98 97])" 43 44 -- main/main.go -- 45 package main 46 //godebug:annotatepackage:golang.org/x/example/stringutil 47 import "golang.org/x/example/stringutil" 48 func main() { 49 v:=stringutil.Reverse("abc") 50 println(v) 51 }