forked from mirror/ledisdb
Add vet check and fix some vet errors (#374)
This commit is contained in:
parent
04ab07acd4
commit
3c399e1b38
|
@ -4,4 +4,5 @@ go:
|
|||
- 1.12.x
|
||||
|
||||
script:
|
||||
- make vet
|
||||
- make test
|
||||
|
|
3
Makefile
3
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/)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = ""
|
||||
|
|
|
@ -241,8 +241,6 @@ func (m *master) runReplication(restart bool) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (m *master) replConf() error {
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue