Skip to content

Commit

Permalink
fix: panic when genDecl.Doc is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Bin-Huang committed Aug 8, 2022
1 parent ac05f18 commit ae596ce
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ func ParseCodeFile(filename string) ([]StructInfo, []ImportInfo, error) {

var initMode bool
if genDecl.Tok == token.TYPE {
if genDecl.Doc == nil {
continue
}
needGen := false
for _, doc := range genDecl.Doc.List {
if isMakeComment(doc.Text) {
Expand Down

0 comments on commit ae596ce

Please sign in to comment.