Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hit nil pointer error when using goctl-swagger to generate json #4497

Open
ak5w opened this issue Dec 15, 2024 · 1 comment
Open

hit nil pointer error when using goctl-swagger to generate json #4497

ak5w opened this issue Dec 15, 2024 · 1 comment

Comments

@ak5w
Copy link
Contributor

ak5w commented Dec 15, 2024

Describe the bug
when I use goctl-swagger to generate the swagger json file, hit goctl-swagger

To Reproduce
under my desc folder, then execute below command:

goctl api plugin -plugin goctl-swagger="swagger -filename dicts.json" -api dicts.api -dir .

error details as below:

Error: panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xc8 pc=0x84ef71]

goroutine 1 [running]:
github.com/zeromicro/goctl-swagger/generate.renderStruct({{0xc00029d250, 0x7}, {0xa0deb0, 0xc000383860}, {0xc00002e680, 0x33}, {0x0, 0x0}, {0xc000383870, 0x1, ...}, ...})
     /usr/local/golang/gpath/pkg/mod/github.com/zeromicro/goctl-swagger@v0.2.0/generate/parser.go:382 +0x4d1
github.com/zeromicro/goctl-swagger/generate.renderServiceRoutes({{0xc000202440, 0x8}, {0xc000489760, 0x1, 0x1}}, {0xc000489760?, 0xc00026f610?, 0x4727ff?}, 0xc0002e92f0, 0xc00026f7b8)
     /usr/local/golang/gpath/pkg/mod/github.com/zeromicro/goctl-swagger@v0.2.0/generate/parser.go:176 +0x23e5
github.com/zeromicro/goctl-swagger/generate.applyGenerate(0xc000025580, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0})
     /usr/local/golang/gpath/pkg/mod/github.com/zeromicro/goctl-swagger@v0.2.0/generate/parser.go:108 +0x728
github.com/zeromicro/goctl-swagger/generate.Do({0x7ffc1597bbdf, 0xa}, {0x0?, 0x0?}, {0x0?, 0x5?}, {0x0?, 0x0?}, 0xc000025580)
     /usr/local/golang/gpath/pkg/mod/github.com/zeromicro/goctl-swagger@v0.2.0/generate/generate.go:13 +0x65
github.com/zeromicro/goctl-swagger/action.Generator(0xc000025540)
     /usr/local/golang/gpath/pkg/mod/github.com/zeromicro/goctl-swagger@v0.2.0/action/action.go:23 +0x10d
github.com/urfave/cli/v2.(*Command).Run(0xe1af00, 0xc000025380)
     /usr/local/golang/gpath/pkg/mod/github.com/urfave/cli/v2@v2.11.0/command.go:169 +0x5e3
github.com/urfave/cli/v2.(*App).RunContext(0xc0000efdc0, {0xa0e788, 0xe47880}, {0xc000024100, 0x4, 0x4})
     /usr/local/golang/gpath/pkg/mod/github.com/urfave/cli/v2@v2.11.0/app.go:378 +0xa65
github.com/urfave/cli/v2.(*App).Run(...)
     /usr/local/golang/gpath/pkg/mod/github.com/urfave/cli/v2@v2.11.0/app.go:251
main.main()
     /usr/local/golang/gpath/pkg/mod/github.com/zeromicro/goctl-swagger@v0.2.0/main.go:46 +0x15c

and checked my api file, should no error, can generate API normally.

Expected behavior
can generate json file normally.

Screenshots
N/A

Environments (please complete the following information):

GOCTL_VERSION=1.7.3
PROTOC_VERSION=3.19.4
PROTOC_GEN_GO_VERSION=v1.35.2
PROTO_GEN_GO_GRPC_VERSION=1.5.1

More description
N/A

@kevwan
Copy link
Contributor

kevwan commented Dec 20, 2024

This issue should be in https://github.com/zeromicro/goctl-swagger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants