vote-validator: Simplify f.WriteString

fmt.Fprintf acheives the same thing in a single func.
This commit is contained in:
jholdstock 2025-04-11 09:43:29 +01:00 committed by Jamie Holdstock
parent 4b2219938c
commit 30dcf49c62

View File

@ -29,8 +29,8 @@ func (r *results) writeFile(path string) (bool, error) {
return false, fmt.Errorf("opening log file failed: %w", err) return false, fmt.Errorf("opening log file failed: %w", err)
} }
write := func(f *os.File, str string, a ...any) { write := func(f *os.File, format string, a ...any) {
_, err := f.WriteString(fmt.Sprintf(str+"\n", a...)) _, err := fmt.Fprintf(f, format+"\n", a...)
if err != nil { if err != nil {
f.Close() f.Close()
panic(fmt.Sprintf("writing to log file failed: %v", err)) panic(fmt.Sprintf("writing to log file failed: %v", err))