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

github: bump golangci-lint and fix linter issues #325

Merged
merged 2 commits into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: golangci/golangci-lint-action@v2.1.0
- uses: golangci/golangci-lint-action@v2.3.0
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.30
version: v1.32
args: --timeout 10m
github-token: ${{ secrets.github_token }}
4 changes: 2 additions & 2 deletions basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func TestUnit(t *testing.T) {
tree.root = origNode
}

//////// Test Set cases:
// Test Set cases:

// Case 1:
t1 := T(N(4, 20))
Expand All @@ -173,7 +173,7 @@ func TestUnit(t *testing.T) {
expectSet(t4, 8, "(((1 2) (5 6)) ((7 8) 9))", 5)
expectSet(t4, 10, "(((1 2) (5 6)) (7 (9 10)))", 5)

//////// Test Remove cases:
// Test Remove cases:

t10 := T(N(N(1, 2), 3))

Expand Down
2 changes: 1 addition & 1 deletion common/bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (bz HexBytes) MarshalJSON() ([]byte, error) {
s := strings.ToUpper(hex.EncodeToString(bz))
jbz := make([]byte, len(s)+2)
jbz[0] = '"'
copy(jbz[1:], []byte(s))
copy(jbz[1:], s)
jbz[len(jbz)-1] = '"'
return jbz, nil
}
Expand Down
2 changes: 1 addition & 1 deletion nodedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ func (ndb *nodeDB) decrVersionReaders(version int64) {
}
}

////////////////// Utility and test functions /////////////////////////////////
// Utility and test functions

func (ndb *nodeDB) leafNodes() []*Node {
leaves := []*Node{}
Expand Down
2 changes: 0 additions & 2 deletions proof_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,6 @@ func RangeProofFromProto(pbProof *iavlproto.RangeProof) (RangeProof, error) {
return proof, nil
}

///////////////////////////////////////////////////////////////////////////////

// keyStart is inclusive and keyEnd is exclusive.
// If keyStart or keyEnd don't exist, the leaf before keyStart
// or after keyEnd will also be included, but not be included in values.
Expand Down
12 changes: 6 additions & 6 deletions tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1146,9 +1146,9 @@ func TestVersionedTreeProofs(t *testing.T) {
}

func TestOrphans(t *testing.T) {
//If you create a sequence of saved versions
//Then randomly delete versions other than the first and last until only those two remain
//Any remaining orphan nodes should either have fromVersion == firstVersion || toVersion == lastVersion
// If you create a sequence of saved versions
// Then randomly delete versions other than the first and last until only those two remain
// Any remaining orphan nodes should either have fromVersion == firstVersion || toVersion == lastVersion
require := require.New(t)
tree, err := NewMutableTree(db.NewMemDB(), 100)
require.NoError(err)
Expand Down Expand Up @@ -1430,14 +1430,14 @@ func TestLoadVersionForOverwriting(t *testing.T) {
_, _, err = tree.SaveVersion()
require.NoError(err, "SaveVersion should not fail, write the same value")

//The tree version now is 52 which is equal to latest version.
//Now any key value can be written into the tree
// The tree version now is 52 which is equal to latest version.
// Now any key value can be written into the tree
tree.Set([]byte("key any value"), []byte("value any value"))
_, _, err = tree.SaveVersion()
require.NoError(err, "SaveVersion should not fail.")
}

//////////////////////////// BENCHMARKS ///////////////////////////////////////
// BENCHMARKS

func BenchmarkTreeLoadAndDelete(b *testing.B) {
numVersions := 5000
Expand Down