From 0d73c41ca07a173f674ec3d5fff76f9715f986dd Mon Sep 17 00:00:00 2001 From: Manas Srivastava Date: Thu, 21 May 2026 23:50:30 +0530 Subject: [PATCH 1/2] ci: install golangci-lint (Tier-2 quality) Adds golangci-lint workflow + conservative initial config to surface Go code-quality issues (errcheck, ineffassign, gocyclo, unused, staticcheck, misspell). Runs on PR + push-to-master + weekly schedule. Sibling-checkout pattern matches existing codeql.yml for replace-directive resolution. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/golangci-lint.yml | 44 +++++++++++++++++++++++++++++ .golangci.yml | 31 ++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/workflows/golangci-lint.yml create mode 100644 .golangci.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..b074a83 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,44 @@ +name: golangci-lint + +on: + push: + branches: [master, main] + pull_request: + branches: [master, main] + schedule: + - cron: '23 6 * * 1' + +permissions: + contents: read + pull-requests: read + +jobs: + lint: + name: lint + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + with: + path: worker + # Sibling checkouts (proto/common) for repos with replace directives. + # No-op for repos that don't need them. + - uses: actions/checkout@v4 + if: ${{ hashFiles('worker/go.mod') != '' }} + with: + repository: InstaNode-dev/common + path: common + continue-on-error: true + - uses: actions/checkout@v4 + with: + repository: InstaNode-dev/proto + path: proto + continue-on-error: true + - uses: actions/setup-go@v5 + with: + go-version-file: worker/go.mod + - uses: golangci/golangci-lint-action@v6 + with: + version: latest + working-directory: worker + args: --timeout=5m diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..a422fbf --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,31 @@ +# golangci-lint config — start conservative, expand once baseline is clean +run: + timeout: 5m + tests: true + +linters: + enable: + - errcheck # checks unchecked errors + - gosimple # simplification suggestions + - govet # standard vet + - ineffassign # ineffective assignments + - staticcheck # bug detection + - unused # unused code + - misspell # spelling + - gocyclo # cyclomatic complexity + disable: + - gosec # security covered by govulncheck + CodeQL already + - dupl # too noisy on fresh codebases + +linters-settings: + gocyclo: + min-complexity: 20 # generous default + +issues: + exclude-rules: + - path: _test\.go + linters: + - errcheck # tests routinely ignore err + - gocyclo + max-issues-per-linter: 0 + max-same-issues: 0 From 504dc609d61fccc66c4c6099153c33a72e8cff49 Mon Sep 17 00:00:00 2001 From: Manas Srivastava Date: Thu, 21 May 2026 23:56:39 +0530 Subject: [PATCH 2/2] =?UTF-8?q?ci(golangci-lint):=20bump=20action=20v6=20?= =?UTF-8?q?=E2=86=92=20v8=20+=20migrate=20config=20to=20v2=20(Go=201.25)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Action v6 resolved to golangci-lint v1.64.8 (built with Go 1.24), which fails to load configs targeting Go 1.25. Action v8 ships golangci-lint v2.x which is Go 1.25-compatible. Config migrated to v2 format: removed gosimple (folded into staticcheck), moved exclude-rules under linters.exclusions, added version: "2" header. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/golangci-lint.yml | 6 +++--- .golangci.yml | 30 ++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index b074a83..d967398 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -6,7 +6,7 @@ on: pull_request: branches: [master, main] schedule: - - cron: '23 6 * * 1' + - cron: "23 6 * * 1" permissions: contents: read @@ -22,7 +22,7 @@ jobs: with: path: worker # Sibling checkouts (proto/common) for repos with replace directives. - # No-op for repos that don't need them. + # No-op for repos that do not need them. - uses: actions/checkout@v4 if: ${{ hashFiles('worker/go.mod') != '' }} with: @@ -37,7 +37,7 @@ jobs: - uses: actions/setup-go@v5 with: go-version-file: worker/go.mod - - uses: golangci/golangci-lint-action@v6 + - uses: golangci/golangci-lint-action@v8 with: version: latest working-directory: worker diff --git a/.golangci.yml b/.golangci.yml index a422fbf..1f598a4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,31 +1,31 @@ -# golangci-lint config — start conservative, expand once baseline is clean +# golangci-lint v2 config — start conservative, expand once baseline is clean +version: "2" + run: timeout: 5m tests: true linters: + # Default linter set is govet+errcheck+ineffassign+staticcheck+unused. + # We explicitly add misspell + gocyclo on top. gosimple folded into staticcheck in v2. enable: - errcheck # checks unchecked errors - - gosimple # simplification suggestions - govet # standard vet - ineffassign # ineffective assignments - - staticcheck # bug detection + - staticcheck # bug detection (subsumes gosimple in v2) - unused # unused code - misspell # spelling - gocyclo # cyclomatic complexity - disable: - - gosec # security covered by govulncheck + CodeQL already - - dupl # too noisy on fresh codebases - -linters-settings: - gocyclo: - min-complexity: 20 # generous default + settings: + gocyclo: + min-complexity: 20 + exclusions: + rules: + - path: _test\.go + linters: + - errcheck + - gocyclo issues: - exclude-rules: - - path: _test\.go - linters: - - errcheck # tests routinely ignore err - - gocyclo max-issues-per-linter: 0 max-same-issues: 0