Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,21 @@ jobs:
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
version: v1.64.8 # Pin version for consistency with pre-commit
args: --timeout=5m

test:
name: Test
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ['1.23', '1.24']
os: [ubuntu-latest]
go-version: ['1.24']
include:
# Test latest Go on different OS for cross-platform compatibility
- os: macos-latest
go-version: '1.24'
- os: windows-latest
go-version: '1.24'
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -56,7 +62,11 @@ jobs:
run: go mod download

- name: Run unit tests
run: go test -v -race -coverprofile=coverage.out ./...
run: |
# Run unit tests with race detection (excluding integration tests)
go test -v -race -coverprofile=coverage.out ./cmd/... ./internal/...
# Run integration tests without race detection (due to testscript limitations)
go test -v ./test/...

- name: Check coverage threshold
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.24'
Expand Down
62 changes: 33 additions & 29 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,60 +38,64 @@ linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- exportloopref
- exhaustive
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- noctx
- nolintlint
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace

issues:
exclude-rules:
- path: _test\.go
linters:
- gomnd
- goconst
- dupl
- errcheck
- bodyclose
- unused
- path: testdata/
linters:
- lll
- unused
- path: internal/testutil/
linters:
- gomnd
- goconst
- errcheck
- bodyclose
- unused
- path: test/
linters:
- errcheck
- bodyclose
- path: src/
linters:
- unused
- path: cmd/integration_testing.go
linters:
- errcheck
- bodyclose
- path: cmd/export.go
linters:
- errcheck

exclude-use-default: false
exclude:
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
# Ignore overly strict linting rules for development
- "cyclomatic complexity .* of func .* is high"
- "string .* has .* occurrences, make it a constant"
- "commentedOutCode: may want to remove commented-out code"
- "appendCombine: can combine chain of .* appends into one"
- "at least one file in a package should have a package comment"
- "Potential file inclusion via variable"
- "Expect directory permissions to be 0750 or less"
- "Expect WriteFile permissions to be 0600 or less"
- "var .* is unused"
- "func .* is unused"
- "Error return value of.*is not checked"

max-issues-per-linter: 0
max-same-issues: 0
19 changes: 10 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ repos:
args: ['--maxkb=1000']
- id: check-merge-conflict

# Go-specific hooks (essential checks only)
# Go-specific hooks using official golangci-lint (matches CI)
- repo: https://github.com/golangci/golangci-lint
rev: v1.64.8 # Same version as CI
hooks:
- id: golangci-lint-full
name: ' Go Lint & Format'
args: ['--timeout=5m', '--fix']

# Additional Go tools for comprehensive pre-commit checks
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-rc.2
hooks:
Expand All @@ -30,12 +38,6 @@ repos:
- id: go-test-repo-mod
name: ' Go Unit Tests'
args: ['-short', '-timeout=30s']

- id: go-vet-repo-mod
name: ' Go Vet'

- id: go-fmt-repo
name: ' Go Format'

# Commit message linting
- repo: https://github.com/compilerla/conventional-pre-commit
Expand All @@ -49,11 +51,10 @@ repos:
default_stages: [pre-commit]
fail_fast: false

# Exclude patterns - skip test files and generated content
# Exclude patterns - skip generated content only (include test files)
exclude: |
(?x)^(
testdata/.*|
.*_test\.go$|
.*\.md$|
go\.sum$|
\.pre-commit-config\.yaml$
Expand Down
Loading
Loading