Skip to content

Commit

Permalink
Merge pull request #463 from TarsCloud/feat/github/action
Browse files Browse the repository at this point in the history
fix(bug): uninitialized app attribute in tars.Admin
  • Loading branch information
lbbniu authored May 5, 2023
2 parents 12c5859 + ecf0fe5 commit 6657adb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tars/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tars/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down

0 comments on commit 6657adb

Please sign in to comment.