diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-01-10 10:18:32 +0100 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-01-10 13:13:41 +0100 |
commit | 23633f4619e0b7ccefc84a30500d6b036144ace8 (patch) | |
tree | 5af3bce9fc0df747bb4313c45204e2688bfdc999 | |
parent | 64627d910b2113fa2de6b949d846af379e75e305 (diff) | |
download | podman-23633f4619e0b7ccefc84a30500d6b036144ace8.tar.gz podman-23633f4619e0b7ccefc84a30500d6b036144ace8.tar.bz2 podman-23633f4619e0b7ccefc84a30500d6b036144ace8.zip |
sign: use filepath.Join instead of fmt.Sprintf
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
-rw-r--r-- | cmd/podman/sign.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd/podman/sign.go b/cmd/podman/sign.go index 8a31ddb98..1b4545f4f 100644 --- a/cmd/podman/sign.go +++ b/cmd/podman/sign.go @@ -1,10 +1,10 @@ package main import ( - "fmt" "io/ioutil" "net/url" "os" + "path/filepath" "strconv" "strings" @@ -141,7 +141,7 @@ func signCmd(c *cli.Context) error { return errors.Wrapf(err, "error creating new signature") } - sigStoreDir = fmt.Sprintf("%s/%s", sigStoreDir, strings.Replace(repos[0][strings.Index(repos[0], "/")+1:len(repos[0])], ":", "=", 1)) + sigStoreDir = filepath.Join(sigStoreDir, strings.Replace(repos[0][strings.Index(repos[0], "/")+1:len(repos[0])], ":", "=", 1)) if err := os.MkdirAll(sigStoreDir, 0751); err != nil { // The directory is allowed to exist if !os.IsExist(err) { @@ -154,7 +154,7 @@ func signCmd(c *cli.Context) error { logrus.Errorf("error creating sigstore file: %v", err) continue } - err = ioutil.WriteFile(sigStoreDir+"/"+sigFilename, newSig, 0644) + err = ioutil.WriteFile(filepath.Join(sigStoreDir, sigFilename), newSig, 0644) if err != nil { logrus.Errorf("error storing signature for %s", rawSource.Reference().DockerReference().String()) continue |