Skip to content

Commit 03e6c55

Browse files
Marc Fouchéfcantournet
authored andcommitted
Bugfix: Use strings.TrimSuffix in func applyPolicies (#6)
TrimRight would result in bug where the last letters could be omitted when getting the policy name from the policy file name. Ex: file: consul.hcl -> name: consu Actually TrimRight actually remove all rune in pattern from the string. (naming is hard...) Using strings.TrimSuffix fixes it.
1 parent 34cbcc6 commit 03e6c55

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd/sync.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func (r *syncCommand) applyPolicies(policies []string) error {
219219
var list []string
220220

221221
for _, p := range policies {
222-
name := strings.TrimRight(filepath.Base(p), filepath.Ext(filepath.Base(p)))
222+
name := strings.TrimSuffix(filepath.Base(p), filepath.Ext(filepath.Base(p)))
223223
list = append(list, name)
224224

225225
// step: read in the content

0 commit comments

Comments
 (0)