From 4a07af11af5a5b40a9a8672595e0f64cfed642de Mon Sep 17 00:00:00 2001 From: Brandon Palm Date: Mon, 24 Oct 2022 14:36:56 -0500 Subject: [PATCH] Use constructor-style for NoopSubmitter --- cmd/check_container_test.go | 2 +- internal/lib/lib.go | 2 +- internal/lib/lib_container_test.go | 2 +- internal/lib/preflight_check_test.go | 2 +- internal/lib/types.go | 3 +-- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd/check_container_test.go b/cmd/check_container_test.go index 6d7dbfef..2656ab1a 100644 --- a/cmd/check_container_test.go +++ b/cmd/check_container_test.go @@ -158,7 +158,7 @@ certification_project_id: mycertid` AfterEach(func() { submit = origSubmitValue }) - It("should return a noopSubmitter ResultSubmitter", func() { + It("should return a NoopSubmitter ResultSubmitter", func() { runner, err := lib.NewCheckContainerRunner(context.TODO(), cfg, false) Expect(err).ToNot(HaveOccurred()) _, rsIsCorrectType := runner.Rs.(*lib.NoopSubmitter) diff --git a/internal/lib/lib.go b/internal/lib/lib.go index f9d038b0..b2ee16ae 100644 --- a/internal/lib/lib.go +++ b/internal/lib/lib.go @@ -109,7 +109,7 @@ func ResolveSubmitter(pc PyxisClient, cfg certification.Config) ResultSubmitter PreflightLogFile: cfg.LogFile(), } } - return NewNoopSubmitter(true, "", nil) + return NewNoopSubmitter(true, nil) } // GetContainerPolicyExceptions will query Pyxis to determine if diff --git a/internal/lib/lib_container_test.go b/internal/lib/lib_container_test.go index e46c4ffd..b71cf978 100644 --- a/internal/lib/lib_container_test.go +++ b/internal/lib/lib_container_test.go @@ -254,7 +254,7 @@ var _ = Describe("Lib Container Functions", func() { bf = bytes.NewBuffer([]byte{}) bufferLogger.SetOutput(bf) - noop = NewNoopSubmitter(false, "", bufferLogger) + noop = NewNoopSubmitter(false, bufferLogger) }) Context("and enabling log emitting", func() { diff --git a/internal/lib/preflight_check_test.go b/internal/lib/preflight_check_test.go index da7321c7..ed96d8a3 100644 --- a/internal/lib/preflight_check_test.go +++ b/internal/lib/preflight_check_test.go @@ -58,7 +58,7 @@ var _ = Describe("Preflight Check Func", func() { fmttr, _ = formatters.NewByName(formatters.DefaultFormat) rw = &runtime.ResultWriterFile{} - rs = NewNoopSubmitter(false, "", nil) + rs = NewNoopSubmitter(false, nil) DeferCleanup(os.RemoveAll, localTempDir) DeferCleanup(os.RemoveAll, localArtifactsDir) diff --git a/internal/lib/types.go b/internal/lib/types.go index 95d74439..2c63e036 100644 --- a/internal/lib/types.go +++ b/internal/lib/types.go @@ -186,10 +186,9 @@ type NoopSubmitter struct { log *log.Logger } -func NewNoopSubmitter(emitLog bool, reason string, log *log.Logger) *NoopSubmitter { +func NewNoopSubmitter(emitLog bool, log *log.Logger) *NoopSubmitter { return &NoopSubmitter{ emitLog: emitLog, - reason: reason, log: log, } }