Skip to content

Commit 2c6fb8c

Browse files
HerbHallclaude
andauthored
chore: DevKit compliance -- golangci-lint v2, LICENSE, pre-push hook (#50)
* chore: DevKit compliance -- golangci-lint v2, LICENSE, pre-push hook - Migrate .golangci.yml from v1 to v2 format - Add missing linters from DevKit standard (misspell, bodyclose, noctx, etc.) - Move gofmt/goimports to formatters section (v2 requirement) - Remove gosimple (merged into staticcheck in v2) - Add MIT LICENSE - Add pre-push hook with Go build, test, lint, and markdownlint checks Note: 24 pre-existing lint issues from new linters (exhaustive, gosec G602/G115, prealloc, staticcheck QF) to be addressed in a follow-up PR. Co-Authored-By: Claude <noreply@anthropic.com> * fix: upgrade golangci-lint-action v6 -> v7 for v2 config support Action v6 rejects golangci-lint v2 config fields (version, formatters, linters.settings). Action v7 is required for v2 compatibility. Also removes install-mode: goinstall which doesn't work with v2. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent fc2ff95 commit 2c6fb8c

4 files changed

Lines changed: 82 additions & 28 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
- uses: actions/setup-go@v5
2525
with:
2626
go-version-file: go.mod
27-
- uses: golangci/golangci-lint-action@v6
27+
- uses: golangci/golangci-lint-action@v7
2828
with:
29-
version: v1.64.8
30-
install-mode: goinstall
29+
version: v2.10.1

.golangci.yml

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,50 @@
1+
version: "2"
2+
13
run:
24
timeout: 5m
35

46
linters:
57
enable:
6-
- govet
78
- errcheck
9+
- gosec
10+
- gocritic
11+
- govet
812
- staticcheck
9-
- unused
10-
- gosimple
1113
- ineffassign
12-
- gocritic
13-
- gofmt
14-
- goimports
15-
- gosec
14+
- unused
15+
- misspell
16+
- bodyclose
17+
- noctx
18+
- durationcheck
19+
- exhaustive
20+
- nilerr
1621
- prealloc
22+
settings:
23+
gosec:
24+
excludes:
25+
- G104 # Unhandled errors on deferred Close -- acceptable in tests
26+
- G404 # math/rand is correct for games, not security code
27+
- G101 # false positives on non-credential constants
28+
gocritic:
29+
enabled-tags:
30+
- diagnostic
31+
- style
32+
- performance
33+
disabled-checks:
34+
- hugeParam # Bubbletea tea.Model requires value receivers
35+
exhaustive:
36+
default-signifies-exhaustive: true
37+
exclusions:
38+
rules:
39+
- path: _test\.go
40+
linters:
41+
- gosec
42+
- errcheck
43+
- path: cmd/
44+
linters:
45+
- noctx
1746

18-
linters-settings:
19-
gocritic:
20-
enabled-tags:
21-
- diagnostic
22-
- style
23-
- performance
24-
disabled-checks:
25-
- hugeParam # Bubbletea tea.Model requires value receivers
26-
gosec:
27-
excludes:
28-
- G104 # unhandled errors on deferred Close()
29-
- G404 # math/rand is correct for games, not security code
30-
- G101 # false positives on non-credential constants
31-
32-
issues:
33-
exclude-use-default: false
34-
max-issues-per-linter: 0
35-
max-same-issues: 0
47+
formatters:
48+
enable:
49+
- gofmt
50+
- goimports

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Herb Hall
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

scripts/pre-push

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
# Pre-push hook: runs the same checks as CI before allowing a push.
3+
set -euo pipefail
4+
5+
echo "==> pre-push: running CI checks..."
6+
7+
echo "--- go build"
8+
go build ./...
9+
10+
echo "--- go test"
11+
go test ./...
12+
13+
echo "--- golangci-lint"
14+
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.10.1 run ./...
15+
16+
echo "--- markdownlint"
17+
npx --yes markdownlint-cli2 "**/*.md" "#node_modules"
18+
19+
echo "==> pre-push: all checks passed"

0 commit comments

Comments
 (0)