From 41d58891c808cb8dd3453a7cae52872ef78648e2 Mon Sep 17 00:00:00 2001 From: Andrew Meyer Date: Wed, 12 Feb 2020 13:44:46 -0600 Subject: [PATCH] Fix windows test failures Signed-off-by: Andrew Meyer Signed-off-by: Natalie Arellano --- build_test.go | 2 +- internal/buildpack/locatortype.go | 7 ++----- internal/paths/paths.go | 10 ---------- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/build_test.go b/build_test.go index 934a9625a9..34fe571b2d 100644 --- a/build_test.go +++ b/build_test.go @@ -1068,7 +1068,7 @@ func testBuild(t *testing.T, when spec.G, it spec.S) { Builder: builderName, ClearCache: true, Buildpacks: []string{ - "buildid@buildpack.1.version", + "buildpack.1.id@buildpack.1.version", filepath.Join("testdata", "buildpack"), }, }) diff --git a/internal/buildpack/locatortype.go b/internal/buildpack/locatortype.go index caae54bb4f..3c17a3eddb 100644 --- a/internal/buildpack/locatortype.go +++ b/internal/buildpack/locatortype.go @@ -2,6 +2,7 @@ package buildpack import ( "fmt" + "os" "strings" "github.com/google/go-containerregistry/pkg/name" @@ -52,11 +53,7 @@ func GetLocatorType(locator string, buildpacksFromBuilder []dist.BuildpackInfo) return URILocator, nil } - exists, err := paths.Exists(locator) - if err != nil { - return InvalidLocator, err - } - if exists { + if _, err := os.Stat(locator); err == nil { return URILocator, nil } diff --git a/internal/paths/paths.go b/internal/paths/paths.go index 4efedaf9f7..b9be2634be 100644 --- a/internal/paths/paths.go +++ b/internal/paths/paths.go @@ -24,16 +24,6 @@ func IsDir(path string) (bool, error) { return fileInfo.IsDir(), nil } -func Exists(path string) (bool, error) { - if _, err := os.Stat(path); err != nil { - if os.IsNotExist(err) { - return false, nil // does not exist - } - return false, err // some other error - } - return true, nil -} - func FilePathToURI(path string) (string, error) { var err error if !filepath.IsAbs(path) {