math-optim/report/gen.go
surtur 826347f7a7
All checks were successful
continuous-integration/drone/push Build is passing
go,tex: add logic for go-generating tex reports
2022-06-15 23:36:47 +02:00

71 lines
952 B
Go

// Copyright 2022 wanderer <a_mirre at utb dot cz>
// SPDX-License-Identifier: GPL-3.0-or-later
//go:build ignore
// +build ignore
package main
import (
"log"
"os"
"text/template"
"time"
)
func main() {
columns := []string{
"l",
"c",
"c",
"c",
"c",
"c",
}
results := []float64{
161.032187,
125.03484,
80321,
85.0362432,
-4.466,
66.0008,
}
topics := []string{
"func name",
"minS",
"maxS",
"meanS",
"medianS",
"stdDevS",
}
fName := "report.tex"
paths := []string{
"report.tmpl",
}
f, err := os.Create(fName)
if err != nil {
log.Fatal(err)
}
defer f.Close()
reportTemplate := template.Must(template.ParseFiles(paths...))
err = reportTemplate.Execute(f, struct {
Timestamp time.Time
Topics []string
Results []float64
Columns []string
}{
Timestamp: time.Now(),
Topics: topics,
Results: results,
Columns: columns,
})
if err != nil {
log.Println(err)
}
}