cmd/tree/pkglist: Fix init of regExcludes

This commit is contained in:
Daniele Rondina
2020-03-06 17:54:26 +01:00
parent 25c796c430
commit ad011e937f

View File

@@ -74,12 +74,12 @@ func NewTreePkglistCommand() *cobra.Command {
regExcludes := make([]*regexp.Regexp, len(excludes)) regExcludes := make([]*regexp.Regexp, len(excludes))
if len(excludes) > 0 { if len(excludes) > 0 {
for _, excreg := range excludes { for idx, excreg := range excludes {
re := regexp.MustCompile(excreg) re := regexp.MustCompile(excreg)
if re == nil { if re == nil {
Fatal("Invalid regex " + excreg + "!") Fatal("Invalid regex " + excreg + "!")
} }
regExcludes = append(regExcludes, re) regExcludes[idx] = re
} }
} }