...

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

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2[short] skip
     3
     4# Check for correct naming of temporary executable
     5
     6#Test for single file specified
     7cd x/y/z
     8go run foo.go
     9stderr 'foo'
    10
    11#Test for current directory
    12go run .
    13stderr 'z'
    14
    15#Test for set path
    16go run m/x/y/z/
    17stderr 'z'
    18
    19-- m/x/y/z/foo.go --
    20package main
    21import(
    22	"os"
    23	"path/filepath"
    24)
    25func main() {
    26	println(filepath.Base(os.Args[0]))
    27}
    28
    29-- x/y/z/foo.go --
    30package main
    31import(
    32	"os"
    33	"path/filepath"
    34)
    35func main() {
    36	println(filepath.Base(os.Args[0]))
    37}
    38
    39-- x/y/z/foo.go --
    40package main
    41import(
    42	"os"
    43	"path/filepath"
    44)
    45func main() {
    46	println(filepath.Base(os.Args[0]))
    47}
    48
    49-- go.mod --
    50module m

View as plain text