all: Bunch of more linter fixes (#5500)

This commit is contained in:
Jakob Borg
2019-02-02 11:02:28 +01:00
committed by GitHub
parent 2111386ee4
commit df5c1eaf01
30 changed files with 118 additions and 117 deletions

View File

@@ -246,15 +246,15 @@ func TestCaching(t *testing.T) {
defer fd1.Close()
defer fd2.Close()
defer fs.Remove(fd1.Name())
defer fs.Remove(fd2.Name())
defer func() { _ = fs.Remove(fd1.Name()) }()
defer func() { _ = fs.Remove(fd2.Name()) }()
_, err = fd1.Write([]byte("/x/\n#include " + filepath.Base(fd2.Name()) + "\n"))
if err != nil {
t.Fatal(err)
}
fd2.Write([]byte("/y/\n"))
_, _ = fd2.Write([]byte("/y/\n"))
pats := New(fs, WithCache(true))
err = pats.Load(fd1.Name())
@@ -289,10 +289,10 @@ func TestCaching(t *testing.T) {
// Modify the include file, expect empty cache. Ensure the timestamp on
// the file changes.
fd2.Write([]byte("/z/\n"))
fd2.Sync()
_, _ = fd2.Write([]byte("/z/\n"))
_ = fd2.Sync()
fakeTime := time.Now().Add(5 * time.Second)
fs.Chtimes(fd2.Name(), fakeTime, fakeTime)
_ = fs.Chtimes(fd2.Name(), fakeTime, fakeTime)
err = pats.Load(fd1.Name())
if err != nil {
@@ -321,10 +321,10 @@ func TestCaching(t *testing.T) {
// Modify the root file, expect cache to be invalidated
fd1.Write([]byte("/a/\n"))
fd1.Sync()
_, _ = fd1.Write([]byte("/a/\n"))
_ = fd1.Sync()
fakeTime = time.Now().Add(5 * time.Second)
fs.Chtimes(fd1.Name(), fakeTime, fakeTime)
_ = fs.Chtimes(fd1.Name(), fakeTime, fakeTime)
err = pats.Load(fd1.Name())
if err != nil {
@@ -434,7 +434,7 @@ flamingo
_, err = fd.Write([]byte(stignore))
defer fd.Close()
defer fs.Remove(fd.Name())
defer func() { _ = fs.Remove(fd.Name()) }()
if err != nil {
b.Fatal(err)
}
@@ -474,7 +474,7 @@ func TestCacheReload(t *testing.T) {
}
defer fd.Close()
defer fs.Remove(fd.Name())
defer func() { _ = fs.Remove(fd.Name()) }()
// Ignore file matches f1 and f2
@@ -515,9 +515,9 @@ func TestCacheReload(t *testing.T) {
if err != nil {
t.Fatal(err)
}
fd.Sync()
_ = fd.Sync()
fakeTime := time.Now().Add(5 * time.Second)
fs.Chtimes(fd.Name(), fakeTime, fakeTime)
_ = fs.Chtimes(fd.Name(), fakeTime, fakeTime)
err = pats.Load(fd.Name())
if err != nil {
@@ -605,7 +605,7 @@ func TestHashOfEmpty(t *testing.T) {
// recalculate the hash. d41d8cd98f00b204e9800998ecf8427e is the md5 of
// nothing.
p1.Load("file/does/not/exist")
_ = p1.Load("file/does/not/exist")
secondHash := p1.Hash()
if firstHash == secondHash {