Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.22.x, 1.23.x, 1.24.x]
go-version: [1.23.x, 1.24.x, 1.25.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
linters:
strategy:
matrix:
go-version: [1.24.x]
go-version: [1.25.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
Expand All @@ -35,5 +35,5 @@ jobs:
- name: lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.1.6
version: v2.5.0
args: --print-resources-usage --timeout=10m --verbose
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ ci: prepare
if [ `arch` == 'x86_64' ]; then \
sudo apt-get -y -q update; \
sudo apt-get -y -q install build-essential; \
wget -q https://github.com/tinygo-org/tinygo/releases/download/v0.38.0/tinygo_0.38.0_amd64.deb; \
sudo dpkg -i tinygo_0.38.0_amd64.deb; \
wget -q https://github.com/tinygo-org/tinygo/releases/download/v0.39.0/tinygo_0.39.0_amd64.deb; \
sudo dpkg -i tinygo_0.39.0_amd64.deb; \
export PATH=$$PATH:/usr/local/tinygo/bin; \
fi
go test -v ./... ./_generated
8 changes: 2 additions & 6 deletions gen/elem.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gen

import (
"fmt"
"slices"
"strings"
)

Expand Down Expand Up @@ -601,12 +602,7 @@ func (sf *StructField) HasTagPart(pname string) bool {
if len(sf.FieldTagParts) < 2 {
return false
}
for _, p := range sf.FieldTagParts[1:] {
if p == pname {
return true
}
}
return false
return slices.Contains(sf.FieldTagParts[1:], pname)
}

type ShimMode int
Expand Down
2 changes: 1 addition & 1 deletion gen/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (e *encodeGen) Apply(dirs []string) error {
return nil
}

func (e *encodeGen) writeAndCheck(typ string, argfmt string, arg interface{}) {
func (e *encodeGen) writeAndCheck(typ string, argfmt string, arg any) {
if e.ctx.compFloats && typ == "Float64" {
typ = "Float"
}
Expand Down
2 changes: 1 addition & 1 deletion gen/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (m *marshalGen) Execute(p Elem, ctx Context) error {
return m.p.err
}

func (m *marshalGen) rawAppend(typ string, argfmt string, arg interface{}) {
func (m *marshalGen) rawAppend(typ string, argfmt string, arg any) {
if m.ctx.compFloats && typ == "Float64" {
typ = "Float"
}
Expand Down
2 changes: 1 addition & 1 deletion gen/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ func (p *printer) comment(s string) {
p.print("\n// " + s)
}

func (p *printer) printf(format string, args ...interface{}) {
func (p *printer) printf(format string, args ...any) {
if p.err == nil {
_, p.err = fmt.Fprintf(p.w, format, args...)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tinylib/msgp

go 1.22
go 1.23

require (
github.com/philhofer/fwd v1.2.0
Expand Down
4 changes: 2 additions & 2 deletions issue185_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func TestIssue185Overlap(t *testing.T) {
}
}

func loadVars(t *testing.T, tpl *template.Template, tplData interface{}) (vars extractedVars, err error) {
func loadVars(t *testing.T, tpl *template.Template, tplData any) (vars extractedVars, err error) {
tempDir := t.TempDir()

if !debugTemp {
Expand Down Expand Up @@ -218,7 +218,7 @@ func extractVars(file string) (extractedVars, error) {
return vars, nil
}

func goGenerateTpl(cwd, tfile string, tpl *template.Template, tplData interface{}) error {
func goGenerateTpl(cwd, tfile string, tpl *template.Template, tplData any) error {
outf, err := os.OpenFile(tfile, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0o600)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var (
directives = stringArrFlags{}
)

func diagf(f string, args ...interface{}) {
func diagf(f string, args ...any) {
if !*verbose {
return
}
Expand Down
2 changes: 1 addition & 1 deletion msgp/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func HasKey(key string, raw []byte) bool {
return false
}
var field []byte
for i := uint32(0); i < sz; i++ {
for range sz {
field, bts, err = ReadStringZC(bts)
if err != nil {
return false
Expand Down
2 changes: 1 addition & 1 deletion msgp/edit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestReplace(t *testing.T) {
t.Fatal("field not found")
}
var err error
m := make(map[string]interface{})
m := make(map[string]any)
m, _, err = ReadMapStrIntfBytes(raw, m)
if err != nil {
t.Logf("%q", raw)
Expand Down
2 changes: 1 addition & 1 deletion msgp/elsize_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package msgp
var sizes [256]bytespec

func init() {
for i := 0; i < 256; i++ {
for i := range 256 {
sizes[i] = calcBytespec(byte(i))
}
}
Expand Down
4 changes: 2 additions & 2 deletions msgp/elsize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestBytespec(t *testing.T) {
// set up fixed fields

// fixint
for i := mfixint; i < 0x80; i++ {
for i := range uint8(0x80) {
sizes[i] = bytespec{size: 1, extra: constsize, typ: IntType}
}

Expand All @@ -75,7 +75,7 @@ func TestBytespec(t *testing.T) {
}

// compare all values to calcBytespec
for i := 0; i < 256; i++ {
for i := range 256 {
sizeb := sizes[byte(i)]
cb := calcBytespec(byte(i))
if sizeb != cb {
Expand Down
2 changes: 1 addition & 1 deletion msgp/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func Resumable(e error) bool {
//
// ErrShortBytes is not wrapped with any context due to backward compatibility
// issues with the public API.
func WrapError(err error, ctx ...interface{}) error {
func WrapError(err error, ctx ...any) error {
switch e := err.(type) {
case errShort:
return e
Expand Down
2 changes: 1 addition & 1 deletion msgp/errors_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

// ctxString converts the incoming interface{} slice into a single string.
func ctxString(ctx []interface{}) string {
func ctxString(ctx []any) string {
out := ""
for idx, cv := range ctx {
if idx > 0 {
Expand Down
1 change: 0 additions & 1 deletion msgp/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ func TestSimpleQuoteStr(t *testing.T) {
}

for i, tc := range tcaseList {
tc := tc
t.Run(fmt.Sprint(i), func(t *testing.T) {
out := simpleQuoteStr(tc.in)
if out != tc.out {
Expand Down
8 changes: 4 additions & 4 deletions msgp/extension_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestReadWriteExtension(t *testing.T) {
dc := NewReader(&buf)

t.Run("interface", func(t *testing.T) {
for i := 0; i < 25; i++ {
for range 25 {
buf.Reset()
e := randomExt()
en.WriteExtension(&e)
Expand All @@ -34,7 +34,7 @@ func TestReadWriteExtension(t *testing.T) {
})

t.Run("raw", func(t *testing.T) {
for i := 0; i < 25; i++ {
for range 25 {
buf.Reset()
e := randomExt()
en.WriteExtensionRaw(e.Type, e.Data)
Expand Down Expand Up @@ -119,7 +119,7 @@ func TestExtensionRawStackBuffer(t *testing.T) {
func TestReadWriteExtensionBytes(t *testing.T) {
var bts []byte

for i := 0; i < 24; i++ {
for range 24 {
e := randomExt()
bts, _ = AppendExtension(bts[0:0], &e)
_, err := ReadExtensionBytes(bts, &e)
Expand All @@ -134,7 +134,7 @@ func TestAppendAndWriteCompatibility(t *testing.T) {
var buf bytes.Buffer
en := NewWriter(&buf)

for i := 0; i < 24; i++ {
for range 24 {
buf.Reset()
e := randomExt()
bts, _ = AppendExtension(bts[0:0], &e)
Expand Down
4 changes: 2 additions & 2 deletions msgp/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func FuzzReader(f *testing.F) {
runtime.GC()
r.ReadMapKeyPtr()
reset()
r.ReadMapStrIntf(map[string]interface{}{})
r.ReadMapStrIntf(map[string]any{})
reset()
r.ReadNil()
reset()
Expand Down Expand Up @@ -156,7 +156,7 @@ func FuzzReadBytes(f *testing.F) {
ReadJSONNumberBytes(data)
ReadMapHeaderBytes(data)
ReadMapKeyZC(data)
ReadMapStrIntfBytes(data, map[string]interface{}{})
ReadMapStrIntfBytes(data, map[string]any{})
ReadNilBytes(data)
ReadStringBytes(data)
ReadStringAsBytes(data, tmp5[:])
Expand Down
2 changes: 0 additions & 2 deletions msgp/iter.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build go1.23

package msgp

import (
Expand Down
Loading
Loading