diff options
author | Julien Dessaux | 2024-03-11 23:19:13 +0100 |
---|---|---|
committer | Julien Dessaux | 2024-03-11 23:19:13 +0100 |
commit | b40723b0b8d482140c5152b22233c1b62ec7838d (patch) | |
tree | eb1a7995c4e2d2c17ce9a98807aabed0ca3b81f2 /pkg/permissions.go | |
parent | feat(gonf): bootstrapped the gonf cli (diff) | |
download | gonf-b40723b0b8d482140c5152b22233c1b62ec7838d.tar.gz gonf-b40723b0b8d482140c5152b22233c1b62ec7838d.tar.bz2 gonf-b40723b0b8d482140c5152b22233c1b62ec7838d.zip |
chore(variables): support integer interpolation for all values
Diffstat (limited to '')
-rw-r--r-- | pkg/permissions.go | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/pkg/permissions.go b/pkg/permissions.go index 2bd73a9..3710e68 100644 --- a/pkg/permissions.go +++ b/pkg/permissions.go @@ -37,14 +37,9 @@ func (p *Permissions) resolve(filename string) (Status, error) { } } } - m, ok := p.mode.(*IntValue) - if !ok { - if i, err := strconv.Atoi(p.mode.String()); err != nil { - return BROKEN, err - } else { - m = &IntValue{i} - p.mode = m - } + m, err := p.mode.Int() + if err != nil { + return BROKEN, err } u, ok := p.user.(*IntValue) if !ok { @@ -63,9 +58,9 @@ func (p *Permissions) resolve(filename string) (Status, error) { if fileInfo, err := os.Lstat(filename); err != nil { return BROKEN, err } else { - gv := g.Int() - mv := fs.FileMode(m.Int()) - uv := u.Int() + gv, _ := g.Int() + mv := fs.FileMode(m) + uv, _ := u.Int() if fileInfo.Mode() != mv { if err := os.Chmod(filename, mv); err != nil { return BROKEN, err @@ -82,8 +77,6 @@ func (p *Permissions) resolve(filename string) (Status, error) { } else { return BROKEN, errors.New("Unsupported operating system") } - _ = gv - _ = uv } return status, nil } |