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

fix: funcDeclaration body check #1310

Merged
merged 1 commit into from Aug 26, 2022
Merged

fix: funcDeclaration body check #1310

merged 1 commit into from Aug 26, 2022

Conversation

rytsh
Copy link
Contributor

@rytsh rytsh commented Aug 26, 2022

Describe the PR
Nil pointer check in function scoped types.

Relation issue
#1309

This is fixes problem on running swag build.

@codecov
Copy link

codecov bot commented Aug 26, 2022

Codecov Report

Merging #1310 (f1e59e0) into master (a3935c5) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           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           
Impacted Files Coverage Δ
packages.go 90.70% <100.00%> (+0.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link

@liut liut left a 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 {
Copy link
Contributor

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 {

Copy link
Contributor Author

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.

Copy link
Contributor Author

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 <eates23@gmail.com>
@mstrYoda
Copy link
Contributor

LGTM

Thanks for the fix 🙏

Copy link
Contributor

@ubogdan ubogdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ubogdan ubogdan merged commit 007219f into swaggo:master Aug 26, 2022
@ubogdan
Copy link
Contributor

ubogdan commented Aug 26, 2022

@rytsh Thanks for your contribution

@morremeyer
Copy link
Contributor

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!

@ubogdan
Copy link
Contributor

ubogdan commented Aug 29, 2022

Well, there is not written anywhere. I'm currently doing a release every month with some delay when too few contributions are available.

@Mokto
Copy link

Mokto commented Sep 5, 2022

Given it's a major regression for everyone here, could we please release it ASAP ?

Thanks.

@mstrYoda
Copy link
Contributor

mstrYoda commented Sep 5, 2022

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.

@TomHellier
Copy link

Agree, can we release 1.8.6?

relates to #1327

@ubogdan
Copy link
Contributor

ubogdan commented Sep 15, 2022

@TomHellier yes, we will release it soon.

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

Successfully merging this pull request may close these issues.

None yet

8 participants