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 {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
defer stdout.Close()
|
defer mustClose(stdout)
|
||||||
if err = cmd.Start(); err != nil {
|
if err = cmd.Start(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
defer stdin.Close()
|
defer mustClose(stdin)
|
||||||
mustRenderAppTemplate(stdin, r, "invoices/view.gohtml", invoice)
|
mustRenderAppTemplate(stdin, r, "invoices/view.gohtml", invoice)
|
||||||
}()
|
}()
|
||||||
w.Header().Set("Content-Type", "application/pdf")
|
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 {
|
type invoice struct {
|
||||||
Number string
|
Number string
|
||||||
Slug string
|
Slug string
|
||||||
|
|
Loading…
Reference in New Issue