diff options
| author | Shulhan <ms@kilabit.info> | 2021-02-21 22:10:30 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2021-02-21 22:10:30 +0700 |
| commit | bac03b92129a703c3241b4a31b04ed5904ded333 (patch) | |
| tree | 3e30de0125789677604cf4fad426a75de0114b32 /cmd/ciigo-example | |
| parent | 34f8dc935260582487bf451b6e9301e83414bb98 (diff) | |
| download | ciigo-bac03b92129a703c3241b4a31b04ed5904ded333.tar.xz | |
all: return error instead of call log.Fatal on non main packages
The library, non-main packages, should never call Fatal or panic,
its up to the main package or the caller on how to handle it.
While at it, fix the returned error to use log prefix and the error
value, remove the "ciigo: " prefix.
Diffstat (limited to 'cmd/ciigo-example')
| -rw-r--r-- | cmd/ciigo-example/main.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/ciigo-example/main.go b/cmd/ciigo-example/main.go index fba1e8b..3ad8a93 100644 --- a/cmd/ciigo-example/main.go +++ b/cmd/ciigo-example/main.go @@ -9,6 +9,8 @@ package main import ( + "log" + "github.com/shuLhan/share/lib/memfs" "git.sr.ht/~shulhan/ciigo" @@ -17,5 +19,8 @@ import ( var ciigoFS *memfs.MemFS func main() { - ciigo.Serve(ciigoFS, "_example", ":8080", "_example/html.tmpl") + err := ciigo.Serve(ciigoFS, "_example", ":8080", "_example/html.tmpl") + if err != nil { + log.Fatal(err) + } } |
