Skip to content

Commit 4652363

Browse files
committed
fix: Replace wk8/go-ordered-map with pb33f/ordered-map
Matches upstream invopop/jsonschema v0.14.0, which switched to the API-compatible pb33f/ordered-map/v2 fork. Required so consumers pinning invopop v0.14.0 (e.g. anthropic-sdk-go v1.52.0) build against this fork without an OrderedMap type mismatch. The go.mod directive moves to go 1.24 (pb33f requirement), so CI is updated too: track the Go version via go-version-file, pin golangci-lint v1.64.8 (last v1 line, go 1.24 compatible) with the existing v1 config, and run Lint on pushes to cqmain (the default branch).
1 parent 8dfb902 commit 4652363

10 files changed

Lines changed: 60 additions & 51 deletions

File tree

.github/workflows/lint.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,29 @@ on:
44
tags:
55
- v*
66
branches:
7+
- cqmain
78
- main
89
pull_request:
10+
11+
permissions:
12+
contents: read
13+
914
jobs:
1015
lint:
1116
name: golangci-lint
1217
runs-on: ubuntu-latest
1318

1419
steps:
15-
- uses: actions/setup-go@v4
20+
- name: Check out code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Go
24+
uses: actions/setup-go@v5
1625
with:
17-
go-version: "1.18"
26+
go-version-file: "go.mod"
1827
cache: false
1928

20-
- name: Check out code
21-
uses: actions/checkout@v3
22-
2329
- name: Lint
24-
uses: golangci/golangci-lint-action@v3
30+
uses: golangci/golangci-lint-action@v6
2531
with:
26-
version: v1.55
32+
version: v1.64.8

.github/workflows/release.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
#paths-ignore:
1212
# - "docs/**"
1313

14+
permissions:
15+
contents: write
16+
1417
jobs:
1518
tag-build-publish:
1619
name: Tag

.github/workflows/test.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
name: Test Go
22
on: [push, pull_request]
3+
4+
permissions:
5+
contents: read
6+
37
jobs:
48
lint-test-build:
59
name: Lint, Test
610
runs-on: ubuntu-latest
711

812
steps:
13+
- name: Check out code
14+
uses: actions/checkout@v4
15+
916
- name: Set up Go
10-
uses: actions/setup-go@v1
17+
uses: actions/setup-go@v5
1118
with:
12-
go-version: "1.18"
19+
go-version-file: "go.mod"
1320
id: go
1421

15-
- name: Check out code
16-
uses: actions/checkout@v2
17-
1822
- name: Install Dependencies
1923
env:
2024
GOPROXY: https://proxy.golang.org,direct

.golangci.yml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
run:
22
tests: true
3-
max-same-issues: 50
4-
skip-dirs:
5-
- resources
6-
- old
7-
skip-files:
8-
- cmd/protopkg/main.go
93

104
output:
115
print-issued-lines: false
@@ -19,20 +13,18 @@ linters:
1913
- unconvert
2014
- goimports
2115
- unused
22-
- vetshadow
16+
- govet
2317
- nakedret
2418
- errcheck
2519
- revive
2620
- ineffassign
27-
- goconst
28-
- vet
2921
- unparam
3022
- gofmt
3123

3224
linters-settings:
33-
vet:
34-
check-shadowing: true
35-
use-installed-packages: true
25+
govet:
26+
enable:
27+
- shadow
3628
dupl:
3729
threshold: 100
3830
goconst:
@@ -51,9 +43,21 @@ linters-settings:
5143
replacement: 'a[b:]'
5244

5345
issues:
54-
max-per-linter: 0
55-
max-same: 0
46+
max-issues-per-linter: 0
47+
max-same-issues: 0
5648
exclude-use-default: false
49+
exclude-dirs:
50+
- resources
51+
- old
52+
exclude-files:
53+
- cmd/protopkg/main.go
54+
exclude-rules:
55+
# Legacy comment extraction relies on go/ast and go/doc APIs that are
56+
# deprecated but still functional; migrating to go/types is out of scope.
57+
- path: comment_extractor\.go
58+
linters:
59+
- staticcheck
60+
text: "SA1019"
5761
exclude:
5862
# Captured by errcheck.
5963
- "^(G104|G204):"

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
module github.com/invopop/jsonschema
22

3-
go 1.18
3+
go 1.24
44

55
require (
6-
github.com/stretchr/testify v1.8.1
7-
github.com/wk8/go-ordered-map/v2 v2.1.8
6+
github.com/pb33f/ordered-map/v2 v2.3.1
7+
github.com/stretchr/testify v1.11.1
88
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
99
)
1010

1111
require (
1212
github.com/bahlo/generic-list-go v0.2.0 // indirect
13-
github.com/buger/jsonparser v1.1.1 // indirect
13+
github.com/buger/jsonparser v1.1.2 // indirect
1414
github.com/davecgh/go-spew v1.1.1 // indirect
15-
github.com/mailru/easyjson v0.7.7 // indirect
1615
github.com/pmezard/go-difflib v1.0.0 // indirect
16+
go.yaml.in/yaml/v4 v4.0.0-rc.2 // indirect
1717
gopkg.in/yaml.v3 v3.0.1 // indirect
1818
)

go.sum

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
11
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
22
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
3-
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
4-
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
5-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/buger/jsonparser v1.1.2 h1:frqHqw7otoVbk5M8LlE/L7HTnIq2v9RX6EJ48i9AxJk=
4+
github.com/buger/jsonparser v1.1.2/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
65
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
76
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8-
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
9-
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
10-
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
7+
github.com/pb33f/ordered-map/v2 v2.3.1 h1:5319HDO0aw4DA4gzi+zv4FXU9UlSs3xGZ40wcP1nBjY=
8+
github.com/pb33f/ordered-map/v2 v2.3.1/go.mod h1:qxFQgd0PkVUtOMCkTapqotNgzRhMPL7VvaHKbd1HnmQ=
119
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1210
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
13-
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
14-
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
15-
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
16-
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
17-
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
18-
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
19-
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
20-
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
21-
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
11+
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
12+
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
13+
go.yaml.in/yaml/v4 v4.0.0-rc.2 h1:/FrI8D64VSr4HtGIlUtlFMGsm7H7pWTbj6vOLVZcA6s=
14+
go.yaml.in/yaml/v4 v4.0.0-rc.2/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
2215
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
2316
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
2417
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2518
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
26-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2719
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2820
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

reflect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ func (t *Schema) MarshalJSON() ([]byte, error) {
11681168
if err != nil {
11691169
return nil, err
11701170
}
1171-
if t.Extras == nil || len(t.Extras) == 0 {
1171+
if len(t.Extras) == 0 {
11721172
return b, nil
11731173
}
11741174
m, err := json.Marshal(t.Extras)

reflect_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ func TestSchemaGeneration(t *testing.T) {
454454
{&MinValue{}, &Reflector{}, "fixtures/schema_with_minimum.json"},
455455
{&TestNullable{}, &Reflector{}, "fixtures/nullable.json"},
456456
{&GrandfatherType{}, &Reflector{
457-
AdditionalFields: func(r reflect.Type) []reflect.StructField {
457+
AdditionalFields: func(_ reflect.Type) []reflect.StructField {
458458
return []reflect.StructField{
459459
{
460460
Name: "Addr",

schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"encoding/json"
55
"reflect"
66

7-
orderedmap "github.com/wk8/go-ordered-map/v2"
7+
orderedmap "github.com/pb33f/ordered-map/v2"
88
)
99

1010
// Version is the JSON Schema version.

utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"regexp"
55
"strings"
66

7-
orderedmap "github.com/wk8/go-ordered-map/v2"
7+
orderedmap "github.com/pb33f/ordered-map/v2"
88
)
99

1010
var matchFirstCap = regexp.MustCompile("(.)([A-Z][a-z]+)")

0 commit comments

Comments
 (0)