Sections can be used to extract the code sections that match a path suffix and a section name.
(files []*codegen.File, pathSuffix string, sectionName string)
| 11 | // Sections can be used to extract the code sections that match a path suffix |
| 12 | // and a section name. |
| 13 | func Sections(files []*codegen.File, pathSuffix string, sectionName string) []*codegen.SectionTemplate { |
| 14 | var result []*codegen.SectionTemplate |
| 15 | for _, file := range files { |
| 16 | if !strings.HasSuffix(file.Path, pathSuffix) { |
| 17 | continue |
| 18 | } |
| 19 | |
| 20 | for _, section := range file.SectionTemplates { |
| 21 | if section.Name == sectionName { |
| 22 | result = append(result, section) |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | return result |
| 27 | } |
no outgoing calls