Skip to content

Commit e25dad7

Browse files
authored
Merge pull request #25 from nspcc-dev/go-1.25
Go 1.25
2 parents f8941a1 + 491b46e commit e25dad7

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

.github/workflows/run_tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Set up Go
2828
uses: actions/setup-go@v5
2929
with:
30-
go-version: 1.25
30+
go-version: 1.26
3131

3232
- name: Write coverage profile
3333
run: go test -v ./... -coverprofile=./coverage.txt -covermode=atomic
@@ -44,17 +44,17 @@ jobs:
4444
runs-on: ${{ matrix.os }}
4545
strategy:
4646
matrix:
47-
go_versions: [ '1.24', '1.25' ]
47+
go_versions: [ '1.25', '1.26' ]
4848
os: [ubuntu-latest, windows-latest, macos-latest]
4949
exclude:
5050
# Only latest Go version for Windows and MacOS.
5151
- os: windows-latest
52-
go_versions: '1.24'
52+
go_versions: '1.25'
5353
- os: macos-latest
54-
go_versions: '1.24'
54+
go_versions: '1.25'
5555
# Exclude latest Go version for Ubuntu as Coverage uses it.
5656
- os: ubuntu-latest
57-
go_versions: '1.25'
57+
go_versions: '1.26'
5858
fail-fast: false
5959
steps:
6060
- uses: actions/checkout@v4

decode.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,11 @@ func (d *decodeState) indirect(v reflect.Value, decodingNull bool) (Unmarshaler,
461461
v.Set(reflect.New(v.Type().Elem()))
462462
}
463463
if v.Type().NumMethod() > 0 {
464-
if u, ok := v.Interface().(Unmarshaler); ok {
464+
if u, ok := reflect.TypeAssert[Unmarshaler](v); ok {
465465
return u, nil, reflect.Value{}
466466
}
467467
if !decodingNull {
468-
if u, ok := v.Interface().(encoding.TextUnmarshaler); ok {
468+
if u, ok := reflect.TypeAssert[encoding.TextUnmarshaler](v); ok {
469469
return nil, u, reflect.Value{}
470470
}
471471
}

decode_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1890,7 +1890,7 @@ func TestUnmarshalSyntax(t *testing.T) {
18901890
type unexportedFields struct {
18911891
Name string
18921892
m map[string]any `json:"-"` //nolint:unused // Not really used, but important for test.
1893-
m2 map[string]any `json:"abcd"` //nolint:unused,govet // Not really used and wrong, but important for test.
1893+
m2 map[string]any `json:"abcd"` //nolint:unused,govet,staticcheck // Not really used and wrong, but important for test.
18941894
}
18951895

18961896
func TestUnmarshalUnexported(t *testing.T) {

encode.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ func marshalerEncoder(e *encodeState, v reflect.Value, opts encOpts) {
445445
e.WriteString("null")
446446
return
447447
}
448-
m, ok := v.Interface().(Marshaler)
448+
m, ok := reflect.TypeAssert[Marshaler](v)
449449
if !ok {
450450
e.WriteString("null")
451451
return
@@ -466,7 +466,7 @@ func addrMarshalerEncoder(e *encodeState, v reflect.Value, _ encOpts) {
466466
e.WriteString("null")
467467
return
468468
}
469-
m := va.Interface().(Marshaler)
469+
m, _ := reflect.TypeAssert[Marshaler](va)
470470
b, err := m.MarshalJSON()
471471
if err == nil {
472472
// copy JSON into buffer, checking validity.
@@ -482,7 +482,7 @@ func textMarshalerEncoder(e *encodeState, v reflect.Value, opts encOpts) {
482482
e.WriteString("null")
483483
return
484484
}
485-
m := v.Interface().(encoding.TextMarshaler)
485+
m, _ := reflect.TypeAssert[encoding.TextMarshaler](v)
486486
b, err := m.MarshalText()
487487
if err != nil {
488488
e.error(&MarshalerError{v.Type(), err})
@@ -496,7 +496,7 @@ func addrTextMarshalerEncoder(e *encodeState, v reflect.Value, opts encOpts) {
496496
e.WriteString("null")
497497
return
498498
}
499-
m := va.Interface().(encoding.TextMarshaler)
499+
m, _ := reflect.TypeAssert[encoding.TextMarshaler](va)
500500
b, err := m.MarshalText()
501501
if err != nil {
502502
e.error(&MarshalerError{v.Type(), err})
@@ -714,7 +714,7 @@ func orderedObjectEncoder(e *encodeState, v reflect.Value, opts encOpts) {
714714
return
715715
}
716716
e.WriteByte('{')
717-
var ov = v.Interface().(OrderedObject)
717+
var ov, _ = reflect.TypeAssert[OrderedObject](v)
718718
for i, o := range ov {
719719
if i > 0 {
720720
e.WriteByte(',')
@@ -885,7 +885,7 @@ func (w *reflectWithString) resolve() error {
885885
w.s = w.v.String()
886886
return nil
887887
}
888-
if tm, ok := w.v.Interface().(encoding.TextMarshaler); ok {
888+
if tm, ok := reflect.TypeAssert[encoding.TextMarshaler](w.v); ok {
889889
buf, err := tm.MarshalText()
890890
w.s = string(buf)
891891
return err

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/nspcc-dev/go-ordered-json
22

3-
go 1.24
3+
go 1.25

tagkey_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type punctuationTag struct {
4545
}
4646

4747
type dashTag struct {
48-
V string `json:"-,"`
48+
V string `json:"-,"` // nolint:staticcheck // The test is written this way
4949
}
5050

5151
type emptyTag struct {

0 commit comments

Comments
 (0)