// Copyright 2022 wanderer // SPDX-License-Identifier: GPL-3.0-or-later //go:build ignore // +build ignore package main import ( "log" "os" "text/template" "time" ) func main() { // colAlign sets the alignment of latex table columns. colAlign := []string{ "l", "c", "c", "c", "c", "c", } results := []float64{ 161.032187, 125.03484, 80321, 85.0362432, -4.466, 66.0008, } colNames := []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 ColNames []string Results []float64 ColAlign []string }{ Timestamp: time.Now(), ColNames: colNames, Results: results, ColAlign: colAlign, }) if err != nil { log.Println(err) } }