...

Text file src/cmd/go/testdata/script/mod_permissions.txt

Documentation: cmd/go/testdata/script

     1# Regression test for golang.org/issue/34634: permissions for the go.sum and
     2# go.mod files should be preserved when overwriting them.
     3
     4env GO111MODULE=on
     5[short] skip
     6
     7# Skip platforms that do not have Unix-style file permissions.
     8[GOOS:windows] skip
     9[GOOS:plan9] skip
    10
    11chmod 0640 go.mod
    12chmod 0604 go.sum
    13go mod edit -module=golang.org/issue/34634
    14
    15go get
    16cmp go.mod go.mod.want
    17cmp go.sum go.sum.want
    18
    19go run .
    20stdout 'go.mod: 0640'
    21stdout 'go.sum: 0604'
    22
    23-- read_perm.go --
    24package main
    25
    26import (
    27	"fmt"
    28	"os"
    29	_ "rsc.io/sampler"
    30)
    31
    32func main() {
    33	for _, name := range []string{"go.mod", "go.sum"} {
    34		fi, err := os.Stat(name)
    35		if err != nil {
    36			fmt.Fprintf(os.Stderr, "%s: %v\n", err)
    37			continue
    38		}
    39		fmt.Printf("%s: 0%o\n", name, fi.Mode().Perm())
    40	}
    41}
    42-- go.mod --
    43module TODO
    44
    45go 1.14
    46-- go.sum --
    47-- go.mod.want --
    48module golang.org/issue/34634
    49
    50go 1.14
    51
    52require rsc.io/sampler v1.99.99
    53-- go.sum.want --
    54golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:pvCbr/wm8HzDD3fVywevekufpn6tCGPY3spdHeZJEsw=
    55golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
    56rsc.io/sampler v1.99.99 h1:iMG9lbEG/8MdeR4lgL+Q8IcwbLNw7ijW7fTiK8Miqts=
    57rsc.io/sampler v1.99.99/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=

View as plain text