Skip to content

Commit 73d06af

Browse files
committed
chore: bump dependencies, fix tests, and resolve golangci-lint errors
- Updated all dependencies to their latest versions. - Fixed failing test cases. - Resolved golangci-lint errors. Signed-off-by: Gao Hongtao <[email protected]>
1 parent 90488e1 commit 73d06af

17 files changed

+180
-223
lines changed

Diff for: .github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v3
1313
- name: golangci-lint
14-
uses: golangci/golangci-lint-action@v3.2.0
14+
uses: golangci/golangci-lint-action@v6.1.1
1515
with:
16-
version: v1.45.2
16+
version: v1.61.0

Diff for: .github/workflows/tests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ jobs:
88
test:
99
strategy:
1010
matrix:
11-
go-version: [1.17.x, 1.18.x]
11+
go-version: [1.23.x]
1212
platform: [ubuntu-latest, macos-latest, windows-latest]
1313
runs-on: ${{ matrix.platform }}
1414
steps:
1515
- name: Install Go
16-
uses: actions/setup-go@v3
16+
uses: actions/setup-go@v5
1717
with:
1818
go-version: ${{ matrix.go-version }}
1919
- name: Checkout code
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121
- name: Test
2222
run: |
2323
go version

Diff for: .golangci.yml

+67-98
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,90 @@
11
linters-settings:
2-
depguard:
3-
list-type: blacklist
4-
packages:
5-
# logging is allowed only by logutils.Log, logrus
6-
# is allowed to use only in logutils package
7-
- github.com/sirupsen/logrus
8-
packages-with-error-message:
9-
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
102
dupl:
113
threshold: 100
124
funlen:
135
lines: 100
14-
statements: 50
6+
statements: 60
157
goconst:
168
min-len: 2
179
min-occurrences: 2
1810
gocritic:
1911
enabled-tags:
20-
- diagnostic
21-
- experimental
22-
- opinionated
23-
- performance
24-
- style
12+
- diagnostic
13+
- experimental
14+
- opinionated
15+
- performance
16+
- style
2517
disabled-checks:
26-
- dupImport # https://github.com/go-critic/go-critic/issues/845
27-
- ifElseChain
28-
- octalLiteral
29-
- whyNoLint
30-
- wrapperFunc
18+
- dupImport # https://github.com/go-critic/go-critic/issues/845
19+
- ifElseChain
20+
- octalLiteral
21+
- whyNoLint
22+
- wrapperFunc
3123
gocyclo:
3224
min-complexity: 20 # increased from 15 to get us going, but not make things worse
3325
goimports:
3426
local-prefixes: github.com/golangci/golangci-lint
35-
golint:
36-
min-confidence: 0
37-
gomnd:
38-
settings:
39-
mnd:
40-
# don't include the "operation" and "assign"
41-
checks: argument,case,condition,return
27+
mnd:
28+
# don't include the "operation" and "assign"
29+
checks:
30+
- argument
31+
- case
32+
- condition
33+
- return
4234
govet:
43-
check-shadowing: true
4435
settings:
4536
printf:
4637
funcs:
47-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
48-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
49-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
50-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
38+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
39+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
40+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
41+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
5142
lll:
5243
line-length: 140
53-
maligned:
54-
suggest-new: true
5544
misspell:
5645
locale: US
5746
nolintlint:
58-
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
5947
allow-unused: false # report any unused nolint directives
6048
require-explanation: false # don't require an explanation for nolint directives
6149
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
50+
gosec:
51+
excludes:
52+
- G115 # integer overflow conversion (TODO: verify these)
6253

6354
linters:
6455
# please, do not use `enable-all`: it's deprecated and will be removed soon.
6556
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
6657
disable-all: true
6758
enable:
68-
- bodyclose
69-
- deadcode
70-
- depguard
71-
- dogsled
72-
- dupl
73-
- errcheck
74-
- funlen
75-
- gochecknoinits
76-
- goconst
77-
- gocritic
78-
- gocyclo
79-
- gofmt
80-
- goimports
81-
- golint
82-
- gomnd
83-
- goprintffuncname
84-
- gosec
85-
- gosimple
86-
- govet
87-
- ineffassign
88-
- interfacer
89-
- lll
90-
- misspell
91-
- nakedret
92-
- nolintlint
93-
- rowserrcheck
94-
- scopelint
95-
- staticcheck
96-
- structcheck
97-
- stylecheck
98-
- typecheck
99-
- unconvert
100-
- unparam
101-
- unused
102-
- varcheck
103-
- whitespace
104-
59+
- bodyclose
60+
- dogsled
61+
- dupl
62+
- errcheck
63+
- funlen
64+
- gochecknoinits
65+
- goconst
66+
- gocritic
67+
- gocyclo
68+
- gofmt
69+
- goimports
70+
- mnd
71+
- goprintffuncname
72+
- gosec
73+
- gosimple
74+
- govet
75+
- ineffassign
76+
- lll
77+
- misspell
78+
- nakedret
79+
- nolintlint
80+
- rowserrcheck
81+
- staticcheck
82+
- stylecheck
83+
- typecheck
84+
- unconvert
85+
- unparam
86+
- unused
87+
- whitespace
10588
# don't enable:
10689
# - asciicheck
10790
# - gochecknoglobals
@@ -118,31 +101,17 @@ linters:
118101
issues:
119102
# Excluding configuration per-path, per-linter, per-text and per-source
120103
exclude-rules:
121-
- path: _test\.go
122-
linters:
123-
- gomnd
124-
- path: cmd/ice/cmd
125-
linters:
126-
- gochecknoinits
127-
- path: sizes.go
128-
linters:
129-
- gochecknoinits
130-
131-
# https://github.com/go-critic/go-critic/issues/926
132-
- linters:
133-
- gocritic
134-
text: "unnecessaryDefer:"
135-
136-
run:
137-
skip-dirs:
138-
- test/testdata_etc
139-
- internal/cache
140-
- internal/renameio
141-
- internal/robustio
104+
- path: _test\.go
105+
linters:
106+
- mnd
107+
- path: cmd/ice/cmd
108+
linters:
109+
- gochecknoinits
110+
- path: sizes.go
111+
linters:
112+
- gochecknoinits
142113

143-
# golangci.com configuration
144-
# https://github.com/golangci/golangci/wiki/Configuration
145-
service:
146-
golangci-lint-version: 1.23.x # use the fixed version to not introduce new linters unexpectedly
147-
prepare:
148-
- echo "here I can run custom commands, but no preparation needed for this repo"
114+
# https://github.com/go-critic/go-critic/issues/926
115+
- linters:
116+
- gocritic
117+
text: "unnecessaryDefer:"

Diff for: contentcoder.go

-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ func (c *chunkedContentCoder) Add(docNum uint64, vals []byte) error {
176176
//
177177
// | ..... data ..... | chunk offsets (varints)
178178
// | position of chunk offsets (uint64) | number of offsets (uint64) |
179-
//
180179
func (c *chunkedContentCoder) Write() (int, error) {
181180
var tw int
182181

Diff for: contentcoder_test.go

+7-11
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ func TestChunkedContentCoder(t *testing.T) {
3434
vals: [][]byte{[]byte("bluge")},
3535
// 1 chunk, chunk-0 length 11(b), value
3636
expected: []byte{
37-
0x1, 0x0, 0x5, 0x28, 0xb5, 0x2f, 0xfd, 0x4, 0x0, 0x29, 0x0, 0x0,
38-
'b', 'l', 'u', 'g', 'e',
39-
0x7e, 0xde, 0xed, 0x4a, 0x15, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
40-
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1,
37+
0x1, 0x0, 0x5, 0x5, 0x10,
38+
'b', 'l', 'u', 'g', 'e', 0xa,
39+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1,
40+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1,
4141
},
4242
},
4343
{
@@ -49,13 +49,9 @@ func TestChunkedContentCoder(t *testing.T) {
4949
[]byte("scorch"),
5050
},
5151

52-
expected: []byte{
53-
0x1, 0x0, 0x6, 0x28, 0xb5, 0x2f, 0xfd, 0x4, 0x0, 0x31, 0x0, 0x0,
54-
0x75, 0x70, 0x73, 0x69, 0x64, 0x65, 0x35, 0x89, 0x5a, 0xd,
55-
0x1, 0x1, 0x6, 0x28, 0xb5, 0x2f, 0xfd, 0x4, 0x0, 0x31, 0x0, 0x0,
56-
0x73, 0x63, 0x6f, 0x72, 0x63, 0x68, 0xc4, 0x46, 0x89, 0x39, 0x16, 0x2c,
57-
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2,
58-
},
52+
expected: []byte{0x1, 0x0, 0x6, 0x6, 0x14, 0x75, 0x70, 0x73, 0x69, 0x64, 0x65, 0x1,
53+
0x1, 0x6, 0x6, 0x14, 0x73, 0x63, 0x6f, 0x72, 0x63, 0x68, 0xb, 0x16, 0x0, 0x0,
54+
0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2},
5955
},
6056
}
6157

Diff for: documentcoder_test.go

+5-13
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,18 @@ func TestChunkedDocumentCoder(t *testing.T) {
1919
docNums: []uint64{0},
2020
metas: [][]byte{{0}},
2121
datas: [][]byte{[]byte("bluge")},
22-
expected: []byte{
23-
0x28, 0xb5, 0x2f, 0xfd, 0x4, 0x0, 0x41,
24-
0x0, 0x0, 0x1, 0x5, 0x0, 0x62, 0x6c, 0x75, 0x67, 0x65, 0x2b, 0x30, 0x97, 0x33, 0x0, 0x15, 0x15,
25-
0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x3,
26-
},
22+
expected: []byte{0x8, 0x1c, 0x1, 0x5, 0x0, 0x62, 0x6c, 0x75, 0x67, 0x65,
23+
0x0, 0xa, 0xa, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x3},
2724
expectedChunkNum: 3, // left, chunk, right
2825
},
2926
{
3027
chunkSize: 1,
3128
docNums: []uint64{0, 1},
3229
metas: [][]byte{{0}, {1}},
3330
datas: [][]byte{[]byte("upside"), []byte("scorch")},
34-
expected: []byte{
35-
0x28, 0xb5, 0x2f, 0xfd, 0x4, 0x0, 0x49,
36-
0x0, 0x0, 0x1, 0x6, 0x0, 0x75, 0x70, 0x73, 0x69, 0x64, 0x65,
37-
0x36, 0x6e, 0x7e, 0x39, 0x28, 0xb5, 0x2f, 0xfd, 0x4, 0x0, 0x49,
38-
0x0, 0x0, 0x1, 0x6, 0x1, 0x73, 0x63, 0x6f, 0x72, 0x63, 0x68,
39-
0x8f, 0x83, 0xa3, 0x37, 0x0, 0x16, 0x2c, 0x2c,
40-
0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4,
41-
},
31+
expected: []byte{0x9, 0x20, 0x1, 0x6, 0x0, 0x75, 0x70, 0x73, 0x69, 0x64,
32+
0x65, 0x9, 0x20, 0x1, 0x6, 0x1, 0x73, 0x63, 0x6f, 0x72, 0x63, 0x68,
33+
0x0, 0xb, 0x16, 0x16, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4},
4234
expectedChunkNum: 4, // left, chunk, chunk, right
4335
},
4436
}

Diff for: go.mod

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
module github.com/blugelabs/ice
22

3-
go 1.16
3+
go 1.23
4+
5+
toolchain go1.23.1
46

57
require (
6-
github.com/RoaringBitmap/roaring v0.9.4
8+
github.com/RoaringBitmap/roaring v1.9.4
79
github.com/blevesearch/mmap-go v1.0.4
8-
github.com/blevesearch/vellum v1.0.7
10+
github.com/blevesearch/vellum v1.0.10
911
github.com/blugelabs/bluge_segment_api v0.2.0
10-
github.com/klauspost/compress v1.15.2
11-
github.com/spf13/cobra v0.0.5
12+
github.com/klauspost/compress v1.17.11
13+
github.com/spf13/cobra v1.8.1
14+
)
15+
16+
require (
17+
github.com/bits-and-blooms/bitset v1.14.3 // indirect
18+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
19+
github.com/mschoch/smat v0.2.0 // indirect
20+
github.com/spf13/pflag v1.0.5 // indirect
21+
golang.org/x/sys v0.26.0 // indirect
1222
)
1323

1424
replace github.com/blugelabs/bluge_segment_api => github.com/zinclabs/bluge_segment_api v1.0.0

0 commit comments

Comments
 (0)