diff options
Diffstat (limited to '')
-rw-r--r-- | main.go | 6 | ||||
-rw-r--r-- | misc.go | 13 |
2 files changed, 12 insertions, 7 deletions
@@ -73,8 +73,7 @@ func main() { e(setup_database()) log.Printf("Setting up templates\n") - tmpl, err = template.ParseGlob("tmpl/*") - e(err) + tmpl = er(template.ParseGlob("tmpl/*")) if config.Static { log.Printf("Registering static handle\n") @@ -95,8 +94,7 @@ func main() { config.Listen.Net, config.Listen.Addr, ) - l, err := net.Listen(config.Listen.Net, config.Listen.Addr) - e(err) + l := er(net.Listen(config.Listen.Net, config.Listen.Addr)) if config.Listen.Proto == "http" { log.Printf("Serving http\n") @@ -25,12 +25,19 @@ import ( "encoding/base64" ) -func e(e error) { - if e != nil { - panic(e) +func e(err error) { + if err != nil { + panic(err) } } +func er[v_t any](v v_t, err error) v_t { + if err != nil { + panic(err) + } + return v +} + /* * Generate a random url-safe string. * Note that the "len" parameter specifies the number of bytes taken from the |