From bb73dcf59e3df9644556bbb29a21430f5799c494 Mon Sep 17 00:00:00 2001 From: David O'Sullivan Date: Wed, 17 May 2023 15:28:49 +0100 Subject: [PATCH] Adds detection logging messages at info level --- clojure/detect.go | 10 +++++++--- cmd/main/main.go | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/clojure/detect.go b/clojure/detect.go index e028080..f7e2304 100644 --- a/clojure/detect.go +++ b/clojure/detect.go @@ -20,8 +20,9 @@ import ( "fmt" "os" "path/filepath" - + "github.com/buildpacks/libcnb" + "github.com/paketo-buildpacks/libpak/bard" ) const ( @@ -31,13 +32,16 @@ const ( PlanEntrySyft = "syft" ) -type Detect struct{} +type Detect struct{ + Logger bard.Logger +} -func (Detect) Detect(context libcnb.DetectContext) (libcnb.DetectResult, error) { +func (d Detect) Detect(context libcnb.DetectContext) (libcnb.DetectResult, error) { file := filepath.Join(context.Application.Path, "deps.edn") _, err := os.Stat(file) if os.IsNotExist(err) { + d.Logger.Info("SKIPPED: no 'deps.edn' file found in the application path") return libcnb.DetectResult{Pass: false}, nil } else if err != nil { return libcnb.DetectResult{}, fmt.Errorf("unable to determine if %s exists\n%w", file, err) diff --git a/cmd/main/main.go b/cmd/main/main.go index 9087671..adedbe8 100644 --- a/cmd/main/main.go +++ b/cmd/main/main.go @@ -27,10 +27,11 @@ import ( ) func main() { + logger := bard.NewLogger(os.Stdout) libpak.Main( - clojure.Detect{}, + clojure.Detect{Logger: logger}, clojure.Build{ - Logger: bard.NewLogger(os.Stdout), + Logger: logger, ApplicationFactory: libbs.NewApplicationFactory(), }, )