Open vmee opened 7 months ago
我升级到v0.2.0版本后,出现下面的错误, 现在已经定位到问题出现range=[1:1000], 1000删除后就可以正确运行
api
PermissionListBackReq { ParentId uint64 `form:"parentId,optional"` // 父级权限id Name string `form:"name,optional"` // 名称 Value string `form:"value,optional"` // 权限值 Status uint64 `form:"status,optionals"` // 启用状态;2->禁用;1->启用 Page int64 `form:"page,default=1,range=[1:]"` // 页码 pageSize int64 `form:"pageSize,default=10,range=[1:1000]"` // 每页大小 }
报错信息
Error: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0xc8 pc=0x102e3b28c] goroutine 1 [running]: github.com/zeromicro/goctl-swagger/generate.renderStruct({{0x140004759e0, 0x8}, {0x102ff55f8, 0x140003f4eb0}, {0x14000026750, 0x2a}, {0x14000028960, _}, {_, _, ...}, ...}) /Users/kk/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/zeromicro/goctl-swagger@v0.2.0/generate/parser.go:382 +0x44c github.com/zeromicro/goctl-swagger/generate.renderServiceRoutes({{0x140005a65f0, 0x7}, {0x1400040c160, 0x1, 0x1}}, {0x1400040c160?, 0x10?, 0x1400006a408?}, 0x140003f8c90, 0x1400053b788) /Users/kk/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/zeromicro/goctl-swagger@v0.2.0/generate/parser.go:180 +0x1aec github.com/zeromicro/goctl-swagger/generate.applyGenerate(0x140003243c0, {0x0, 0x0}, {0x16d3b32ba, 0x2}, {0x0, 0x0}) /Users/kk/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/zeromicro/goctl-swagger@v0.2.0/generate/parser.go:108 +0x560 github.com/zeromicro/goctl-swagger/generate.Do({0x16d3b32a7, 0x8}, {0x0?, 0x0?}, {0x16d3b32ba?, 0x3?}, {0x0?, 0x14000302440?}, 0x140003243c0) /Users/kk/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/zeromicro/goctl-swagger@v0.2.0/generate/generate.go:13 +0x58 github.com/zeromicro/goctl-swagger/action.Generator(0x14000324380) /Users/kk/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/zeromicro/goctl-swagger@v0.2.0/action/action.go:23 +0xe4 github.com/urfave/cli/v2.(*Command).Run(0x1033d1660, 0x14000324180) /Users/kk/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/urfave/cli/v2@v2.11.0/command.go:169 +0x52c github.com/urfave/cli/v2.(*App).RunContext(0x1400033a1c0, {0x102ff5ed0, 0x103442d40}, {0x140000b0180, 0x6, 0x6}) /Users/kk/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/urfave/cli/v2@v2.11.0/app.go:378 +0xb60 github.com/urfave/cli/v2.(*App).Run(...) /Users/kk/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/urfave/cli/v2@v2.11.0/app.go:251 main.main() /Users/kk/.asdf/installs/golang/1.22.2/packages/pkg/mod/github.com/zeromicro/goctl-swagger@v0.2.0/main.go:46 +0x158
我基于这个重新写了插件,修复了这个bug,你可以试试:
go install github.com/xing393939/gotools/cmd/gozero-swagger@latest goctl api plugin -plugin gozero-swagger="swagger -host localhost:8888" -api gateway.api -dir .
我升级到v0.2.0版本后,出现下面的错误, 现在已经定位到问题出现range=[1:1000], 1000删除后就可以正确运行
api
报错信息