From ce41d4fba28f989bd49f091babdc309d8e2b5a2c Mon Sep 17 00:00:00 2001 From: "M.V. Hutz" Date: Wed, 15 Apr 2026 22:58:14 -0400 Subject: [PATCH 1/3] feat: add `recvcheck` linter --- .golangci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 1ec3d80..795e81b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -114,6 +114,9 @@ linters: # Reports uses of functions with replacement inside the testing package. - usetesting + # Reports mixed receiver types in structs/interfaces. + - recvcheck + settings: revive: rules: @@ -198,7 +201,7 @@ linters: # warns when initialism, variable or package naming conventions are not followed. - name: var-naming - + misspell: # Correct spellings using locale preferences for US or UK. # Setting locale to US will correct the British spelling of 'colour' to 'color'. -- 2.49.1 From f35583e0798a9a1d442a61055c6714248796c06d Mon Sep 17 00:00:00 2001 From: "M.V. Hutz" Date: Wed, 15 Apr 2026 22:59:31 -0400 Subject: [PATCH 2/3] fix!: removed all 'mixed pointer'-edness --- bucket.go | 6 +++--- table.go | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bucket.go b/bucket.go index 6a4171c..f932374 100644 --- a/bucket.go +++ b/bucket.go @@ -19,11 +19,11 @@ type bucket[K, V any] struct { // location determines where in the bucket a certain key would be placed. If the // capacity is 0, this will panic. -func (b bucket[K, V]) location(key K) uint64 { +func (b *bucket[K, V]) location(key K) uint64 { return b.hash(key) % b.capacity } -func (b bucket[K, V]) get(key K) (value V, found bool) { +func (b *bucket[K, V]) get(key K) (value V, found bool) { if b.capacity == 0 { return } @@ -54,7 +54,7 @@ func (b *bucket[K, V]) resize(capacity uint64) { b.size = 0 } -func (b bucket[K, V]) update(key K, value V) (updated bool) { +func (b *bucket[K, V]) update(key K, value V) (updated bool) { if b.capacity == 0 { return } diff --git a/table.go b/table.go index 8b4967d..ba675fb 100644 --- a/table.go +++ b/table.go @@ -27,12 +27,12 @@ type Table[K, V any] struct { // TotalCapacity returns the number of slots allocated for the [Table]. To get the // number of slots filled, look at [Table.Size]. -func (t Table[K, V]) TotalCapacity() uint64 { +func (t *Table[K, V]) TotalCapacity() uint64 { return t.bucketA.capacity + t.bucketB.capacity } // Size returns how many slots are filled in the [Table]. -func (t Table[K, V]) Size() int { +func (t *Table[K, V]) Size() int { return int(t.bucketA.size + t.bucketB.size) } @@ -40,11 +40,11 @@ func log2(n uint64) (m int) { return max(0, bits.Len64(n)-1) } -func (t Table[K, V]) maxEvictions() int { +func (t *Table[K, V]) maxEvictions() int { return 3 * log2(t.TotalCapacity()) } -func (t Table[K, V]) load() float64 { +func (t *Table[K, V]) load() float64 { // When there are no slots in the table, we still treat the load as 100%. // Every slot in the table is full. if t.TotalCapacity() == 0 { @@ -97,7 +97,7 @@ func (t *Table[K, V]) shrink() error { // Get fetches the value for a key in the [Table]. Matches the comma-ok pattern // of a builtin map; see [Table.Find] for plain indexing. -func (t Table[K, V]) Get(key K) (value V, ok bool) { +func (t *Table[K, V]) Get(key K) (value V, ok bool) { if item, ok := t.bucketA.get(key); ok { return item, true } @@ -111,13 +111,13 @@ func (t Table[K, V]) Get(key K) (value V, ok bool) { // Find fetches the value of a key. Matches direct indexing of a builtin map; // see [Table.Get] for a comma-ok pattern. -func (t Table[K, V]) Find(key K) (value V) { +func (t *Table[K, V]) Find(key K) (value V) { value, _ = t.Get(key) return } // Has returns true if a key has a value in the table. -func (t Table[K, V]) Has(key K) (exists bool) { +func (t *Table[K, V]) Has(key K) (exists bool) { _, exists = t.Get(key) return } @@ -168,7 +168,7 @@ func (t *Table[K, V]) Drop(key K) (err error) { } // Entries returns an unordered sequence of all key-value pairs in the table. -func (t Table[K, V]) Entries() iter.Seq2[K, V] { +func (t *Table[K, V]) Entries() iter.Seq2[K, V] { return func(yield func(K, V) bool) { for _, slot := range t.bucketA.slots { if slot.occupied { @@ -190,7 +190,7 @@ func (t Table[K, V]) Entries() iter.Seq2[K, V] { // String returns the entries of the table as a string in the format: // "table[k1:v1 h2:v2 ...]". -func (t Table[K, V]) String() string { +func (t *Table[K, V]) String() string { var sb strings.Builder sb.WriteString("table[") -- 2.49.1 From 99f55482374f7f28f82c0a148ec285367fe2a982 Mon Sep 17 00:00:00 2001 From: "M.V. Hutz" Date: Wed, 15 Apr 2026 23:24:07 -0400 Subject: [PATCH 3/3] test: bump cicd pipeline -- 2.49.1