aboutsummaryrefslogtreecommitdiff
path: root/internal/cmd
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-02-21 22:10:30 +0700
committerShulhan <ms@kilabit.info>2021-02-21 22:10:30 +0700
commitbac03b92129a703c3241b4a31b04ed5904ded333 (patch)
tree3e30de0125789677604cf4fad426a75de0114b32 /internal/cmd
parent34f8dc935260582487bf451b6e9301e83414bb98 (diff)
downloadciigo-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 'internal/cmd')
-rw-r--r--internal/cmd/generate/main.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/cmd/generate/main.go b/internal/cmd/generate/main.go
index 3e9dd8d..914e9a1 100644
--- a/internal/cmd/generate/main.go
+++ b/internal/cmd/generate/main.go
@@ -6,7 +6,11 @@
package main
-import "git.sr.ht/~shulhan/ciigo"
+import (
+ "log"
+
+ "git.sr.ht/~shulhan/ciigo"
+)
func main() {
opts := ciigo.GenerateOptions{
@@ -16,5 +20,8 @@ func main() {
GenVarName: "ciigoFS",
GenGoFileName: "cmd/ciigo-example/static.go",
}
- ciigo.Generate(&opts)
+ err := ciigo.Generate(&opts)
+ if err != nil {
+ log.Fatal(err)
+ }
}