aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/build_output.txt
blob: e5a4852346c41ff28301daa4696e5753500c4bc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
[gccgo] skip 'gccgo has no standard packages'
[short] skip

[!windows] env NONEXE='.exe'
[windows] env NONEXE=''

env GOBIN=$WORK/tmp/bin
go install isarchive &

go build x.go
exists -exec x$GOEXE
rm x$GOEXE
! exists x$NONEXE

go build -o myprog x.go
! exists x
! exists x.exe
exists -exec myprog
! exists myprogr.exe

go build p.go
! exists p
! exists p.a
! exists p.o
! exists p.exe

wait # for isarchive

go build -o p.a p.go
exists p.a
exec $GOBIN/isarchive p.a

go build cmd/gofmt
exists -exec gofmt$GOEXE
rm gofmt$GOEXE
! exists gofmt$NONEXE

go build -o mygofmt cmd/gofmt
exists -exec mygofmt
! exists mygofmt.exe
! exists gofmt
! exists gofmt.exe

go build sync/atomic
! exists atomic
! exists atomic.exe

go build -o myatomic.a sync/atomic
exists myatomic.a
exec $GOBIN/isarchive myatomic.a
! exists atomic
! exists atomic.a
! exists atomic.exe

! go build -o whatever cmd/gofmt sync/atomic
stderr 'multiple packages'

-- x.go --
package main

func main() {}
-- p.go --
package p
-- isarchive/isarchive.go --
package main

import (
	"bytes"
	"fmt"
	"io"
	"os"
)

func main() {
	f, err := os.Open(os.Args[1])
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	buf := make([]byte, 100)
	io.ReadFull(f, buf)
	f.Close()
	if !bytes.HasPrefix(buf, []byte("!<arch>\n")) {
		fmt.Fprintf(os.Stderr, "file %s exists but is not an archive\n", os.Args[1])
		os.Exit(1)
	}
}