1 # Verify that go bug creates the appropriate URL issue body
2
3 [!GOOS:linux] skip
4 [short] skip
5
6 go install
7 go build -o $TMPDIR/go ./go
8 env BROWSER=$GOPATH/bin/browser PATH=$TMPDIR:$PATH
9 go bug
10 exists $TMPDIR/browser
11 grep '^go version' $TMPDIR/browser
12 grep '^GOROOT/bin/go version: go version' $TMPDIR/browser
13 grep '^GOROOT/bin/go tool compile -V: compile version' $TMPDIR/browser
14 grep '^uname -sr: Linux' $TMPDIR/browser
15
16 -- go.mod --
17 module browser
18
19 -- main.go --
20 package main
21
22 import (
23 "fmt"
24 "net/url"
25 "os"
26 "path/filepath"
27 )
28
29 func main() {
30 u, err := url.Parse(os.Args[1])
31 if err != nil {
32 panic(err)
33 }
34 body, err := url.PathUnescape(u.Query().Get("body"))
35 if err != nil {
36 panic(err)
37 }
38 out := filepath.Join(os.TempDir(), "browser")
39 f, err := os.Create(out)
40 if err != nil {
41 panic(err)
42 }
43 fmt.Fprintln(f, body)
44 if err := f.Close(); err != nil {
45 panic(err)
46 }
47 }
48
49 -- go/main.go --
50 package main
51
52 import (
53 "os"
54 )
55
56 func main() {
57 os.Exit(1)
58 }
59
View as plain text