Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/fuzzers: fix go vet warning about signature of ReadByte #23380

Merged
merged 1 commit into from
Aug 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions tests/fuzzers/trie/trie-fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func newDataSource(input []byte) *dataSource {
input, bytes.NewReader(input),
}
}
func (ds *dataSource) ReadByte() byte {
func (ds *dataSource) readByte() byte {
if b, err := ds.reader.ReadByte(); err != nil {
return 0
} else {
Expand All @@ -89,22 +89,22 @@ func Generate(input []byte) randTest {
r := newDataSource(input)
genKey := func() []byte {

if len(allKeys) < 2 || r.ReadByte() < 0x0f {
if len(allKeys) < 2 || r.readByte() < 0x0f {
// new key
key := make([]byte, r.ReadByte()%50)
key := make([]byte, r.readByte()%50)
r.Read(key)
allKeys = append(allKeys, key)
return key
}
// use existing key
return allKeys[int(r.ReadByte())%len(allKeys)]
return allKeys[int(r.readByte())%len(allKeys)]
}

var steps randTest

for i := 0; !r.Ended(); i++ {

step := randTestStep{op: int(r.ReadByte()) % opMax}
step := randTestStep{op: int(r.readByte()) % opMax}
switch step.op {
case opUpdate:
step.key = genKey()
Expand Down