mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
go2idl: Track doc.go file-comments
Previously we just tracked comments on the 'package' declaration. Treat all file comments as one comment-block, for simplicity. Can be revisited if needed.
This commit is contained in:
parent
4a00a0fd6d
commit
052847f4ed
@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user