Address new linter complaints

This commit is contained in:
Katrina Verey
2022-03-29 18:18:23 -04:00
parent b368b347d1
commit 14947e449b
77 changed files with 220 additions and 210 deletions

View File

@@ -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 != "" {

View File

@@ -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)

View File

@@ -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.

View File

@@ -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": {