Skip to content

Upgrade Go to 1.27.1 and modernize linting - #337

Merged
suraj-jadhav-ot merged 4 commits into
mainfrom
upgrade-go-version
Sep 17, 2026
Merged

suraj-jadhav-ot merged 4 commits into
mainfrom
upgrade-go-version

Conversation

@rajpreet-s

@rajpreet-s rajpreet-s commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Upgrades the CLI's Go toolchain from 1.23 to 1.27.1 across the module, CI workflows, and Docker images. Migrates golangci-lint to v2 (required for Go 1.27.1 compatibility) and fixes all errcheck, bodyclose, and gosec findings surfaced by the upgraded linter.


Changes

Go Version Upgrade

  • go.mod & CONTRIBUTING.md: Updated go 1.23.0go 1.27.1 and updated documented contributor requirements.

CI & Docker

  • test.yml, release.yml, debricked.yml: Pinned all actions/setup-go steps to 1.27.1.
  • alpine.Dockerfile, debian.Dockerfile: Bumped Docker base images to golang:1.27.1-*.
  • Workflow Actions: Upgraded golangci-lint install step to v2.13.2 and updated to the /v2 module path.

golangci-lint v1 → v2 Migration (.golangci.yml)

  • Migrated configuration to schema version: "2" (resolves Go 1.27.1 export data decode failures on v1.62.2).
  • Moved goimports and gofmt under the formatters: section.
  • Removed obsolete typecheck entry and duplicate staticcheck entry.
  • Re-enabled silently broken linters: errcheck, bodyclose, and gosec.

Linter Fixes

  • errcheck: Handled previously ignored error returns (Close(), Remove(), RemoveAll(), Setenv(), Fprintf()) across ~20 files in auth, callgraph, client, fingerprint, io, report, resolution, and upload.
  • bodyclose: Explicitly closed HTTP response body in batch.go.
  • gosec:
    • Tightened directory permissions (07550750) in 3 locations.
    • Sanitized log outputs to prevent log-line injection.
    • Added justified #nosec annotations for CLI-necessary operations (opening user files, executing git, maven, gradle).

Known Follow-ups

Tracked via TODO comments in .golangci.yml:

  • goconst: Kept disabled due to pre-existing repeated string literals.
  • staticcheck: Excluded pre-existing style/naming rules surfaced by v2 (ST1005, ST1006, ST1012, ST1019, QF1003, QF1004, QF1009, QF1012).

Testing

  • Build: go build succeeds under Go 1.27.1.
  • Lint: golangci-lint run reports 0 issues.
  • Docker: Alpine and Debian Docker images build and execute successfully.
  • Unit Tests: All runnable unit tests pass (unrelated environment gaps like missing Maven, .NET, Composer, pip cause pre-existing failures).

@rajpreet-s rajpreet-s self-assigned this Sep 16, 2026
@rajpreet-s rajpreet-s changed the title Upgrade Go version to 1.27.1 across workflows, Dockerfiles, and go.mod Upgrade Go to 1.27.1 and modernize linting Sep 16, 2026
@suraj-jadhav-ot
suraj-jadhav-ot merged commit 58a009b into main Sep 17, 2026
22 of 23 checks passed
@suraj-jadhav-ot
suraj-jadhav-ot deleted the upgrade-go-version branch September 17, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants