Tell Goland to go fuck itself with the unhandled errors in close
This commit is contained in:
parent
2ef75efda8
commit
bc7ed0f06f
|
@ -92,12 +92,12 @@ func ServeInvoice(w http.ResponseWriter, r *http.Request, params httprouter.Para
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer stdout.Close()
|
||||
defer mustClose(stdout)
|
||||
if err = cmd.Start(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
go func() {
|
||||
defer stdin.Close()
|
||||
defer mustClose(stdin)
|
||||
mustRenderAppTemplate(stdin, r, "invoices/view.gohtml", invoice)
|
||||
}()
|
||||
w.Header().Set("Content-Type", "application/pdf")
|
||||
|
@ -113,6 +113,12 @@ func ServeInvoice(w http.ResponseWriter, r *http.Request, params httprouter.Para
|
|||
}
|
||||
}
|
||||
|
||||
func mustClose(closer io.Closer) {
|
||||
if err := closer.Close(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
type invoice struct {
|
||||
Number string
|
||||
Slug string
|
||||
|
|
Loading…
Reference in New Issue