From 29c18bcfd068635cefd5b88e118b70ca14606cf8 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Tue, 21 Sep 2021 14:43:21 -0400 Subject: [PATCH] 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 --- contrib/implements/internal/implements/inspector.go | 2 ++ contrib/implements/internal/implements/json_report.go | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/contrib/implements/internal/implements/inspector.go b/contrib/implements/internal/implements/inspector.go index 975bff4..65cf4a5 100644 --- a/contrib/implements/internal/implements/inspector.go +++ b/contrib/implements/internal/implements/inspector.go @@ -23,6 +23,7 @@ type Inspector struct { deprecated []*goFunction preview []*goFunction + stable []*goFunction } // 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.preview = append(ii.preview, ii.visitor.preview...) + ii.stable = append(ii.stable, ii.visitor.stable...) } // NewInspector returns a newly created code inspector object. diff --git a/contrib/implements/internal/implements/json_report.go b/contrib/implements/internal/implements/json_report.go index e08d134..039a716 100644 --- a/contrib/implements/internal/implements/json_report.go +++ b/contrib/implements/internal/implements/json_report.go @@ -56,6 +56,7 @@ type jrPackage struct { Missing []jrFunction `json:"missing,omitempty"` Deprecated []gFunc `json:"deprecated_api,omitempty"` Preview []gFunc `json:"preview_api,omitempty"` + Stable []gFunc `json:"stable_api,omitempty"` } type jrOut map[string]jrPackage @@ -121,6 +122,10 @@ func collectFuncs(jp *jrPackage, ii *Inspector) { jp.Preview = append(jp.Preview, 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 {