aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/bug.txt
blob: 571d507358ade486cfdc46b59dbe07925fbcc6c9 (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
# Verify that go bug creates the appropriate URL issue body

[!linux] skip
[short] skip

go install
go build -o $TMPDIR/go ./go
env BROWSER=$GOPATH/bin/browser PATH=$TMPDIR:$PATH
go bug
exists $TMPDIR/browser
grep '^go version' $TMPDIR/browser
grep '^GOROOT/bin/go version: go version' $TMPDIR/browser
grep '^GOROOT/bin/go tool compile -V: compile version' $TMPDIR/browser
grep '^uname -sr: Linux' $TMPDIR/browser

-- go.mod --
module browser

-- main.go --
package main

import (
	"fmt"
	"net/url"
	"os"
	"path/filepath"
)

func main() {
	u, err := url.Parse(os.Args[1])
	if err != nil {
		panic(err)
	}
	body, err := url.PathUnescape(u.Query().Get("body"))
	if err != nil {
		panic(err)
	}
	out := filepath.Join(os.TempDir(), "browser")
	f, err := os.Create(out)
	if err != nil {
		panic(err)
	}
	fmt.Fprintln(f, body)
	if err := f.Close(); err != nil {
		panic(err)
	}
}

-- go/main.go --
package main

import (
    "os"
)

func main() {
    os.Exit(1)
}