mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-19 22:53:05 -03:00
write a canonical header for machine-generated files
Signed-off-by: Denys Smirnov <denys@sourced.tech>
This commit is contained in:
committed by
Denys Smirnov
parent
40a21f8e0b
commit
7eafe024af
@ -157,7 +157,6 @@ func getTokens(samples []string) ([]string, error) {
|
||||
|
||||
func executeFrequenciesTemplate(out io.Writer, freqs *samplesFrequencies, tmplPath, tmplName, commit string) error {
|
||||
fmap := template.FuncMap{
|
||||
"getCommit": func() string { return commit },
|
||||
"toFloat64": func(num int) string { return fmt.Sprintf("%f", float64(num)) },
|
||||
"orderKeys": func(m map[string]int) []string {
|
||||
keys := make([]string, 0, len(m))
|
||||
@ -187,11 +186,5 @@ func executeFrequenciesTemplate(out io.Writer, freqs *samplesFrequencies, tmplPa
|
||||
},
|
||||
"quote": strconv.Quote,
|
||||
}
|
||||
|
||||
t := template.Must(template.New(tmplName).Funcs(fmap).ParseFiles(tmplPath))
|
||||
if err := t.Execute(out, freqs); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return executeTemplate(out, tmplName, tmplPath, commit, fmap, freqs)
|
||||
}
|
||||
|
Reference in New Issue
Block a user