Skip to content

Commit 54c5e78

Browse files
committed
fix: flacky tests on Windows and Darwin
1 parent 33ea805 commit 54c5e78

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

internal/cache/cache.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (c *Cache) get(id ActionID) (Entry, error) {
158158
defer f.Close()
159159
entry := make([]byte, entrySize+1) // +1 to detect whether f is too long
160160
if n, readErr := io.ReadFull(f, entry); n != entrySize || readErr != io.ErrUnexpectedEOF {
161-
return failed(fmt.Errorf("read %d/%d bytes from %s with error %s", n, entrySize, fileName, readErr))
161+
return failed(fmt.Errorf("read %d/%d bytes from %s with error %w", n, entrySize, fileName, readErr))
162162
}
163163
if entry[0] != 'v' || entry[1] != '1' || entry[2] != ' ' || entry[3+hexSize] != ' ' || entry[3+hexSize+1+hexSize] != ' ' || entry[3+hexSize+1+hexSize+1+20] != ' ' || entry[entrySize-1] != '\n' {
164164
return failed(fmt.Errorf("bad data in %s", fileName))

pkg/golinters/goanalysis/runner_action.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package goanalysis
33
import (
44
"fmt"
55
"go/types"
6+
"io"
67
"reflect"
78
"runtime/debug"
89
"time"
@@ -331,7 +332,7 @@ func (act *action) loadPersistedFacts() bool {
331332
var facts []Fact
332333
key := fmt.Sprintf("%s/facts", act.a.Name)
333334
if err := act.r.pkgCache.Get(act.pkg, pkgcache.HashModeNeedAllDeps, key, &facts); err != nil {
334-
if err != pkgcache.ErrMissing {
335+
if !errors.Is(err, pkgcache.ErrMissing) && !errors.Is(err, io.EOF) {
335336
act.r.log.Warnf("Failed to get persisted facts: %s", err)
336337
}
337338

0 commit comments

Comments
 (0)