math-optim/report/gen.go
surtur 3e641e0906
All checks were successful
continuous-integration/drone/push Build is passing
go(report/gen): drop the "S"
2022-06-19 17:28:05 +02:00

71 lines
947 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",
"min",
"max",
"mean",
"median",
"stdDev",
}
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)
}
}