From ab850f6c2c72a68953dc958ea6b8f4817ae5f088 Mon Sep 17 00:00:00 2001 From: surtur Date: Sun, 19 Jun 2022 18:40:56 +0200 Subject: [PATCH] go(report/gen,tmpl): use more meaningful var names --- report/gen.go | 13 +++++++------ report/report.tmpl | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/report/gen.go b/report/gen.go index 1b5f87c..0b8e55a 100644 --- a/report/gen.go +++ b/report/gen.go @@ -14,7 +14,8 @@ ) func main() { - columns := []string{ + // colAlign sets the alignment of latex table columns. + colAlign := []string{ "l", "c", "c", @@ -30,7 +31,7 @@ func main() { -4.466, 66.0008, } - topics := []string{ + colNames := []string{ "func name", "min", "max", @@ -55,14 +56,14 @@ func main() { err = reportTemplate.Execute(f, struct { Timestamp time.Time - Topics []string + ColNames []string Results []float64 - Columns []string + ColAlign []string }{ Timestamp: time.Now(), - Topics: topics, + ColNames: colNames, Results: results, - Columns: columns, + ColAlign: colAlign, }) if err != nil { log.Println(err) diff --git a/report/report.tmpl b/report/report.tmpl index 5d59599..1ed92fc 100644 --- a/report/report.tmpl +++ b/report/report.tmpl @@ -6,8 +6,8 @@ % This file is a part of the math-optim project. % project homepage: https://git.dotya.ml/wanderer/math-optim/ -\begin{tabular}{ ||{{- range $i, $v := .Columns }}{{$v}}| {{- end}}| } - {{ range $i, $v := .Topics }}{{$v }} & {{ end}}\\ +\begin{tabular}{ ||{{- range $i, $v := .ColAlign }}{{$v}}| {{- end}}| } + {{ range $i, $v := .ColNames }}{{$v }} & {{ end}}\\ {{- range .Results }} {{ printf "%f &" . }} \\ {{- end }}