advent-of-code

advent of code (partial solutions)
Log | Files | Refs | README

commit 57bcf9b90a8671683ca7da2b025e524e477a0e24
parent cc9e8162c26e44717aa9af7ee6e503d367349350
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Fri,  3 Dec 2021 19:22:57 -0800

simplify

Diffstat:
M2021/aoc01-templ.go | 6+-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/2021/aoc01-templ.go b/2021/aoc01-templ.go @@ -19,12 +19,8 @@ func main() { d, _ := strconv.Atoi(scanner.Text()) lines = append(lines, d) } - tmpl := template.New("aoc") - tmpl = tmpl.Funcs(template.FuncMap{"addone": func(i int) int { return i + 1 }}) + tmpl := template.New("aoc").Funcs(template.FuncMap{"addone": func(i int) int { return i + 1 }}) tmpl, err := tmpl.Parse(templ) - if err != nil { - panic(err) - } err = tmpl.Execute(os.Stdout, struct{ Input []int }{lines}) if err != nil { panic(err)