mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Fix linter issues: staticcheck (covered by megacheck, along with gosimple and unused)
This commit is contained in:
parent
e9523063b5
commit
990780bd93
6 changed files with 18 additions and 9 deletions
3
Makefile
3
Makefile
|
|
@ -116,16 +116,15 @@ gometalinter: require-gometalinter
|
|||
--enable=gochecknoinits \
|
||||
--enable=gofmt \
|
||||
--enable=goimports \
|
||||
--enable=gosimple \
|
||||
--enable=gotype \
|
||||
--enable=gotypex \
|
||||
--enable=ineffassign \
|
||||
--enable=interfacer \
|
||||
--enable=maligned \
|
||||
--enable=megacheck \
|
||||
--enable=misspell \
|
||||
--enable=nakedret \
|
||||
--enable=unparam \
|
||||
--enable=unused \
|
||||
--enable=vet \
|
||||
--exclude "^internal/.*\.pb\.go" \
|
||||
--exclude "^pql/pql.peg.go" \
|
||||
|
|
|
|||
11
attr_test.go
11
attr_test.go
|
|
@ -164,18 +164,25 @@ func BenchmarkAttrStore_Duplicate(b *testing.B) {
|
|||
// Update attributes with an existing subset.
|
||||
cpuN := runtime.GOMAXPROCS(0)
|
||||
var wg sync.WaitGroup
|
||||
errchan := make(chan error)
|
||||
for i := 0; i < cpuN; i++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for j := 0; j < b.N/cpuN; j++ {
|
||||
if err := s.SetAttrs(uint64(j%n), map[string]interface{}{"A": int64(100), "B": "foo", "D": 100.2}); err != nil {
|
||||
b.Fatal(err)
|
||||
errchan <- err
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
go func() {
|
||||
wg.Wait()
|
||||
close(errchan)
|
||||
}()
|
||||
if err := <-errchan; err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// MustOpenAttrStore returns a new, opened attribute store at a temporary path. Panic on error.
|
||||
|
|
|
|||
|
|
@ -128,12 +128,12 @@ func TestClient_MultiNode(t *testing.T) {
|
|||
Remote: false,
|
||||
}
|
||||
|
||||
result, err := client[0].Query(context.Background(), "i", queryRequest)
|
||||
_, err = client[0].Query(context.Background(), "i", queryRequest)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
result, err = client[0].Query(context.Background(), "i", queryRequest)
|
||||
result, err := client[0].Query(context.Background(), "i", queryRequest)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ func (c *Cache) Get(key Key) (value interface{}, ok bool) {
|
|||
}
|
||||
|
||||
// remove removes the provided key from the cache.
|
||||
func (c *Cache) remove(key Key) { // nolint: unused
|
||||
func (c *Cache) remove(key Key) { // nolint: megacheck
|
||||
if c.cache == nil {
|
||||
return
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ func (c *Cache) Len() int {
|
|||
}
|
||||
|
||||
// clear purges all stored items from the cache.
|
||||
func (c *Cache) clear() { // nolint: unused
|
||||
func (c *Cache) clear() { // nolint: megacheck
|
||||
if c.OnEvicted != nil {
|
||||
for _, e := range c.cache {
|
||||
kv := e.Value.(*entry)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ SetBit(Union(Zitmap(row==4), Intersect(Qitmap(blah>4), Ritmap(field="http://zoo9
|
|||
t.Fatalf("Failed, got: %s", q)
|
||||
}
|
||||
|
||||
q, err = ParseString("C(a=falsen0)")
|
||||
_, err = ParseString("C(a=falsen0)")
|
||||
if err != nil {
|
||||
t.Fatalf("falsen0 should have been parsed as a string")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ func TestDuration(t *testing.T) {
|
|||
}
|
||||
|
||||
err = d.UnmarshalText([]byte("3m2s"))
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
v, _ = d.MarshalText()
|
||||
if !reflect.DeepEqual(b, v) {
|
||||
t.Fatalf("Unexpected marshalled value %v", v)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue