From e357f6846bd5f07ef3baead76658d4dbb926d5fc Mon Sep 17 00:00:00 2001 From: youngsterxyf Date: Wed, 27 Jan 2016 13:30:34 +0800 Subject: [PATCH] accept @ysqi suggestion --- beego.go | 11 +---------- config.go | 3 +-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/beego.go b/beego.go index 68a76e52..65368295 100644 --- a/beego.go +++ b/beego.go @@ -67,15 +67,6 @@ func Run(params ...string) { } func initBeforeHTTPRun() { - // if AppConfigPath is setted or conf/app.conf exist - /* - err := ParseConfig() - if err != nil { - panic(err) - } - */ - var err error - //init hooks AddAPPStartHook(registerMime) AddAPPStartHook(registerDefaultErrorHandler) @@ -85,7 +76,7 @@ func initBeforeHTTPRun() { AddAPPStartHook(registerAdmin) for _, hk := range hooks { - if err = hk(); err != nil { + if err := hk(); err != nil { panic(err) } } diff --git a/config.go b/config.go index e72f770c..ebc054d6 100644 --- a/config.go +++ b/config.go @@ -20,7 +20,6 @@ import ( "path/filepath" "strings" "fmt" - "errors" "github.com/astaxie/beego/config" "github.com/astaxie/beego/session" @@ -320,7 +319,7 @@ func LoadAppConfig(configPath string, adapterName string) error { } if !utils.FileExists(absConfigPath) { - return errors.New(fmt.Sprintf("the target config file: %s don't exist!", configPath)) + return fmt.Errorf("the target config file: %s don't exist!", configPath) } if absConfigPath == AppConfigPath {