diff --git a/cmd/libs/go2idl/parser/parse.go b/cmd/libs/go2idl/parser/parse.go index 3d264a94bb5..2bf2f806217 100644 --- a/cmd/libs/go2idl/parser/parse.go +++ b/cmd/libs/go2idl/parser/parse.go @@ -370,8 +370,12 @@ func (b *Builder) FindTypes() (types.Universe, error) { for _, f := range b.parsed[pkgPath] { if strings.HasSuffix(f.name, "/doc.go") { + tp := u.Package(pkgPath) + for i := range f.file.Comments { + tp.Comments = append(tp.Comments, splitLines(f.file.Comments[i].Text())...) + } if f.file.Doc != nil { - u.Package(pkgPath).DocComments = splitLines(f.file.Doc.Text()) + tp.DocComments = splitLines(f.file.Doc.Text()) } } } diff --git a/cmd/libs/go2idl/types/types.go b/cmd/libs/go2idl/types/types.go index d34450868c4..b6e9391d716 100644 --- a/cmd/libs/go2idl/types/types.go +++ b/cmd/libs/go2idl/types/types.go @@ -89,9 +89,12 @@ type Package struct { // 'package x' line. Name string - // Comments from doc.go file. + // DocComments from doc.go, if any. DocComments []string + // Comments from doc.go, if any. + Comments []string + // Types within this package, indexed by their name (*not* including // package name). Types map[string]*Type