...

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

Documentation: cmd/go/testdata/script

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

View as plain text