From 7123a672e6367101c7d3b5947f3baf16696e1a32 Mon Sep 17 00:00:00 2001 From: Sam Lock Date: Wed, 25 Oct 2023 11:01:18 +0100 Subject: [PATCH] enhancement: Expose Index interface from private (#1847) Signed-off-by: Sam Lock --- private/compile/compile.go | 4 +++- private/verify/verify.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/private/compile/compile.go b/private/compile/compile.go index 8d0da4ce4..303755ab0 100644 --- a/private/compile/compile.go +++ b/private/compile/compile.go @@ -18,6 +18,8 @@ import ( "go.uber.org/zap" ) +type Index = index.Index + type Artefact struct { Error error PolicySet *runtimev1.RunnablePolicySet @@ -39,7 +41,7 @@ func (e *Errors) Error() string { } } -func Files(ctx context.Context, fsys fs.FS) (index.Index, <-chan Artefact, error) { +func Files(ctx context.Context, fsys fs.FS) (Index, <-chan Artefact, error) { idx, err := index.Build(ctx, fsys) if err != nil { idxErrs := new(index.BuildError) diff --git a/private/verify/verify.go b/private/verify/verify.go index 55bac1db0..bc4d676d8 100644 --- a/private/verify/verify.go +++ b/private/verify/verify.go @@ -26,7 +26,7 @@ import ( ) // Files runs tests using the policy files in the given file system. -func Files(ctx context.Context, fsys fs.FS, idx index.Index) (*policyv1.TestResults, error) { +func Files(ctx context.Context, fsys fs.FS, idx compile.Index) (*policyv1.TestResults, error) { if idx == nil { var err error idx, err = index.Build(ctx, fsys, index.WithBuildFailureLogLevel(zap.DebugLevel))