Skip to content

Commit ba05c3f

Browse files
Merge pull request #246 from paketo-buildpacks/fix-chars
Do not use effect.NewExecutor use CommandExecutor instead
2 parents 1e40f53 + 6df975c commit ba05c3f

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

clojure/build.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (b Build) Build(context libcnb.BuildContext) (libcnb.BuildResult, error) {
9393
result.Layers = append(result.Layers, c)
9494

9595
ednFileExists := fileExists(filepath.Join(context.Application.Path, "deps.edn"))
96-
toolsBuildEnabled, err := libbs.ResolveArguments("BP_CLJ_TOOLS_BUILD_ENABLED", cr)
96+
toolsBuildEnabled, _ := libbs.ResolveArguments("BP_CLJ_TOOLS_BUILD_ENABLED", cr)
9797
var args []string
9898
if ednFileExists && strings.ToLower(toolsBuildEnabled[0]) == "true" {
9999
args, err = libbs.ResolveArguments("BP_CLJ_TOOLS_BUILD_ARGUMENTS", cr)
@@ -114,7 +114,7 @@ func (b Build) Build(context libcnb.BuildContext) (libcnb.BuildResult, error) {
114114
InterestingFileDetector: libbs.AlwaysInterestingFileDetector{},
115115
}
116116

117-
sbomScanner := sbom.NewSyftCLISBOMScanner(context.Layers, effect.NewExecutor(), b.Logger)
117+
sbomScanner := sbom.NewSyftCLISBOMScanner(context.Layers, effect.CommandExecutor{}, b.Logger)
118118

119119
a, err := b.ApplicationFactory.NewApplication(
120120
map[string]interface{}{},

clojure/build_test.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package clojure_test
1818

1919
import (
20-
"io/ioutil"
2120
"os"
2221
"path/filepath"
2322
"testing"
@@ -43,12 +42,14 @@ func testBuild(t *testing.T, context spec.G, it spec.S) {
4342
it.Before(func() {
4443
var err error
4544

46-
ctx.Application.Path, err = ioutil.TempDir("", "build-application")
45+
ctx.Application.Path, err = os.MkdirTemp("", "build-application")
4746
Expect(err).NotTo(HaveOccurred())
4847

49-
ctx.Layers.Path, err = ioutil.TempDir("", "build-layers")
48+
ctx.Layers.Path, err = os.MkdirTemp("", "build-layers")
5049
Expect(err).NotTo(HaveOccurred())
5150
clojureBuild = clojure.Build{ApplicationFactory: &FakeApplicationFactory{}}
51+
52+
t.Setenv("BP_ARCH", "amd64")
5253
})
5354

5455
it.After(func() {
@@ -57,7 +58,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) {
5758
})
5859

5960
it("does not contribute distribution if wrapper exists", func() {
60-
Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "clojure"), []byte{}, 0644)).To(Succeed())
61+
Expect(os.WriteFile(filepath.Join(ctx.Application.Path, "clojure"), []byte{}, 0644)).To(Succeed())
6162
ctx.StackID = "test-stack-id"
6263

6364
result, err := clojureBuild.Build(ctx)

clojure/detect_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package clojure_test
1818

1919
import (
20-
"io/ioutil"
2120
"os"
2221
"path/filepath"
2322
"testing"
@@ -40,7 +39,7 @@ func testDetect(t *testing.T, context spec.G, it spec.S) {
4039
it.Before(func() {
4140
var err error
4241

43-
ctx.Application.Path, err = ioutil.TempDir("", "clojure")
42+
ctx.Application.Path, err = os.MkdirTemp("", "clojure")
4443
Expect(err).NotTo(HaveOccurred())
4544
})
4645

@@ -53,7 +52,7 @@ func testDetect(t *testing.T, context spec.G, it spec.S) {
5352
})
5453

5554
it("passes with deps.edn", func() {
56-
Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "deps.edn"), []byte{}, 0644))
55+
Expect(os.WriteFile(filepath.Join(ctx.Application.Path, "deps.edn"), []byte{}, 0644))
5756

5857
Expect(detect.Detect(ctx)).To(Equal(libcnb.DetectResult{
5958
Pass: true,

clojure/distribution_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package clojure_test
1818

1919
import (
20-
"io/ioutil"
2120
"os"
2221
"path/filepath"
2322
"testing"
@@ -42,7 +41,7 @@ func testDistribution(t *testing.T, context spec.G, it spec.S) {
4241

4342
Expect(err).NotTo(HaveOccurred())
4443

45-
ctx.Layers.Path, err = ioutil.TempDir("", "distribution-layers")
44+
ctx.Layers.Path, err = os.MkdirTemp("", "distribution-layers")
4645
Expect(err).NotTo(HaveOccurred())
4746
})
4847

0 commit comments

Comments
 (0)