Skip to content

Commit

Permalink
revert(goleveldb): remove goleveldb flag (#204)
Browse files Browse the repository at this point in the history
* revert(goleveldb): remove `goleveldb` flag

because it's too disruptive for existing users

* appease linter
  • Loading branch information
melekes authored Sep 23, 2024
1 parent 9b8cce9 commit 6c14293
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@ linters-settings:
- $gostd
- github.com/cockroachdb/pebble
- github.com/google/btree
- github.com/syndtr/goleveldb/leveldb
test:
files:
- "$test"
allow:
- $gostd
- github.com/stretchr/testify
- github.com/syndtr/goleveldb/leveldb/opt

revive:
enable-all-rules: true
Expand Down
10 changes: 2 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,9 @@ all: lint test
#? test: Run pure Go tests only
test:
@echo "--> Running go test"
@go test $(PACKAGES) -tags goleveldb,boltdb,badgerdb
@go test $(PACKAGES) -tags boltdb,badgerdb
.PHONY: test

#? test-goleveldb: Run goleveldb tests
test-goleveldb:
@echo "--> Running go test"
@go test $(PACKAGES) -tags goleveldb -v
.PHONY: test-goleveldb

#? test-cleveldb: Run cleveldb tests
test-cleveldb:
@echo "--> Running go test"
Expand Down Expand Up @@ -62,7 +56,7 @@ test-all-with-coverage:
-race \
-coverprofile=coverage.txt \
-covermode=atomic \
-tags=goleveldb,cleveldb,boltdb,rocksdb,badgerdb\
-tags=cleveldb,boltdb,rocksdb,badgerdb\
-v
.PHONY: test-all-with-coverage

Expand Down
10 changes: 0 additions & 10 deletions UPGRADING.md

This file was deleted.

1 change: 0 additions & 1 deletion db.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const (
// - UNMAINTANED
// - pure go
// - stable
// - use goleveldb build tag (go build -tags goleveldb)
GoLevelDBBackend BackendType = "goleveldb"
// CLevelDBBackend represents cleveldb (uses levigo wrapper)
// - DEPRECATED
Expand Down
12 changes: 3 additions & 9 deletions goleveldb.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build goleveldb
// +build goleveldb

package db

import (
Expand Down Expand Up @@ -31,7 +28,7 @@ func NewGoLevelDB(name string, dir string) (*GoLevelDB, error) {
}

func NewGoLevelDBWithOpts(name string, dir string, o *opt.Options) (*GoLevelDB, error) {
dbPath := filepath.Join(dir, name+".db") //nolint:goconst
dbPath := filepath.Join(dir, name+".db")
db, err := leveldb.OpenFile(dbPath, o)
if err != nil {
return nil, err
Expand Down Expand Up @@ -129,10 +126,7 @@ func (db *GoLevelDB) DB() *leveldb.DB {

// Close implements DB.
func (db *GoLevelDB) Close() error {
if err := db.db.Close(); err != nil {
return err
}
return nil
return db.db.Close()
}

// Print implements DB.
Expand Down Expand Up @@ -198,7 +192,7 @@ func (db *GoLevelDB) ReverseIterator(start, end []byte) (Iterator, error) {
return newGoLevelDBIterator(itr, start, end, true), nil
}

// Compact range
// Compact range.
func (db *GoLevelDB) Compact(start, end []byte) error {
return db.db.CompactRange(util.Range{Start: start, Limit: end})
}
3 changes: 0 additions & 3 deletions goleveldb_batch.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build goleveldb
// +build goleveldb

package db

import (
Expand Down
3 changes: 0 additions & 3 deletions goleveldb_iterator.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build goleveldb
// +build goleveldb

package db

import (
Expand Down
3 changes: 0 additions & 3 deletions goleveldb_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build goleveldb
// +build goleveldb

package db

import (
Expand Down

0 comments on commit 6c14293

Please sign in to comment.