Go 1.27.1, and the code it can say more simply

Modules declare go 1.27.1 and the build images follow. go fix applied the
modernizers; omitzero is not applied, since it changes what the JSON says.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
2026-09-16 18:44:47 -07:00
co-authored by Claude Opus 5
parent d9880d0d32
commit 250b80a764
2 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
module github.com/luxfi/pool module github.com/luxfi/pool
go 1.26.1 go 1.27.1
+14 -14
View File
@@ -10,7 +10,7 @@ import (
// ByteSlicePool provides optimized byte slice pooling // ByteSlicePool provides optimized byte slice pooling
// Similar to VictoriaMetrics' approach for reducing allocations // Similar to VictoriaMetrics' approach for reducing allocations
var ByteSlicePool = sync.Pool{ var ByteSlicePool = sync.Pool{
New: func() interface{} { New: func() any {
return make([]byte, 0, 1024) return make([]byte, 0, 1024)
}, },
} }
@@ -31,7 +31,7 @@ func PutByteSlice(b []byte) {
// StringPool provides string pooling for common strings // StringPool provides string pooling for common strings
// Uses unsafe conversion to avoid allocations // Uses unsafe conversion to avoid allocations
var StringPool = sync.Pool{ var StringPool = sync.Pool{
New: func() interface{} { New: func() any {
return "" return ""
}, },
} }
@@ -52,18 +52,18 @@ func PutString(s string) {
// InterfaceSlicePool provides pooling for interface slices // InterfaceSlicePool provides pooling for interface slices
// Useful for JSON marshaling/unmarshaling // Useful for JSON marshaling/unmarshaling
var InterfaceSlicePool = sync.Pool{ var InterfaceSlicePool = sync.Pool{
New: func() interface{} { New: func() any {
return make([]interface{}, 0, 16) return make([]any, 0, 16)
}, },
} }
// GetInterfaceSlice gets an interface slice from the pool // GetInterfaceSlice gets an interface slice from the pool
func GetInterfaceSlice() []interface{} { func GetInterfaceSlice() []any {
return InterfaceSlicePool.Get().([]interface{}) return InterfaceSlicePool.Get().([]any)
} }
// PutInterfaceSlice returns an interface slice to the pool // PutInterfaceSlice returns an interface slice to the pool
func PutInterfaceSlice(s []interface{}) { func PutInterfaceSlice(s []any) {
if cap(s) > 1024 { // Don't pool large slices if cap(s) > 1024 { // Don't pool large slices
return return
} }
@@ -73,18 +73,18 @@ func PutInterfaceSlice(s []interface{}) {
// MapPool provides pooling for maps // MapPool provides pooling for maps
// Specialized for common map types // Specialized for common map types
var MapPool = sync.Pool{ var MapPool = sync.Pool{
New: func() interface{} { New: func() any {
return make(map[string]interface{}, 16) return make(map[string]any, 16)
}, },
} }
// GetMap gets a map from the pool // GetMap gets a map from the pool
func GetMap() map[string]interface{} { func GetMap() map[string]any {
return MapPool.Get().(map[string]interface{}) return MapPool.Get().(map[string]any)
} }
// PutMap returns a map to the pool // PutMap returns a map to the pool
func PutMap(m map[string]interface{}) { func PutMap(m map[string]any) {
if len(m) > 1024 { // Don't pool large maps if len(m) > 1024 { // Don't pool large maps
return return
} }
@@ -137,7 +137,7 @@ func (b *FastBuffer) Free() {
// GetFastBuffer gets a FastBuffer from the pool // GetFastBuffer gets a FastBuffer from the pool
var fastBufferPool = sync.Pool{ var fastBufferPool = sync.Pool{
New: func() interface{} { New: func() any {
return NewFastBuffer() return NewFastBuffer()
}, },
} }
@@ -150,4 +150,4 @@ func GetFastBuffer() *FastBuffer {
func PutFastBuffer(b *FastBuffer) { func PutFastBuffer(b *FastBuffer) {
b.Reset() b.Reset()
fastBufferPool.Put(b) fastBufferPool.Put(b)
} }