diff --git a/lein/build.go b/lein/build.go index 269591d..86804f6 100644 --- a/lein/build.go +++ b/lein/build.go @@ -102,7 +102,7 @@ func (b Build) Build(context libcnb.BuildContext) (libcnb.BuildResult, error) { InterestingFileDetector: libbs.AlwaysInterestingFileDetector{}, } - sbomScanner := sbom.NewSyftCLISBOMScanner(context.Layers, effect.NewExecutor(), b.Logger) + sbomScanner := sbom.NewSyftCLISBOMScanner(context.Layers, effect.CommandExecutor{}, b.Logger) a, err := b.ApplicationFactory.NewApplication( map[string]interface{}{}, diff --git a/lein/build_test.go b/lein/build_test.go index 049277f..a26ceec 100644 --- a/lein/build_test.go +++ b/lein/build_test.go @@ -17,7 +17,6 @@ package lein_test import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -43,12 +42,14 @@ func testBuild(t *testing.T, context spec.G, it spec.S) { it.Before(func() { var err error - ctx.Application.Path, err = ioutil.TempDir("", "build-application") + ctx.Application.Path, err = os.MkdirTemp("", "build-application") Expect(err).NotTo(HaveOccurred()) - ctx.Layers.Path, err = ioutil.TempDir("", "build-layers") + ctx.Layers.Path, err = os.MkdirTemp("", "build-layers") Expect(err).NotTo(HaveOccurred()) leinBuild = lein.Build{ApplicationFactory: &FakeApplicationFactory{}} + + t.Setenv("BP_ARCH", "amd64") }) it.After(func() { @@ -57,7 +58,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) { }) it("does not contribute distribution if wrapper exists", func() { - Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "lein"), []byte{}, 0644)).To(Succeed()) + Expect(os.WriteFile(filepath.Join(ctx.Application.Path, "lein"), []byte{}, 0644)).To(Succeed()) ctx.StackID = "test-stack-id" result, err := leinBuild.Build(ctx) diff --git a/lein/detect_test.go b/lein/detect_test.go index f9426d8..fc37fe9 100644 --- a/lein/detect_test.go +++ b/lein/detect_test.go @@ -17,7 +17,6 @@ package lein_test import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -40,7 +39,7 @@ func testDetect(t *testing.T, context spec.G, it spec.S) { it.Before(func() { var err error - ctx.Application.Path, err = ioutil.TempDir("", "lein") + ctx.Application.Path, err = os.MkdirTemp("", "lein") Expect(err).NotTo(HaveOccurred()) }) @@ -53,7 +52,7 @@ func testDetect(t *testing.T, context spec.G, it spec.S) { }) it("passes with project.clj", func() { - Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "project.clj"), []byte{}, 0644)) + Expect(os.WriteFile(filepath.Join(ctx.Application.Path, "project.clj"), []byte{}, 0644)) Expect(detect.Detect(ctx)).To(Equal(libcnb.DetectResult{ Pass: true, diff --git a/lein/distribution_test.go b/lein/distribution_test.go index ce05efc..ab407a3 100644 --- a/lein/distribution_test.go +++ b/lein/distribution_test.go @@ -17,7 +17,6 @@ package lein_test import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -42,7 +41,7 @@ func testDistribution(t *testing.T, context spec.G, it spec.S) { Expect(err).NotTo(HaveOccurred()) - ctx.Layers.Path, err = ioutil.TempDir("", "distribution-layers") + ctx.Layers.Path, err = os.MkdirTemp("", "distribution-layers") Expect(err).NotTo(HaveOccurred()) })