Source file
src/cmd/go/go_unix_test.go
1
2
3
4
5
6
7 package main_test
8
9 import (
10 "os"
11 "syscall"
12 "testing"
13 )
14
15 func TestGoBuildUmask(t *testing.T) {
16
17 mask := syscall.Umask(0077)
18 defer syscall.Umask(mask)
19 tg := testgo(t)
20 defer tg.cleanup()
21 tg.tempFile("x.go", `package main; func main() {}`)
22
23
24
25 exe := tg.path("x")
26 tg.creatingTemp(exe)
27 tg.run("build", "-o", exe, tg.path("x.go"))
28 fi, err := os.Stat(exe)
29 if err != nil {
30 t.Fatal(err)
31 }
32 if mode := fi.Mode(); mode&0077 != 0 {
33 t.Fatalf("wrote x with mode=%v, wanted no 0077 bits", mode)
34 }
35 }
36
View as plain text