github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/gopath_paths.txt (about) 1 # Regression test for GOPATH validation in GOPATH mode. 2 env GO111MODULE=off 3 4 env ORIG_GOPATH=$GOPATH 5 6 # The literal path '.' in GOPATH should be rejected. 7 env GOPATH=. 8 ! go build go-cmd-test/helloworld.go 9 stderr 'GOPATH entry is relative' 10 11 # It should still be rejected if the requested package can be 12 # found using another entry. 13 env GOPATH=${:}$ORIG_GOPATH${:}. 14 ! go build go-cmd-test 15 stderr 'GOPATH entry is relative' 16 17 # GOPATH cannot be a relative subdirectory of the working directory. 18 env ORIG_GOPATH 19 stdout 'ORIG_GOPATH='$WORK[/\\]gopath 20 cd $WORK 21 env GOPATH=gopath 22 ! go build gopath/src/go-cmd-test/helloworld.go 23 stderr 'GOPATH entry is relative' 24 25 # Blank paths in GOPATH should be rejected as relative (issue 21928). 26 env GOPATH=' '${:}$ORIG_GOPATH 27 ! go build go-cmd-test 28 stderr 'GOPATH entry is relative' 29 30 [short] stop 31 32 # Empty paths in GOPATH should be ignored (issue 21928). 33 env GOPATH=${:}$ORIG_GOPATH 34 env GOPATH 35 go install go-cmd-test 36 exists $ORIG_GOPATH/bin/go-cmd-test$GOEXE 37 38 -- go-cmd-test/helloworld.go -- 39 package main 40 41 func main() { 42 println("hello world") 43 }