mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-09-15 12:18:57 +00:00
Address new linter complaints
This commit is contained in:
@@ -163,7 +163,6 @@ func (n *fsNode) AddFile(
|
||||
}
|
||||
|
||||
func (n *fsNode) addDir(path string) (result *fsNode, err error) {
|
||||
|
||||
parent := n
|
||||
dName, subDirName := mySplit(path)
|
||||
if dName != "" {
|
||||
|
||||
@@ -93,7 +93,6 @@ func TestMakeFsInMemory(t *testing.T) {
|
||||
t, "MakeFsInMemory", true, topCases, MakeFsInMemory())
|
||||
}
|
||||
|
||||
//nolint:gocyclo
|
||||
func runBasicOperations(
|
||||
t *testing.T, tName string, isFSysRooted bool,
|
||||
cases []pathCase, fSys FileSystem) {
|
||||
@@ -449,10 +448,10 @@ var bunchOfFiles = []struct {
|
||||
addAsDir: true,
|
||||
},
|
||||
{
|
||||
path: filepath.Join("x"),
|
||||
path: "x",
|
||||
},
|
||||
{
|
||||
path: filepath.Join("y"),
|
||||
path: "y",
|
||||
},
|
||||
{
|
||||
path: filepath.Join("b", "d", "a", "c", "i", "beans"),
|
||||
@@ -559,7 +558,7 @@ func TestRemove(t *testing.T) {
|
||||
orgCount -= 3
|
||||
|
||||
// Now drop one more for a total of four dropped.
|
||||
result, _ = n.Find(filepath.Join("y"))
|
||||
result, _ = n.Find("y")
|
||||
err = result.Remove()
|
||||
if err != nil {
|
||||
t.Fatalf("%s; unable to remove: %v", path, err)
|
||||
@@ -692,7 +691,7 @@ func TestFind(t *testing.T) {
|
||||
},
|
||||
{
|
||||
what: "directory",
|
||||
arg: filepath.Join("b"),
|
||||
arg: "b",
|
||||
expectDir: true,
|
||||
},
|
||||
{
|
||||
@@ -869,7 +868,7 @@ func TestFileOps(t *testing.T) {
|
||||
defer f.Close()
|
||||
|
||||
for {
|
||||
buf := make([]byte, rand.Intn(10))
|
||||
buf := make([]byte, rand.Intn(10)) // nolint:gosec
|
||||
n, err := f.Read(buf)
|
||||
if err != nil && err != io.EOF {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
|
||||
@@ -128,7 +128,7 @@ func (fsOnDisk) ReadFile(name string) ([]byte, error) { return ioutil.ReadFile(n
|
||||
|
||||
// WriteFile delegates to ioutil.WriteFile with read/write permissions.
|
||||
func (fsOnDisk) WriteFile(name string, c []byte) error {
|
||||
return ioutil.WriteFile(name, c, 0666)
|
||||
return ioutil.WriteFile(name, c, 0666) //nolint:gosec
|
||||
}
|
||||
|
||||
// Walk delegates to filepath.Walk.
|
||||
|
||||
@@ -194,8 +194,8 @@ func TestReadFilesRealFS(t *testing.T) {
|
||||
"file-1.xtn",
|
||||
},
|
||||
expectedDirs: map[string][]string{
|
||||
testDir: []string{dir},
|
||||
dir: []string{nestedDir},
|
||||
testDir: {dir},
|
||||
dir: {nestedDir},
|
||||
},
|
||||
},
|
||||
"AllHiddenFiles": {
|
||||
@@ -206,7 +206,7 @@ func TestReadFilesRealFS(t *testing.T) {
|
||||
".some-file-4.xtn",
|
||||
},
|
||||
expectedDirs: map[string][]string{
|
||||
testDir: []string{hiddenDir},
|
||||
testDir: {hiddenDir},
|
||||
},
|
||||
},
|
||||
"foo_File": {
|
||||
|
||||
Reference in New Issue
Block a user