Skip to content

Commit

Permalink
gogensig: bodyStart function print error when the underlying type of …
Browse files Browse the repository at this point in the history
…named type is unknown
  • Loading branch information
tsingbx committed Jan 6, 2025
1 parent 1c7d285 commit 1ad8a5b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/gogensig/convert/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ func (p *Package) bodyStart(decl *gogen.Func, ret ast.Expr) error {
if err != nil {
return err
}
typ, ok := retType.(*types.Named)
if ok && typ.Underlying() == nil {
decl.BodyStart(p.p).End()
log.Println("underlying type of", ret, "of func ", decl.Func.Name(), "is unknown")
return nil
}

Check warning on line 180 in cmd/gogensig/convert/package.go

View check run for this annotation

Codecov / codecov/patch

cmd/gogensig/convert/package.go#L177-L180

Added lines #L177 - L180 were not covered by tests
decl.BodyStart(p.p).ZeroLit(retType).Return(1).End()
} else {
decl.BodyStart(p.p).End()
Expand Down

0 comments on commit 1ad8a5b

Please sign in to comment.