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