diff --git a/.golangci.yml b/.golangci.yml index e05a1c9..559054e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -27,6 +27,8 @@ linters: - depguard - typecheck - misspell + - bodyclose + - noctx linters-settings: gofmt: diff --git a/Makefile b/Makefile index f7630e3..5644f4f 100644 --- a/Makefile +++ b/Makefile @@ -15,11 +15,12 @@ race: go test -race ./mdbx ./exp/mdbxpool lint: - ./build/bin/golangci-lint run --new-from-rev=$(MASTER_COMMIT) ./... + ./build/bin/golangci-lint run ./... +#//--new-from-rev=$(MASTER_COMMIT) ./... lintci-deps: rm -f ./build/bin/golangci-lint - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.55.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.59.1 clean: cd mdbxdist && make clean diff --git a/go.mod b/go.mod index 8ccd344..ab2cb53 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module github.com/erigontech/mdbx-go -go 1.15 +go 1.20 require github.com/ianlancetaylor/cgosymbolizer v0.0.0-20240503222823-736c933a666d diff --git a/mdbx/cursor_test.go b/mdbx/cursor_test.go index f85733a..a05331f 100644 --- a/mdbx/cursor_test.go +++ b/mdbx/cursor_test.go @@ -790,7 +790,7 @@ func TestDupCursor_EmptyKeyValues1(t *testing.T) { if !bytes.Equal(v, []byte{}) { panic(fmt.Sprintf("%x", v)) } - k, v, err = cur.Get([]byte{}, nil, Set) + k, _, err = cur.Get([]byte{}, nil, Set) if err == nil { panic("expected 'not found' error") } @@ -865,7 +865,7 @@ func TestDupCursor_EmptyKeyValues2(t *testing.T) { if !bytes.Equal(v, []byte{}) { panic(fmt.Sprintf("%x", v)) } - k, v, err = cur.Get([]byte{}, nil, Set) + k, _, err = cur.Get([]byte{}, nil, Set) if err == nil { panic("expected 'not found' error") } @@ -969,7 +969,7 @@ func TestDupCursor_EmptyKeyValues3(t *testing.T) { if !bytes.Equal(v, []byte{}) { panic(fmt.Sprintf("%x", v)) } - k, v, err = cur.Get([]byte{}, nil, Set) + k, _, err = cur.Get([]byte{}, nil, Set) if err == nil { panic("expected 'not found' error") } @@ -1082,7 +1082,7 @@ func TestDupCursor_EmptyKeyValues(t *testing.T) { if !bytes.Equal(v, []byte{}) { panic(fmt.Sprintf("%x", v)) } - k, v, err = cur.Get([]byte{}, nil, Set) + k, _, err = cur.Get([]byte{}, nil, Set) if err == nil { panic("expected 'not found' error") } diff --git a/mdbx/env.go b/mdbx/env.go index 00296d9..b0d1477 100644 --- a/mdbx/env.go +++ b/mdbx/env.go @@ -287,7 +287,7 @@ type Stat struct { LeafPages uint64 // Number of leaf pages OverflowPages uint64 // Number of overflow pages Entries uint64 // Number of data items - LastTxId uint64 // Transaction ID of commited last modification + LastTxId uint64 // Transaction ID of committed last modification } // Stat returns statistics about the environment. diff --git a/mdbx/error.go b/mdbx/error.go index 3a3eba6..9932bf4 100644 --- a/mdbx/error.go +++ b/mdbx/error.go @@ -40,7 +40,7 @@ func (err *OpError) Error() string { // lmdb.IsErrnoFn(err, os.IsPermission) type Errno C.int -// The most common error codes do not need to be handled explicity. Errors can +// The most common error codes do not need to be handled explicitly. Errors can // be checked through helper functions IsNotFound, IsMapFull, etc, Otherwise // they should be checked using the IsErrno function instead of direct // comparison because they will typically be wrapped with an OpError. diff --git a/mdbx/mdbx.go b/mdbx/mdbx.go index 83cd918..43eba4d 100644 --- a/mdbx/mdbx.go +++ b/mdbx/mdbx.go @@ -109,7 +109,7 @@ they fail get garbage collected. Write transactions (those created without the Readonly flag) must be created in a goroutine that has been locked to its thread by calling the function -runtime.LockOSThread. Futhermore, all methods on such transactions must be +runtime.LockOSThread. Furthermore, all methods on such transactions must be called from the goroutine which created them. This is a fundamental limitation of LMDB even when using the NoTLS flag (which the package always uses). The Env.Update method assists the programmer by calling runtime.LockOSThread