Skip to content

Commit

Permalink
Merge pull request #21 from yumemi-inc/fix/unnamed-parameter
Browse files Browse the repository at this point in the history
fix: 🐛 Ensure identifier name length greater than zero
  • Loading branch information
budougumi0617 authored Sep 16, 2024
2 parents 373ed82 + 40dc20f commit 0486cda
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions process.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,18 @@ func parseParams(is []*ast.ImportSpec, t *ast.FuncType) (string, string) {
for _, f := range t.Params.List {
if se, ok := f.Type.(*ast.SelectorExpr); ok {
if idt, ok := se.X.(*ast.Ident); ok && idt.Name == cname && se.Sel.Name == "Context" {
return f.Names[0].Name, TypeContext
if len(f.Names) > 0 && len(f.Names[0].Name) > 0 {
return f.Names[0].Name, TypeContext
}
}
}
if se, ok := f.Type.(*ast.StarExpr); ok {
if se, ok := se.X.(*ast.SelectorExpr); ok {
if idt, ok := se.X.(*ast.Ident); ok && idt.Name == hname && se.Sel.Name == "Request" {
n = f.Names[0].Name
typ = TypeHttpRequest
if len(f.Names) > 0 && len(f.Names[0].Name) > 0 {
n = f.Names[0].Name
typ = TypeHttpRequest
}
}
}
}
Expand Down

0 comments on commit 0486cda

Please sign in to comment.