Skip to content

Commit

Permalink
Merge pull request #264 from paketo-buildpacks/fix-chars
Browse files Browse the repository at this point in the history
Do not use effect.NewExecutor use CommandExecutor instead
  • Loading branch information
anthonydahanne authored Oct 4, 2024
2 parents 707f60d + a8e4263 commit 441ec6c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lein/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}{},
Expand Down
9 changes: 5 additions & 4 deletions lein/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package lein_test

import (
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -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() {
Expand All @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions lein/detect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package lein_test

import (
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -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())
})

Expand All @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions lein/distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package lein_test

import (
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -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())
})

Expand Down

0 comments on commit 441ec6c

Please sign in to comment.