go-admin icon indicating copy to clipboard operation
go-admin copied to clipboard

[BUG]Compiling failed

Open memory125 opened this issue 4 years ago • 1 comments

Bug Description

When I add main.go according to the official document,the code segment here from main.go is compiled fail. r.GET("/admin", func(ctx *gin.Context) { engine.Content(ctx, func(ctx interface{}) (types.Panel, error) { return datamodel.GetContent() }) })

_ = eng.AddConfig(cfg).AddPlugins(adminPlugin).Use(r) the error information is : # github.com/GoAdminGroup/go-admin .\main.go:71:31: not enough arguments in call to datamodel.GetContent have () want (*"github.com/GoAdminGroup/go-admin/context".Context) .\main.go:75:19: cannot use cfg (type config.Config) as type *config.Config in argument to eng.AddConfig

How to reproduce [describe the steps how to reproduce the bug]

Just add the main.go refers to my step.

Versions

  • GoAdmin version: [e.g. 1.0.0] The latest version
  • golang version:1.17.5
  • Browser
  • OS [e.g. mac OS] Windows 10

memory125 avatar Jan 09 '22 11:01 memory125

I've modified the code segments aforementioned as followed, var contx context.Context r.GET("/admin", func(ctx *gin.Context) { engine.Content(ctx, func(ctx interface{}) (types.Panel, error) { return datamodel.GetContent(&contx) }) })

`_ = eng.AddConfig(&cfg).AddPlugins(adminPlugin).Use(r)`

the compiling error is fixed, but I'm not sure the accuracy...

memory125 avatar Jan 09 '22 13:01 memory125