Skip to content

Commit

Permalink
fix nil check errors (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
RamanaReddy0M committed Mar 10, 2023
1 parent 4ad5ff0 commit 9267fe5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/docgen/dstdocgen/dst.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ func process() error {
pkg: pkg,
structName: *structure,
})
structures = append(structures, main)
if main != nil {
structures = append(structures, main)
}
structures = append(structures, extra...)
}
if len(structures) == 0 {
Expand Down Expand Up @@ -424,7 +426,7 @@ func collectFields(s *structType, collectOpts *collectStructOptions) (fields []*
var foundStructures []*structType

for _, f := range s.node.Fields.List {
if f.Tag == nil && len(f.Names) > 0 {
if f.Tag == nil || len(f.Names) < 1 {
continue
}
tag := reflect.StructTag(strings.Trim(f.Tag.Value, "`"))
Expand Down

0 comments on commit 9267fe5

Please sign in to comment.