...

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

Documentation: cmd/go/testdata/script

     1# Verify build -o can output multiple executables to a directory.
     2
     3mkdir $WORK/bin
     4go build -o $WORK/bin ./cmd/c1 ./cmd/c2
     5! stderr 'multiple packages'
     6
     7! go build -o $WORK/bin ./pkg1 ./pkg1
     8stderr 'no main packages'
     9
    10! go build ./cmd/c1
    11stderr 'already exists and is a directory'
    12
    13# Verify build -o output correctly local packages
    14mkdir $WORK/local
    15go build -o $WORK/local ./exec.go
    16exists $WORK/local/exec$GOEXE
    17
    18-- go.mod --
    19module exmod
    20
    21-- cmd/c1/main.go --
    22package main
    23
    24func main() {}
    25
    26-- cmd/c2/main.go --
    27package main
    28
    29func main() {}
    30
    31-- pkg1/pkg1.go --
    32package pkg1
    33
    34-- pkg2/pkg2.go --
    35package pkg2
    36
    37-- exec.go --
    38package main
    39
    40func main() {}
    41
    42-- c1$GOEXE/keep.txt --
    43Create c1 directory.

View as plain text