-
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
fix: funcDeclaration body check #1310
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1310 +/- ##
=======================================
Coverage 95.47% 95.47%
=======================================
Files 14 14
Lines 2804 2805 +1
=======================================
+ Hits 2677 2678 +1
Misses 72 72
Partials 55 55
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
@@ -164,7 +164,7 @@ func (pkgDefs *PackagesDefinitions) parseTypesFromFile(astFile *ast.File, packag | |||
|
|||
func (pkgDefs *PackagesDefinitions) parseFunctionScopedTypesFromFile(astFile *ast.File, packagePath string, parsedSchemas map[*TypeSpecDef]*Schema) { | |||
for _, astDeclaration := range astFile.Decls { | |||
if funcDeclaration, ok := astDeclaration.(*ast.FuncDecl); ok { | |||
if funcDeclaration, ok := astDeclaration.(*ast.FuncDecl); ok && funcDeclaration.Body != nil { | |||
for _, stmt := range funcDeclaration.Body.List { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more readable with
funcDeclaration, ok := astDeclaration.(*ast.FuncDecl);
if ok && funcDeclaration.Body != nil {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I checked other functions some of areas used this way some not. I can change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed ✔️
Signed-off-by: Eray Ates <[email protected]>
LGTM Thanks for the fix 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@rytsh Thanks for your contribution |
Thanks for the fast fix, everyone! Can someone let us know when this will be released? It seems that releases are usually done monthly, not when changes are merged, but I could not find any documentation about it. Would be happy about knowing more here, thank you al! |
Well, there is not written anywhere. I'm currently doing a release every month with some delay when too few contributions are available. |
Given it's a major regression for everyone here, could we please release it ASAP ? Thanks. |
You can use swaggo 1.8.4 version without hassle (actually any version lower than 1.8.5) instead of waiting new release to overcome this issue. |
Agree, can we release 1.8.6? relates to #1327 |
@TomHellier yes, we will release it soon. |
Describe the PR
Nil pointer check in function scoped types.
Relation issue
#1309
This is fixes problem on running swag build.