-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Generics from 1.18 not working #1321
Comments
I did some research. This issue was mentioned before here, here, and here and it seems to have been implemented here, and released here. However, having that said, I'm also struggling to get it working nevertheless: swag init --pd -g v1/v1.go ⇡ master 47m ⬡
2022/09/09 19:30:17 Generate swagger docs....
2022/09/09 19:30:17 Generate general API Info, search dir:./
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x87de48]
goroutine 1 [running]:
github.com/swaggo/swag.(*PackagesDefinitions).parseFunctionScopedTypesFromFile(0xc0000127b0, 0xc000503100, {0xc0002727c8, 0x15}, 0xc0051f3f50)
/home/mrus/.go/pkg/mod/github.com/swaggo/[email protected]/packages.go:168 +0xa8
github.com/swaggo/swag.(*PackagesDefinitions).ParseTypes(0xc0000127b0)
/home/mrus/.go/pkg/mod/github.com/swaggo/[email protected]/packages.go:110 +0xc9
github.com/swaggo/swag.(*Parser).ParseAPIMultiSearchDir(0xc0001fa2a0, {0xc0001edfd0?, 0x1?, 0x0?}, {0x7ffc0877aa0f?, 0x8?}, 0x64)
/home/mrus/.go/pkg/mod/github.com/swaggo/[email protected]/parser.go:362 +0x3bf
github.com/swaggo/swag/gen.(*Gen).Build(0xc0001f3920, 0xc0001f4c30)
/home/mrus/.go/pkg/mod/github.com/swaggo/[email protected]/gen/gen.go:177 +0x5c9
main.initAction(0xc0001c3680?)
/home/mrus/.go/pkg/mod/github.com/swaggo/[email protected]/cmd/swag/main.go:151 +0x757
github.com/urfave/cli/v2.(*Command).Run(0xc0001cab40, 0xc00020c340)
/home/mrus/.go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:163 +0x5dc
github.com/urfave/cli/v2.(*App).RunContext(0xc0001b5860, {0xa57690?, 0xc000032140}, {0xc0000240a0, 0x5, 0x5})
/home/mrus/.go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:313 +0xb7d
github.com/urfave/cli/v2.(*App).Run(...)
/home/mrus/.go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:224
main.main()
/home/mrus/.go/pkg/mod/github.com/swaggo/[email protected]/cmd/swag/main.go:221 +0x5c5 |
try the master branch of swaggo. You can install it with the following command. go install github.com/swaggo/swag/cmd/swag@master |
@TomHellier thank you for pointing it out / linking the PR! |
Thanks so much, it works! And, as I understood, the fix will be in the nearest release, isn't it? |
Yes my understanding is this repo gets monthly releases and the maintainer will be doing one soon |
The idea of having a 1-month time frame between releases is that the new version will get enough window to be tested and to have time to write fixes for known bugs. |
v1.8.6 is now available. |
why same error to me: have try v1.8.8, master branch. |
Maybe your swag is compiled by go lower than v1.8 |
I'm using a package https://github.com/samber/do to implement DI in my project.
This package uses at least 1.18 and generics. And when I'm trying to
swag init --pd
it doesn't work.In this
di.go:5:13
:The text was updated successfully, but these errors were encountered: