From 804f95d8db6f517bf0fcc6693ab0f0f7e8b8ada8 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Tue, 23 Apr 2019 22:10:40 +0100 Subject: [PATCH] Remove the init panic Signed-off-by: Andrew Thornton --- macaron.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/macaron.go b/macaron.go index 715076a..75ec7ac 100644 --- a/macaron.go +++ b/macaron.go @@ -285,6 +285,10 @@ var ( // Path of work directory. Root string + // GetwdErr is error generated when trying to set the Root in init + // You must check this error yourself + GetwdErr error + // Flash applies to current request. FlashNow bool @@ -311,11 +315,7 @@ func safeEnv() string { func init() { setENV(os.Getenv("MACARON_ENV")) - var err error - Root, err = os.Getwd() - if err != nil { - panic("error getting work directory: " + err.Error()) - } + Root, GetwdErr = os.Getwd() } // SetConfig sets data sources for configuration.