Skip to content

Commit

Permalink
service: Do not set Mode to 0644 by default
Browse files Browse the repository at this point in the history
  • Loading branch information
livingsilver94 committed Nov 5, 2023
1 parent a101fb8 commit f1edfd4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ type FilePath struct {
}

// UnmarshalYAML implements the yaml.Unmarshaler interface.
// Mode defaults to 0644 if unspecified in the YAML node.
func (lp *FilePath) UnmarshalYAML(node *yaml.Node) error {
switch node.Kind {
case yaml.ScalarNode:
Expand All @@ -155,7 +154,7 @@ func (lp *FilePath) UnmarshalYAML(node *yaml.Node) error {
return err
}
lp.Path = path
lp.Mode = 0644
lp.Mode = 0
default:
type noRecursion FilePath
var noRec noRecursion
Expand Down
8 changes: 4 additions & 4 deletions service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ links:

func TestParseLinksString(t *testing.T) {
expect := map[string]service.FilePath{
"/my/path/file1": {Path: "/tmp/alias1", Mode: 0644},
"my/path/file2": {Path: "/tmp/alias2", Mode: 0o644},
"/my/path/file1": {Path: "/tmp/alias1", Mode: 0o000},
"my/path/file2": {Path: "/tmp/alias2", Mode: 0o000},
}
const doc = `
links:
Expand Down Expand Up @@ -202,8 +202,8 @@ copies:

func TestParseCopiesString(t *testing.T) {
expect := map[string]service.FilePath{
"/my/path/file1": {Path: "/tmp/alias1", Mode: 0644},
"my/path/file2": {Path: "/tmp/alias2", Mode: 0o644},
"/my/path/file1": {Path: "/tmp/alias1", Mode: 0o000},
"my/path/file2": {Path: "/tmp/alias2", Mode: 0o000},
}
const doc = `
copies:
Expand Down

0 comments on commit f1edfd4

Please sign in to comment.