Skip to content

Commit 6fc4b61

Browse files
committed
Merge tag 'v2.9.1' into fxamacker/update-streammode-to-release-v291
2 parents 39888e6 + 63d1c66 commit 6fc4b61

28 files changed

Lines changed: 2999 additions & 2010 deletions

.github/dependabot.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ updates:
44
- package-ecosystem: "github-actions"
55
directory: "/"
66
schedule:
7-
interval: "daily"
7+
interval: "weekly"
8+
day: "friday"
9+
time: "12:00"
10+
timezone: "UTC"
811

912
- package-ecosystem: "gomod"
1013
directory: "/"

.github/workflows/ci-go-cover.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ jobs:
4040
runs-on: ubuntu-latest
4141
steps:
4242
- name: Checkout code
43-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
43+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4444
- name: Install Go
45-
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
45+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
4646
with:
4747
go-version: 1.24
4848
check-latest: true

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ jobs:
3131
strategy:
3232
matrix:
3333
os: [macos-latest, ubuntu-latest, windows-latest]
34-
go-version: ['1.20', 1.21, 1.22, 1.23, 1.24]
34+
go-version: ['1.20', 1.21, 1.22, 1.23, 1.24, 1.25]
3535
steps:
3636
- name: Install Go
37-
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
37+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
3838
with:
3939
go-version: ${{ matrix.go-version }}
4040
check-latest: true
4141

4242
- name: Checkout code
43-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
43+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4444
with:
4545
fetch-depth: 1
4646

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ jobs:
3131

3232
steps:
3333
- name: Checkout repository
34-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3535

3636
# Initializes the CodeQL tools for scanning.
3737
- name: Initialize CodeQL
38-
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
38+
uses: github/codeql-action/init@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1
3939
with:
4040
languages: ${{ matrix.language }}
4141

@@ -44,7 +44,7 @@ jobs:
4444
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
4545
# If this step fails, then you should remove it and run the build manually (see below)
4646
- name: Autobuild
47-
uses: github/codeql-action/autobuild@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
47+
uses: github/codeql-action/autobuild@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1
4848

4949
- name: Perform CodeQL Analysis
50-
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
50+
uses: github/codeql-action/analyze@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1

.github/workflows/govulncheck.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ jobs:
2828
contents: read
2929
steps:
3030
- name: Checkout source
31-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3232
with:
3333
fetch-depth: 1
3434

3535
- name: Install Go and setup env
36-
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
36+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
3737
with:
3838
go-version: 1.23
3939
check-latest: true

.github/workflows/safer-golangci-lint.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ on:
1616
branches: [main, master]
1717

1818
env:
19-
GO_VERSION: '1.22'
20-
GOLINTERS_VERSION: 1.59.1
19+
GO_VERSION: '1.25'
20+
GOLINTERS_VERSION: 2.10.1
2121
GOLINTERS_ARCH: linux-amd64
22-
GOLINTERS_TGZ_DGST: c30696f1292cff8778a495400745f0f9c0406a3f38d8bb12cef48d599f6c7791
22+
GOLINTERS_TGZ_DGST: dfa775874cf0561b404a02a8f4481fc69b28091da95aa697259820d429b09c99
2323
GOLINTERS_TIMEOUT: 15m
2424
OPENSSL_DGST_CMD: openssl dgst -sha256 -r
2525
CURL_CMD: curl --proto =https --tlsv1.2 --location --silent --show-error --fail
@@ -36,12 +36,12 @@ jobs:
3636
contents: read
3737
steps:
3838
- name: Checkout source
39-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4040
with:
4141
fetch-depth: 1
4242

4343
- name: Setup Go
44-
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
44+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
4545
with:
4646
go-version: ${{ env.GO_VERSION }}
4747
check-latest: true

.golangci.yml

Lines changed: 94 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,116 @@
1-
# Do not delete linter settings. Linters like gocritic can be enabled on the command line.
2-
3-
linters-settings:
4-
depguard:
5-
rules:
6-
prevent_unmaintained_packages:
7-
list-mode: strict
8-
files:
9-
- $all
10-
- "!$test"
11-
allow:
12-
- $gostd
13-
- github.com/x448/float16
14-
deny:
15-
- pkg: io/ioutil
16-
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
17-
dupl:
18-
threshold: 100
19-
funlen:
20-
lines: 100
21-
statements: 50
22-
goconst:
23-
ignore-tests: true
24-
min-len: 2
25-
min-occurrences: 3
26-
gocritic:
27-
enabled-tags:
28-
- diagnostic
29-
- experimental
30-
- opinionated
31-
- performance
32-
- style
33-
disabled-checks:
34-
- commentedOutCode
35-
- dupImport # https://github.com/go-critic/go-critic/issues/845
36-
- ifElseChain
37-
- octalLiteral
38-
- paramTypeCombine
39-
- whyNoLint
40-
gofmt:
41-
simplify: false
42-
goimports:
43-
local-prefixes: github.com/fxamacker/cbor
44-
golint:
45-
min-confidence: 0
46-
govet:
47-
check-shadowing: true
48-
lll:
49-
line-length: 140
50-
maligned:
51-
suggest-new: true
52-
misspell:
53-
locale: US
54-
staticcheck:
55-
checks: ["all"]
56-
1+
version: "2"
572
linters:
58-
disable-all: true
3+
default: none
594
enable:
605
- asciicheck
616
- bidichk
627
- depguard
638
- errcheck
64-
- exportloopref
9+
- forbidigo
6510
- goconst
6611
- gocritic
6712
- gocyclo
68-
- gofmt
69-
- goimports
7013
- goprintffuncname
7114
- gosec
72-
- gosimple
7315
- govet
7416
- ineffassign
7517
- misspell
7618
- nilerr
7719
- revive
7820
- staticcheck
79-
- stylecheck
80-
- typecheck
8121
- unconvert
8222
- unused
83-
23+
settings:
24+
depguard:
25+
rules:
26+
prevent_unmaintained_packages:
27+
list-mode: strict
28+
files:
29+
- $all
30+
- '!$test'
31+
allow:
32+
- $gostd
33+
- github.com/x448/float16
34+
deny:
35+
- pkg: io/ioutil
36+
desc: 'replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil'
37+
dupl:
38+
threshold: 100
39+
funlen:
40+
lines: 100
41+
statements: 50
42+
goconst:
43+
min-len: 2
44+
min-occurrences: 3
45+
gocritic:
46+
disabled-checks:
47+
- commentedOutCode
48+
- dupImport
49+
- ifElseChain
50+
- octalLiteral
51+
- paramTypeCombine
52+
- whyNoLint
53+
enabled-tags:
54+
- diagnostic
55+
- experimental
56+
- opinionated
57+
- performance
58+
- style
59+
govet:
60+
enable:
61+
- shadow
62+
lll:
63+
line-length: 140
64+
misspell:
65+
locale: US
66+
staticcheck:
67+
checks:
68+
- all
69+
exclusions:
70+
generated: lax
71+
presets:
72+
- comments
73+
- common-false-positives
74+
- legacy
75+
- std-error-handling
76+
rules:
77+
- path: decode.go
78+
text: string ` overflows ` has (\d+) occurrences, make it a constant
79+
- path: decode.go
80+
text: string ` \(range is \[` has (\d+) occurrences, make it a constant
81+
- path: decode.go
82+
text: string `, ` has (\d+) occurrences, make it a constant
83+
- path: decode.go
84+
text: string ` overflows Go's int64` has (\d+) occurrences, make it a constant
85+
- path: decode.go
86+
text: string `\]\)` has (\d+) occurrences, make it a constant
87+
- path: valid.go
88+
text: string ` for type ` has (\d+) occurrences, make it a constant
89+
- path: valid.go
90+
text: 'string `cbor: ` has (\d+) occurrences, make it a constant'
91+
- linters:
92+
- goconst
93+
path: (.+)_test\.go
94+
paths:
95+
- third_party$
96+
- builtin$
97+
- examples$
8498
issues:
85-
# max-issues-per-linter default is 50. Set to 0 to disable limit.
8699
max-issues-per-linter: 0
87-
# max-same-issues default is 3. Set to 0 to disable limit.
88100
max-same-issues: 0
89-
90-
exclude-rules:
91-
- path: decode.go
92-
text: "string ` overflows ` has (\\d+) occurrences, make it a constant"
93-
- path: decode.go
94-
text: "string ` \\(range is \\[` has (\\d+) occurrences, make it a constant"
95-
- path: decode.go
96-
text: "string `, ` has (\\d+) occurrences, make it a constant"
97-
- path: decode.go
98-
text: "string ` overflows Go's int64` has (\\d+) occurrences, make it a constant"
99-
- path: decode.go
100-
text: "string `\\]\\)` has (\\d+) occurrences, make it a constant"
101-
- path: valid.go
102-
text: "string ` for type ` has (\\d+) occurrences, make it a constant"
103-
- path: valid.go
104-
text: "string `cbor: ` has (\\d+) occurrences, make it a constant"
101+
formatters:
102+
enable:
103+
- gofmt
104+
- goimports
105+
settings:
106+
gofmt:
107+
simplify: false
108+
goimports:
109+
local-prefixes:
110+
- github.com/fxamacker/cbor
111+
exclusions:
112+
generated: lax
113+
paths:
114+
- third_party$
115+
- builtin$
116+
- examples$

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -702,21 +702,20 @@ Default limits may need to be increased for systems handling very large data (e.
702702

703703
## Status
704704

705-
[v2.9.0](https://github.com/fxamacker/cbor/releases/tag/v2.9.0) (Jul 13, 2025) improved interoperability/transcoding between CBOR & JSON, refactored tests, and improved docs.
706-
- Add opt-in support for `encoding.TextMarshaler` and `encoding.TextUnmarshaler` to encode and decode from CBOR text string.
707-
- Add opt-in support for `json.Marshaler` and `json.Unmarshaler` via user-provided transcoding function.
708-
- Update docs for TimeMode, Tag, RawTag, and add example for Embedded JSON Tag for CBOR.
705+
v2.9.1 (Mar 29-30, 2026) includes important bugfixes, defensive checks, improved code quality, and more tests. Although not public, the fuzzer was also improved by adding more fuzz tests.
709706

710-
v2.9.0 passed fuzz tests and is production quality.
707+
v2.9.1 passed fuzz tests and is production quality.
711708

712709
The minimum version of Go required to build:
713710
- v2.8.0 and newer releases require go 1.20+.
714711
- v2.7.1 and older releases require go 1.17+.
715712

716-
For more details, see [release notes](https://github.com/fxamacker/cbor/releases).
713+
For more details, see [v2.9.1 release notes](https://github.com/fxamacker/cbor/releases).
717714

718715
### Prior Releases
719716

717+
[v2.9.0](https://github.com/fxamacker/cbor/releases/tag/v2.9.0) (Jul 13, 2025) improved interoperability/transcoding between CBOR & JSON, refactored tests, and improved docs. It passed fuzz tests (billions of executions) and is production quality.
718+
720719
[v2.8.0](https://github.com/fxamacker/cbor/releases/tag/v2.8.0) (March 30, 2025) is a small release primarily to add `omitzero` option to struct field tags and fix bugs. It passed fuzz tests (billions of executions) and is production quality.
721720

722721
[v2.7.0](https://github.com/fxamacker/cbor/releases/tag/v2.7.0) (June 23, 2024) adds features and improvements that help large projects (e.g. Kubernetes) use CBOR as an alternative to JSON and Protocol Buffers. Other improvements include speedups, improved memory use, bug fixes, new serialization options, etc. It passed fuzz tests (5+ billion executions) and is production quality.

bench_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,22 +192,22 @@ var decodeBenchmarks = []struct {
192192
decodeToTypes: []reflect.Type{typeIntf, typeFloat64},
193193
}, // float64(-4.1)
194194
{
195-
name: "bytes",
195+
name: "byte string",
196196
data: mustHexDecode("581a0102030405060708090a0b0c0d0e0f101112131415161718191a"),
197197
decodeToTypes: []reflect.Type{typeIntf, typeByteSlice},
198198
}, // []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26}
199199
{
200-
name: "bytes indef len",
200+
name: "indefinite-length byte string",
201201
data: mustHexDecode("5f410141024103410441054106410741084109410a410b410c410d410e410f4110411141124113411441154116411741184119411aff"),
202202
decodeToTypes: []reflect.Type{typeIntf, typeByteSlice},
203203
}, // []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26}
204204
{
205-
name: "text",
205+
name: "text string",
206206
data: mustHexDecode("782b54686520717569636b2062726f776e20666f78206a756d7073206f76657220746865206c617a7920646f67"),
207207
decodeToTypes: []reflect.Type{typeIntf, typeString},
208208
}, // "The quick brown fox jumps over the lazy dog"
209209
{
210-
name: "text indef len",
210+
name: "indefinite-length text string",
211211
data: mustHexDecode("7f61546168616561206171617561696163616b612061626172616f6177616e61206166616f61786120616a6175616d617061736120616f61766165617261206174616861656120616c6161617a617961206164616f6167ff"),
212212
decodeToTypes: []reflect.Type{typeIntf, typeString},
213213
}, // "The quick brown fox jumps over the lazy dog"
@@ -217,7 +217,7 @@ var decodeBenchmarks = []struct {
217217
decodeToTypes: []reflect.Type{typeIntf, typeIntSlice},
218218
}, // []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26}
219219
{
220-
name: "array indef len",
220+
name: "indefinite-length array",
221221
data: mustHexDecode("9f0102030405060708090a0b0c0d0e0f101112131415161718181819181aff"),
222222
decodeToTypes: []reflect.Type{typeIntf, typeIntSlice},
223223
}, // []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26}
@@ -227,7 +227,7 @@ var decodeBenchmarks = []struct {
227227
decodeToTypes: []reflect.Type{typeIntf, typeMapStringIntf, typeMapStringString},
228228
}, // map[string]string{"a": "A", "b": "B", "c": "C", "d": "D", "e": "E", "f": "F", "g": "G", "h": "H", "i": "I", "j": "J", "l": "L", "m": "M", "n": "N"}}
229229
{
230-
name: "map indef len",
230+
name: "indefinite-length map",
231231
data: mustHexDecode("bf616161416162614261636143616461446165614561666146616761476168614861696149616a614a616b614b616c614c616d614d616e614eff"),
232232
decodeToTypes: []reflect.Type{typeIntf, typeMapStringIntf, typeMapStringString},
233233
}, // map[string]string{"a": "A", "b": "B", "c": "C", "d": "D", "e": "E", "f": "F", "g": "G", "h": "H", "i": "I", "j": "J", "l": "L", "m": "M", "n": "N"}}
@@ -986,13 +986,13 @@ func BenchmarkUnmarshalMapToStruct(b *testing.B) {
986986
b.Fatalf("invalid test assumption: ManyFields expected to have no more than 255 fields, has %d", rt.NumField())
987987
}
988988
buf.WriteByte(0xb8)
989-
buf.WriteByte(byte(rt.NumField()))
989+
buf.WriteByte(byte(rt.NumField())) //nolint:gosec
990990
for i := rt.NumField() - 1; i >= 0; i-- { // backwards
991991
f := rt.Field(i)
992992
if len(f.Name) > 23 {
993993
b.Fatalf("invalid test assumption: field name %q longer than 23 bytes", f.Name)
994994
}
995-
buf.WriteByte(byte(0x60 + len(f.Name)))
995+
buf.WriteByte(byte(0x60 + len(f.Name))) //nolint:gosec
996996
buf.WriteString(f.Name)
997997
buf.WriteByte(0xf5) // true
998998
}

0 commit comments

Comments
 (0)