could simplify (*eng.NavButtons).AddNavButton to eng.NavButtons.AddNavButton
396
397func (eng *Engine) addJumpNavButton(param navJumpButtonParam) *Engine {
398 if param.Exist {
399 *eng.NavButtons = (*eng.NavButtons).AddNavButton(param.Icon, param.BtnName,400 action.JumpInNewTab(config.Url(param.URL),
401 language.GetWithScope(param.Title, param.TitleScore)))
402 }
could simplify (*eng.NavButtons).CheckPermission to eng.NavButtons.CheckPermission
681 Menu: menu.GetGlobalMenu(user, eng.Adapter.GetConnection(), ctx.Lang()).SetActiveClass(eng.config.URLRemovePrefix(ctx.Path())),
682 Panel: template.WarningPanel(err.Error()).GetContent(eng.config.IsProductionEnvironment()),
683 Assets: template.GetComponentAssetImportHTML(),
684 Buttons: (*eng.NavButtons).CheckPermission(user),685 TmplHeadHTML: template.Default().GetHeadHTML(),
686 TmplFootJS: template.Default().GetFootJS(),
687 Iframe: ctx.IsIframe(),
could simplify (*form).Value to form.Value
318 var input []byte
319 form := ctx.Request.MultipartForm
320 if form != nil {
321 input, _ = json.Marshal((*form).Value)322 }
323
324 models.OperationLog().SetConn(conn).New(user.Id, ctx.Path(), ctx.Method(), ctx.LocalIP(), string(input))
Description
Avoid unnecessary dereference expressions that can be avoided by using shorthand notations (syntactic sugar) that are available in Go.
Bad practice
_ = (*str).field // replace with str.field
_ = (**str).field // replace with (*str).field
(*k)[2] = 3 // replace with k[2] = 3
Recommended
_ = str.field
_ = (*str).field
k[2] = 3