all: Revert the underscore sillyness

This commit is contained in:
Jakob Borg
2019-02-02 12:16:27 +01:00
parent 9fd270d78e
commit c2ddc83509
70 changed files with 252 additions and 252 deletions

View File

@@ -116,7 +116,7 @@ func Validate(buf, hash []byte, weakHash uint32) bool {
return true
}
// Copy error or mismatch, go to next algo.
_, _ = rd.Seek(0, io.SeekStart)
rd.Seek(0, io.SeekStart)
}
if len(hash) > 0 {

View File

@@ -112,10 +112,10 @@ func TestAdler32Variants(t *testing.T) {
hf2 := rollingAdler32.New()
checkFn := func(data []byte) bool {
_, _ = hf1.Write(data)
hf1.Write(data)
sum1 := hf1.Sum32()
_, _ = hf2.Write(data)
hf2.Write(data)
sum2 := hf2.Sum32()
hf1.Reset()
@@ -127,7 +127,7 @@ func TestAdler32Variants(t *testing.T) {
// protocol block sized data
data := make([]byte, protocol.MinBlockSize)
for i := 0; i < 5; i++ {
_, _ = rand.Read(data)
rand.Read(data)
if !checkFn(data) {
t.Errorf("Hash mismatch on block sized data")
}
@@ -145,13 +145,13 @@ func TestAdler32Variants(t *testing.T) {
windowSize := 128
hf3 := rollingAdler32.New()
_, _ = hf3.Write(data[:windowSize])
hf3.Write(data[:windowSize])
for i := windowSize; i < len(data); i++ {
if i%windowSize == 0 {
// let the reference function catch up
hf2.Reset()
_, _ = hf2.Write(data[i-windowSize : i])
hf2.Write(data[i-windowSize : i])
// verify that they are in sync with the rolling function
sum2 := hf2.Sum32()

View File

@@ -108,10 +108,10 @@ func (w *walker) walk(ctx context.Context) chan ScanResult {
go func() {
hashFiles := w.walkAndHashFiles(ctx, toHashChan, finishedChan)
if len(w.Subs) == 0 {
_ = w.Filesystem.Walk(".", hashFiles)
w.Filesystem.Walk(".", hashFiles)
} else {
for _, sub := range w.Subs {
_ = w.Filesystem.Walk(sub, hashFiles)
w.Filesystem.Walk(sub, hashFiles)
}
}
close(toHashChan)
@@ -223,7 +223,7 @@ func (w *walker) walkAndHashFiles(ctx context.Context, toHashChan chan<- protoco
if fs.IsTemporary(path) {
l.Debugln("temporary:", path, "err:", err)
if err == nil && info.IsRegular() && info.ModTime().Add(w.TempLifetime).Before(now) {
_ = w.Filesystem.Remove(path)
w.Filesystem.Remove(path)
l.Debugln("removing temporary:", path, info.ModTime())
}
return nil

View File

@@ -216,7 +216,7 @@ func TestNormalization(t *testing.T) {
if fd, err := testFs.OpenFile(filepath.Join("normalization", s1, s2), os.O_CREATE|os.O_EXCL, 0644); err != nil {
t.Fatal(err)
} else {
_, _ = fd.Write([]byte("test"))
fd.Write([]byte("test"))
fd.Close()
}
}
@@ -257,7 +257,7 @@ func TestIssue1507(t *testing.T) {
f := make(chan ScanResult, 100)
fn := w.walkAndHashFiles(context.TODO(), h, f)
_ = fn("", nil, protocol.ErrClosed)
fn("", nil, protocol.ErrClosed)
}
func TestWalkSymlinkUnix(t *testing.T) {
@@ -268,9 +268,9 @@ func TestWalkSymlinkUnix(t *testing.T) {
// Create a folder with a symlink in it
os.RemoveAll("_symlinks")
_ = os.Mkdir("_symlinks", 0755)
os.Mkdir("_symlinks", 0755)
defer os.RemoveAll("_symlinks")
_ = os.Symlink("../testdata", "_symlinks/link")
os.Symlink("../testdata", "_symlinks/link")
fs := fs.NewFilesystem(fs.FilesystemTypeBasic, "_symlinks")
for _, path := range []string{".", "link"} {
@@ -298,7 +298,7 @@ func TestWalkSymlinkWindows(t *testing.T) {
// Create a folder with a symlink in it
name := "_symlinks-win"
os.RemoveAll(name)
_ = os.Mkdir(name, 0755)
os.Mkdir(name, 0755)
defer os.RemoveAll(name)
fs := fs.NewFilesystem(fs.FilesystemTypeBasic, name)
if err := osutil.DebugSymlinkForTestsOnly("../testdata", "_symlinks/link"); err != nil {