lint: fix errcheck for Close and Write calls across multiple files
Use lint.LogOnErr for deferred Body/File/Client Close calls. Use lint.Write for unchecked w.Write calls. Fix bug in sync/sms.go where fmt.Errorf result was discarded (replace with proper log.Error call).
This commit is contained in:
parent
c7a7e8431c
commit
0ec810591e
9 changed files with 24 additions and 15 deletions
|
|
@ -267,7 +267,7 @@ func (bt *builtTemplate) executeTemplateHTML(w io.Writer, content any) error {
|
|||
return fmt.Errorf("Failed to parse template file: %w", err)
|
||||
}
|
||||
if templ == nil {
|
||||
w.Write([]byte("Failed to read from disk: "))
|
||||
lint.Write(w, []byte("Failed to read from disk: "))
|
||||
return errors.New("Template parsing failed")
|
||||
}
|
||||
//log.Debug().Str("name", templ.Name()).Msg("Parsed template")
|
||||
|
|
@ -284,7 +284,7 @@ func (bt *builtTemplate) executeTemplateTXT(w io.Writer, content any) error {
|
|||
return fmt.Errorf("Failed to parse template file: %w", err)
|
||||
}
|
||||
if templ == nil {
|
||||
w.Write([]byte("Failed to read from disk: "))
|
||||
lint.Write(w, []byte("Failed to read from disk: "))
|
||||
return errors.New("Template parsing failed")
|
||||
}
|
||||
//log.Debug().Str("name", templ.Name()).Msg("Parsed template")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue