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

Swagger spec generation doesn't work with go1.18 due to changes in runtime.FuncForPC #25

Open
e-nikolov opened this issue Apr 6, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@e-nikolov
Copy link
Member

e-nikolov commented Apr 6, 2022

Something changed between go1.18beta2 and go1.18 resulting in runtime.FuncForPC(ptr).FileLine() returning <autogenerated> instead of a file name

golang/go#51774

@e-nikolov e-nikolov changed the title Chai doesn't work with go1.18 due to changes in runtime.CallersFrames Chai doesn't work with go1.18 due to changes in runtime.FuncForPC Apr 6, 2022
@e-nikolov e-nikolov added the bug Something isn't working label Apr 6, 2022
@e-nikolov e-nikolov changed the title Chai doesn't work with go1.18 due to changes in runtime.FuncForPC Swagger spec generation doesn't work with go1.18 due to changes in runtime.FuncForPC Apr 6, 2022
@e-nikolov
Copy link
Member Author

The request/response json.Unmarshal/json.Marshal works at runtime with go1.18, but the swagger generation fails during the static code analysis.

As a workaround, go1.18beta2 can be used at compile time for the generation of the swagger spec and go1.18 can be used at runtime for the generic handlers.

@e-nikolov e-nikolov pinned this issue Apr 6, 2022
@e-nikolov
Copy link
Member Author

A more robust approach should be looked into for linking a handler function that is used at runtime with the comment that contains its extended swagger annotations. Perhaps the Delve debugger can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant