Always use filepath.Join instead of path.Join

This patch cleans up pkg/util/mount/* and pkg/util/volume/* to always
use filepath.Join instead of path.Join. filepath.Join is preferred
because path.Join can have issues on Windows.
This commit is contained in:
Travis Rhoden
2019-03-29 17:23:31 -06:00
parent 12b7f1450c
commit 78d109e201
62 changed files with 210 additions and 221 deletions

View File

@@ -20,7 +20,7 @@ package emptydir
import (
"os"
"path"
"path/filepath"
"testing"
"k8s.io/api/core/v1"
@@ -107,8 +107,8 @@ func doTestPlugin(t *testing.T, config pluginTestConfig) {
defer os.RemoveAll(basePath)
var (
volumePath = path.Join(basePath, "pods/poduid/volumes/kubernetes.io~empty-dir/test-volume")
metadataDir = path.Join(basePath, "pods/poduid/plugins/kubernetes.io~empty-dir/test-volume")
volumePath = filepath.Join(basePath, "pods/poduid/volumes/kubernetes.io~empty-dir/test-volume")
metadataDir = filepath.Join(basePath, "pods/poduid/plugins/kubernetes.io~empty-dir/test-volume")
plug = makePluginUnderTest(t, "kubernetes.io/empty-dir", basePath)
volumeName = "test-volume"
@@ -250,7 +250,7 @@ func TestPluginBackCompat(t *testing.T) {
}
volPath := mounter.GetPath()
if volPath != path.Join(basePath, "pods/poduid/volumes/kubernetes.io~empty-dir/vol1") {
if volPath != filepath.Join(basePath, "pods/poduid/volumes/kubernetes.io~empty-dir/vol1") {
t.Errorf("Got unexpected path: %s", volPath)
}
}