blob: 77e2508cb7f3b13a6998ddcb89bab5431e32d0d5 (
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
|
# Regression test for golang.org/issue/34634: permissions for the go.sum and
# go.mod files should be preserved when overwriting them.
env GO111MODULE=on
[short] skip
# Skip platforms that do not have Unix-style file permissions.
[windows] skip
[plan9] skip
chmod 0640 go.mod
chmod 0604 go.sum
go mod edit -module=golang.org/issue/34634
go get
cmp go.mod go.mod.want
cmp go.sum go.sum.want
go run .
stdout 'go.mod: 0640'
stdout 'go.sum: 0604'
-- read_perm.go --
package main
import (
"fmt"
"os"
_ "rsc.io/sampler"
)
func main() {
for _, name := range []string{"go.mod", "go.sum"} {
fi, err := os.Stat(name)
if err != nil {
fmt.Fprintf(os.Stderr, "%s: %v\n", err)
continue
}
fmt.Printf("%s: 0%o\n", name, fi.Mode().Perm())
}
}
-- go.mod --
module TODO
go 1.14
-- go.sum --
-- go.mod.want --
module golang.org/issue/34634
go 1.14
require rsc.io/sampler v1.99.99
-- go.sum.want --
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:pvCbr/wm8HzDD3fVywevekufpn6tCGPY3spdHeZJEsw=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
rsc.io/sampler v1.99.99 h1:iMG9lbEG/8MdeR4lgL+Q8IcwbLNw7ijW7fTiK8Miqts=
rsc.io/sampler v1.99.99/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|