From f7290b4ab1d4e4d725565ba3cf86296552860cfe Mon Sep 17 00:00:00 2001 From: Yuanyi Date: Tue, 16 Aug 2022 13:30:22 -0700 Subject: [PATCH] add result with field --- go/fn/result.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/go/fn/result.go b/go/fn/result.go index 1657d06df..0ccfe2a53 100644 --- a/go/fn/result.go +++ b/go/fn/result.go @@ -299,3 +299,21 @@ func ConfigObjectResult(msg string, obj *KubeObject, severity Severity) *Result }, } } + +func ConfigObjectResultWithField(msg string, obj *KubeObject, severity Severity, field *Field) *Result { + return &Result{ + Message: msg, + Severity: severity, + ResourceRef: &ResourceRef{ + APIVersion: obj.GetAPIVersion(), + Kind: obj.GetKind(), + Name: obj.GetName(), + Namespace: obj.GetNamespace(), + }, + Field: field, + File: &File{ + Path: obj.PathAnnotation(), + Index: obj.IndexAnnotation(), + }, + } +}