From c183e8443926c118163d2f184c6a94780f643386 Mon Sep 17 00:00:00 2001 From: Jon Johnson Date: Tue, 17 Nov 2020 09:33:56 -0800 Subject: [PATCH] Stop using filepath.Join in publisher --- pkg/commands/options/publish.go | 8 ++++---- pkg/publish/default.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/commands/options/publish.go b/pkg/commands/options/publish.go index 09a74e0923..928f3aabc4 100644 --- a/pkg/commands/options/publish.go +++ b/pkg/commands/options/publish.go @@ -17,7 +17,7 @@ package options import ( "crypto/md5" //nolint: gosec // No strong cryptography needed. "encoding/hex" - "path/filepath" + "path" "github.com/google/ko/pkg/publish" "github.com/spf13/cobra" @@ -71,15 +71,15 @@ func AddPublishArg(cmd *cobra.Command, po *PublishOptions) { func packageWithMD5(base, importpath string) string { hasher := md5.New() //nolint: gosec // No strong cryptography needed. hasher.Write([]byte(importpath)) - return filepath.Join(base, filepath.Base(importpath)+"-"+hex.EncodeToString(hasher.Sum(nil))) + return path.Join(base, path.Base(importpath)+"-"+hex.EncodeToString(hasher.Sum(nil))) } func preserveImportPath(base, importpath string) string { - return filepath.Join(base, importpath) + return path.Join(base, importpath) } func baseImportPaths(base, importpath string) string { - return filepath.Join(base, filepath.Base(importpath)) + return path.Join(base, path.Base(importpath)) } func bareDockerRepo(base, _ string) string { diff --git a/pkg/publish/default.go b/pkg/publish/default.go index a1f64acdc9..cb4fe78c2a 100644 --- a/pkg/publish/default.go +++ b/pkg/publish/default.go @@ -18,7 +18,7 @@ import ( "fmt" "log" "net/http" - "path/filepath" + "path" "strings" "github.com/google/go-containerregistry/pkg/authn" @@ -59,7 +59,7 @@ type Namer func(string, string) string // name for maximum clarity, e.g. // gcr.io/foo/github.com/bar/baz/cmd/blah // ^--base--^ ^-------import path-------^ -func identity(base, in string) string { return filepath.Join(base, in) } +func identity(base, in string) string { return path.Join(base, in) } // As some registries do not support pushing an image by digest, the default tag for pushing // is the 'latest' tag.