diff --git a/cmd/commands/api/apiapp.go b/cmd/commands/api/apiapp.go index e1862be..bf10768 100644 --- a/cmd/commands/api/apiapp.go +++ b/cmd/commands/api/apiapp.go @@ -511,9 +511,9 @@ import ( ) func init() { - _, file, _, _ := runtime.Caller(1) - apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator)))) - beego.TestBeegoInit(apppath) + appPath, _ := filepath.Abs("..") + beego.TestBeegoInit(appPath) + beego.AppPath = appPath } // TestGet is a sample to run an endpoint test diff --git a/cmd/commands/new/new.go b/cmd/commands/new/new.go index 299f094..ef6d34c 100644 --- a/cmd/commands/new/new.go +++ b/cmd/commands/new/new.go @@ -101,9 +101,9 @@ import ( ) func init() { - _, file, _, _ := runtime.Caller(1) - apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator)))) - beego.TestBeegoInit(apppath) + appPath, _ := filepath.Abs("..") + beego.TestBeegoInit(appPath) + beego.AppPath = appPath }