go(report/gen,tmpl): use more meaningful var names
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-06-19 18:40:56 +02:00
parent 3e641e0906
commit ab850f6c2c
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 9 additions and 8 deletions

View File

@ -14,7 +14,8 @@
) )
func main() { func main() {
columns := []string{ // colAlign sets the alignment of latex table columns.
colAlign := []string{
"l", "l",
"c", "c",
"c", "c",
@ -30,7 +31,7 @@ func main() {
-4.466, -4.466,
66.0008, 66.0008,
} }
topics := []string{ colNames := []string{
"func name", "func name",
"min", "min",
"max", "max",
@ -55,14 +56,14 @@ func main() {
err = reportTemplate.Execute(f, struct { err = reportTemplate.Execute(f, struct {
Timestamp time.Time Timestamp time.Time
Topics []string ColNames []string
Results []float64 Results []float64
Columns []string ColAlign []string
}{ }{
Timestamp: time.Now(), Timestamp: time.Now(),
Topics: topics, ColNames: colNames,
Results: results, Results: results,
Columns: columns, ColAlign: colAlign,
}) })
if err != nil { if err != nil {
log.Println(err) log.Println(err)

View File

@ -6,8 +6,8 @@
% This file is a part of the math-optim project. % This file is a part of the math-optim project.
% project homepage: https://git.dotya.ml/wanderer/math-optim/ % project homepage: https://git.dotya.ml/wanderer/math-optim/
\begin{tabular}{ ||{{- range $i, $v := .Columns }}{{$v}}| {{- end}}| } \begin{tabular}{ ||{{- range $i, $v := .ColAlign }}{{$v}}| {{- end}}| }
{{ range $i, $v := .Topics }}{{$v }} & {{ end}}\\ {{ range $i, $v := .ColNames }}{{$v }} & {{ end}}\\
{{- range .Results }} {{- range .Results }}
{{ printf "%f &" . }} \\ {{ printf "%f &" . }} \\
{{- end }} {{- end }}