diff --git a/tars/admin.go b/tars/admin.go index 9b6eb4b4..075d18f2 100755 --- a/tars/admin.go +++ b/tars/admin.go @@ -21,6 +21,10 @@ type Admin struct { type adminFn func(string) (string, error) +func newAdmin(app *application) *Admin { + return &Admin{app: app} +} + // RegisterAdmin register admin functions func RegisterAdmin(name string, fn adminFn) { defaultApp.RegisterAdmin(name, fn) diff --git a/tars/application.go b/tars/application.go index dffd0085..b89db3ec 100755 --- a/tars/application.go +++ b/tars/application.go @@ -342,7 +342,7 @@ func (a *application) Run() { // add adminF if _, ok := defaultApp.tarsConfig["AdminObj"]; ok { adf := new(adminf.AdminF) - ad := new(Admin) + ad := newAdmin(a) AddServant(adf, ad, "AdminObj") }