Skip to content

Commit

Permalink
code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Jul 15, 2021
1 parent d63a444 commit a8a7182
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clab/config/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func ipFarEnd(in netaddr.IPPrefix) netaddr.IPPrefix {
return netaddr.IPPrefixFrom(n, in.Bits())
}

// GetTemplateNamesInDirs returns a list of template file names found in a dir p
// GetTemplateNamesInDirs returns a list of template file names found in a list of dir `paths`
// without traversing nested dirs
// template names are following the pattern <some-name>__<role/kind>.tmpl
func GetTemplateNamesInDirs(paths []string) ([]string, error) {
Expand All @@ -261,6 +261,7 @@ func GetTemplateNamesInDirs(paths []string) ([]string, error) {
}
for _, fn := range all {
tn := strings.Split(filepath.Base(fn), "__")[0]
// skip adding templates with the same name
if len(tnames) > 0 && tnames[len(tnames)-1] == tn {
continue
}
Expand Down

0 comments on commit a8a7182

Please sign in to comment.