Skip to content

Commit 066e2d4

Browse files
committed
Fix support for Go < 1.21
Technically I'm fixing it at the same time that I'm removing the tests in the pipeline that would have caught this. Version support lower than the last 3 minor versions is definitely not a priority, and only something I'm fixing here because it's absolutely trivial.
1 parent 767ccd8 commit 066e2d4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
- ubuntu-latest
1919
- windows-latest
2020
go-version:
21-
- '1.20'
2221
- '1.21'
2322
- '1.22'
23+
- '1.23'
2424
runs-on: ${{ matrix.os }}
2525
steps:
2626
- uses: actions/checkout@v3
@@ -43,7 +43,7 @@ jobs:
4343
- name: Set up Go
4444
uses: actions/setup-go@v4
4545
with:
46-
go-version: '1.22'
46+
go-version: '1.23'
4747
- name: Lint
4848
uses: golangci/golangci-lint-action@v3
4949
with:

internal/jsondiff/jsondiff.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"encoding/json"
77
"fmt"
88
"reflect"
9-
"slices"
9+
"sort"
1010
"strconv"
1111
"strings"
1212
)
@@ -149,7 +149,7 @@ func (d *differ) diffMaps(got, want map[string]any) {
149149
for k := range keys {
150150
sortedKeys = append(sortedKeys, k)
151151
}
152-
slices.Sort(sortedKeys)
152+
sort.Strings(sortedKeys)
153153

154154
first := true
155155
for _, k := range sortedKeys {
@@ -300,7 +300,7 @@ func (d *differ) writeMap(m map[string]any) {
300300
for k := range m {
301301
keys = append(keys, k)
302302
}
303-
slices.Sort(keys)
303+
sort.Strings(keys)
304304

305305
first := true
306306
for _, k := range keys {

0 commit comments

Comments
 (0)