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:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user