From 30710d2ffa0ba509730de2879be484c35a3090fa Mon Sep 17 00:00:00 2001 From: Manas Srivastava Date: Thu, 21 May 2026 23:51:48 +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 | 38 +++++++++++++++++++++++++++++ .golangci.yml | 31 +++++++++++++++++++++++ 2 files changed, 69 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..9cd1bdc --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,38 @@ +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: common + # Sibling checkout (proto) — common itself is the repo under test, so + # only proto is fetched as a sibling for the replace directive. + - uses: actions/checkout@v4 + with: + repository: InstaNode-dev/proto + path: proto + continue-on-error: true + - uses: actions/setup-go@v5 + with: + go-version-file: common/go.mod + - uses: golangci/golangci-lint-action@v6 + with: + version: latest + working-directory: common + 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 a7032e7957dcf380139d9052045d447a15094119 Mon Sep 17 00:00:00 2001 From: Manas Srivastava Date: Thu, 21 May 2026 23:56:49 +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 | 4 ++-- .golangci.yml | 30 ++++++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 9cd1bdc..2cd5c9c 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 @@ -31,7 +31,7 @@ jobs: - uses: actions/setup-go@v5 with: go-version-file: common/go.mod - - uses: golangci/golangci-lint-action@v6 + - uses: golangci/golangci-lint-action@v8 with: version: latest working-directory: common 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