1
0
mirror of https://github.com/ko-build/ko.git synced 2025-02-07 19:30:23 +02:00

Merge pull request #247 from jonjohnsonjr/filepath

Stop using filepath.Join in publisher
This commit is contained in:
Jason Hall 2020-11-17 14:25:32 -05:00 committed by GitHub
commit bd1ec540fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -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 {

View File

@ -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.