diff --git a/.travis.yml b/.travis.yml index 816f4c1..911b641 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,4 +4,5 @@ go: - 1.12.x script: + - make vet - make test diff --git a/Makefile b/Makefile index 6acf096..82dab6a 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,9 @@ build: go build -mod=vendor -o bin/ledis-load -tags '$(GO_BUILD_TAGS)' cmd/ledis-load/* go build -mod=vendor -o bin/ledis-repair -tags '$(GO_BUILD_TAGS)' cmd/ledis-repair/* +vet: + go vet -mod=vendor -tags '$(GO_BUILD_TAGS)' ./... + test: go test -mod=vendor --race -tags '$(GO_BUILD_TAGS)' -timeout 2m $$(go list ./... | grep -v -e /vendor/) diff --git a/cmd/ledis-benchmark/main.go b/cmd/ledis-benchmark/main.go index 06e2b61..8b14ee0 100644 --- a/cmd/ledis-benchmark/main.go +++ b/cmd/ledis-benchmark/main.go @@ -258,12 +258,10 @@ func main() { if *number <= 0 { panic("invalid number") - return } if *clients <= 0 || *number < *clients { panic("invalid client number") - return } loop = *number / *clients diff --git a/config/config.go b/config/config.go index 31652be..cf91de5 100644 --- a/config/config.go +++ b/config/config.go @@ -100,7 +100,7 @@ type TLS struct { type AuthMethod func(c *Config, password string) bool type Config struct { - m sync.RWMutex `toml:"-"` + m *sync.RWMutex `toml:"-"` AuthPassword string `toml:"auth_password"` @@ -179,6 +179,7 @@ func NewConfigWithData(data []byte) (*Config, error) { func NewConfigDefault() *Config { cfg := new(Config) + cfg.m = new(sync.RWMutex) cfg.Addr = DefaultAddr cfg.HttpAddr = "" diff --git a/server/replication.go b/server/replication.go index 911488c..6d3064e 100644 --- a/server/replication.go +++ b/server/replication.go @@ -241,8 +241,6 @@ func (m *master) runReplication(restart bool) { } } } - - return } func (m *master) replConf() error { diff --git a/store/goleveldb/db.go b/store/goleveldb/db.go index 1afc32f..c1c8517 100644 --- a/store/goleveldb/db.go +++ b/store/goleveldb/db.go @@ -195,7 +195,10 @@ func (db *DB) NewSnapshot() (driver.ISnapshot, error) { } func (db *DB) Compact() error { - return db.db.CompactRange(util.Range{nil, nil}) + return db.db.CompactRange(util.Range{ + Start: nil, + Limit: nil, + }) } func init() {