vote-validator: Simplify f.WriteString
fmt.Fprintf acheives the same thing in a single func.
This commit is contained in:
parent
4b2219938c
commit
30dcf49c62
@ -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))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user