Skip to content

Commit

Permalink
move generated gotpl to top
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Scarr committed Feb 4, 2019
1 parent d380ecc commit 97764ae
Show file tree
Hide file tree
Showing 26 changed files with 13,091 additions and 13,154 deletions.
File renamed without changes.
16 changes: 12 additions & 4 deletions codegen/templates/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,25 @@ func Render(cfg Options) error {
return errors.Wrap(err, cfg.Filename)
}

if !strings.HasPrefix(info.Name(), "_") {
roots = append(roots, name)
}
roots = append(roots, name)

return nil
})
if err != nil {
return errors.Wrap(err, "locating templates")
}

// then execute all the important looking ones in order, adding them to the same file
sort.Slice(roots, func(i, j int) bool { return roots[i] < roots[j] })
sort.Slice(roots, func(i, j int) bool {
// important files go first
if strings.HasSuffix(roots[i], "!.gotpl") {
return true
}
if strings.HasSuffix(roots[j], "!.gotpl") {
return false
}
return roots[i] < roots[j]
})
var buf bytes.Buffer
for _, root := range roots {
if cfg.RegionTags {
Expand Down
Loading

0 comments on commit 97764ae

Please sign in to comment.