implements: report on stable functions in json output

Because there will be a lot of stable functions we only report on them
in the json report as the text report is more meant for summaries.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2021-09-21 14:43:21 -04:00 committed by mergify[bot]
parent d1aa76c613
commit 29c18bcfd0
2 changed files with 7 additions and 0 deletions

View File

@ -23,6 +23,7 @@ type Inspector struct {
deprecated []*goFunction deprecated []*goFunction
preview []*goFunction preview []*goFunction
stable []*goFunction
} }
// SetExpected sets the expected C functions, asuming the supplied prefix. // SetExpected sets the expected C functions, asuming the supplied prefix.
@ -62,6 +63,7 @@ func (ii *Inspector) update() {
} }
ii.deprecated = append(ii.deprecated, ii.visitor.deprecated...) ii.deprecated = append(ii.deprecated, ii.visitor.deprecated...)
ii.preview = append(ii.preview, ii.visitor.preview...) ii.preview = append(ii.preview, ii.visitor.preview...)
ii.stable = append(ii.stable, ii.visitor.stable...)
} }
// NewInspector returns a newly created code inspector object. // NewInspector returns a newly created code inspector object.

View File

@ -56,6 +56,7 @@ type jrPackage struct {
Missing []jrFunction `json:"missing,omitempty"` Missing []jrFunction `json:"missing,omitempty"`
Deprecated []gFunc `json:"deprecated_api,omitempty"` Deprecated []gFunc `json:"deprecated_api,omitempty"`
Preview []gFunc `json:"preview_api,omitempty"` Preview []gFunc `json:"preview_api,omitempty"`
Stable []gFunc `json:"stable_api,omitempty"`
} }
type jrOut map[string]jrPackage type jrOut map[string]jrPackage
@ -121,6 +122,10 @@ func collectFuncs(jp *jrPackage, ii *Inspector) {
jp.Preview = append(jp.Preview, jp.Preview = append(jp.Preview,
gFunc{Name: gf.fullName, Comment: gf.comment}) gFunc{Name: gf.fullName, Comment: gf.comment})
} }
for _, gf := range ii.stable {
jp.Stable = append(jp.Stable,
gFunc{Name: gf.fullName, Comment: gf.comment})
}
} }
func mkeys(m map[string]bool) []string { func mkeys(m map[string]bool) []string {