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 @@ import (
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"reflect"
"strings"
"testing"
@@ -1069,14 +1069,14 @@ func TestPluginOptional(t *testing.T) {
}
}
datadirSymlink := path.Join(volumePath, "..data")
datadirSymlink := filepath.Join(volumePath, "..data")
datadir, err := os.Readlink(datadirSymlink)
if err != nil && os.IsNotExist(err) {
t.Fatalf("couldn't find volume path's data dir, %s", datadirSymlink)
} else if err != nil {
t.Fatalf("couldn't read symlink, %s", datadirSymlink)
}
datadirPath := path.Join(volumePath, datadir)
datadirPath := filepath.Join(volumePath, datadir)
infos, err := ioutil.ReadDir(volumePath)
if err != nil {
@@ -1227,7 +1227,7 @@ func makeProjection(name string, defaultMode int32, kind string) *v1.ProjectedVo
func doTestSecretDataInVolume(volumePath string, secret v1.Secret, t *testing.T) {
for key, value := range secret.Data {
secretDataHostPath := path.Join(volumePath, key)
secretDataHostPath := filepath.Join(volumePath, key)
if _, err := os.Stat(secretDataHostPath); err != nil {
t.Fatalf("SetUp() failed, couldn't find secret data on disk: %v", secretDataHostPath)
} else {