Skip to content

Commit 8eb8cc8

Browse files
Mat001claude
andauthored
[FSSDK-11733] Upgrade linteringo-sdk (#434)
* add conditional to check if cmab experiment * [FSSDK-11733] Update linter to v1.64.2 and fix deprecations - Update golangci-lint from v1.54.2 to v1.64.2 - Replace deprecated golint with revive - Replace deprecated exportloopref with copyloopvar - Update CI lint job to use Go 1.24 - Fix G115 integer overflow in notification/manager.go - Suppress style-only rules to avoid breaking API changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent f03357f commit 8eb8cc8

File tree

4 files changed

+96
-82
lines changed

4 files changed

+96
-82
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/checkout@v3
2020
- uses: actions/setup-go@v3
2121
with:
22-
go-version: '1.21.0'
22+
go-version: '1.24.0'
2323
- run: make install lint
2424

2525
unit_test_latest:

.golangci.yml

Lines changed: 89 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,98 @@
11
linters-settings:
2-
govet:
3-
enable:
4-
- shadow
5-
# golint removed in newer versions, but works in v1.54.2
6-
golint:
7-
min-confidence: 0
8-
gocyclo:
9-
min-complexity: 16
10-
# maligned removed - replaced by govet fieldalignment
11-
dupl:
12-
threshold: 100
13-
goconst:
14-
min-len: 2
15-
min-occurrences: 2
16-
misspell:
17-
locale: US
18-
lll:
19-
line-length: 140
20-
gocritic:
21-
enabled-tags:
22-
- performance
23-
- style
24-
- experimental
25-
disabled-checks:
26-
- wrapperFunc
27-
- hugeParam
28-
- rangeValCopy
29-
gofmt:
30-
simplify: false
2+
govet:
3+
enable:
4+
- shadow
5+
revive:
6+
min-confidence: 0
7+
rules:
8+
# Disabled: Would require breaking API changes (Ids -> IDs)
9+
- name: var-naming
10+
disabled: true
11+
# Disabled: Parameters often required for interface compliance
12+
- name: unused-parameter
13+
disabled: true
14+
# Disabled: Style preference, not a bug
15+
- name: superfluous-else
16+
disabled: true
17+
# Disabled: Would require breaking API changes (stuttering names)
18+
- name: exported
19+
disabled: true
20+
gocyclo:
21+
min-complexity: 16
22+
dupl:
23+
threshold: 100
24+
goconst:
25+
min-len: 2
26+
min-occurrences: 2
27+
misspell:
28+
locale: US
29+
lll:
30+
line-length: 140
31+
gocritic:
32+
enabled-tags:
33+
- performance
34+
- style
35+
- experimental
36+
disabled-checks:
37+
- wrapperFunc
38+
- hugeParam
39+
- rangeValCopy
40+
gofmt:
41+
simplify: false
3142

3243
linters:
33-
disable-all: true
34-
enable:
35-
# Core linters
36-
- govet
37-
- typecheck
38-
- ineffassign
39-
- gofmt
40-
41-
# Static analysis
42-
- staticcheck
43-
- gosimple
44-
- unused
45-
46-
# Security
47-
- gosec
48-
49-
# Style and quality
50-
- golint # deprecated but still works in v1.54.2
51-
- stylecheck
52-
53-
# Code complexity
54-
- gocyclo
55-
- dupl
56-
- gocritic
57-
- nakedret
58-
59-
# Performance
60-
- prealloc
61-
- unconvert
62-
63-
# Correctness
64-
- unparam
65-
- misspell
66-
67-
# Replacing deprecated linters
68-
- exportloopref # replaces scopelint (works in v1.54.2)
69-
# - fieldalignment # replaces maligned (in govet)
70-
fast: false
71-
72-
# Enable additional checks
73-
enable-all: false
44+
disable-all: true
45+
enable:
46+
# Core linters
47+
- govet
48+
- typecheck
49+
- ineffassign
50+
- gofmt
51+
52+
# Static analysis
53+
- staticcheck
54+
- gosimple
55+
- unused
56+
57+
# Security
58+
- gosec
59+
60+
# Style and quality
61+
- revive
62+
- stylecheck
63+
64+
# Code complexity
65+
- gocyclo
66+
- dupl
67+
- gocritic
68+
- nakedret
69+
70+
# Performance
71+
- prealloc
72+
- unconvert
73+
74+
# Correctness
75+
- unparam
76+
- misspell
77+
78+
# Loop variable capture (Go 1.22+)
79+
- copyloopvar
80+
fast: false
81+
82+
# Enable additional checks
83+
enable-all: false
7484

7585
run:
76-
concurrency: 4
86+
concurrency: 4
7787

7888
issues:
79-
exclude-dirs:
80-
- vendor
81-
exclude-rules:
82-
- text: "weak cryptographic primitive"
83-
linters:
84-
- gosec
85-
exclude-use-default: false
89+
exclude-dirs:
90+
- vendor
91+
exclude-rules:
92+
- text: "weak cryptographic primitive"
93+
linters:
94+
- gosec
95+
exclude-use-default: false
8696

8797
service:
88-
golangci-lint-version: 1.54.x
98+
golangci-lint-version: 1.64.x

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cover: ## run unit tests with coverage
2323
GO111MODULE=$(GO111MODULE) $(GOTEST) -race ./pkg/... -coverprofile=profile.cov
2424

2525
install: ## installs dev and ci dependencies
26-
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOPATH)/bin v1.54.2
26+
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOPATH)/bin v1.64.2
2727

2828
lint: ## runs `golangci-lint` linters defined in `.golangci.yml` file
2929
$(GOLINT) run --out-format=tab --tests=false pkg/...

pkg/notification/manager.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ func (am *AtomicManager) Remove(id int) {
6363
am.lock.Lock()
6464
defer am.lock.Unlock()
6565

66-
handlerID := uint32(id)
66+
if id < 0 {
67+
am.logger.Debug(fmt.Sprintf("Invalid handler id: %d", id))
68+
return
69+
}
70+
handlerID := uint32(id) // #nosec G115 - id is validated non-negative above
6771
if _, ok := am.handlers[handlerID]; ok {
6872
delete(am.handlers, handlerID)
6973
return

0 commit comments

Comments
 (0)