Skip to content

fix: golint installation for golang version above 1.26#382

Open
david-montano-circleci wants to merge 1 commit intomainfrom
dmontano/golangci-1-26-lint-fix
Open

fix: golint installation for golang version above 1.26#382
david-montano-circleci wants to merge 1 commit intomainfrom
dmontano/golangci-1-26-lint-fix

Conversation

@david-montano-circleci
Copy link

Description

Updated the Dockerfile.template to implement a conditional installation strategy for golangci-lint based on the Go version. For environments using Go 1.26 or higher, the linter is now compiled from source; older versions continue to use the binary installation script.
Fixes #374

Reasons

  • Go 1.26 Compatibility: Building golangci-lint from source using go install for Go 1.26+ ensures the binary is perfectly linked with the container's specific toolchain, preventing potential execution issues with pre-compiled binaries on newer runtimes.
  • Improved Logic: Refactored the version parsing into a MINOR_VER variable to make the shell conditional logic cleaner and more maintainable.
  • Image Hygiene: Included a cleanup step to remove the temporary source directory (/tmp/golangci-lint-src) immediately after compilation to keep the image layer size optimized.

Checklist

Please check through the following before opening your PR. Thank you!

  • I have made changes to the Dockerfile.template file only
  • I have not made any manual changes to automatically generated files
  • My PR follows best practices as described in the contributing guidelines
  • (Optional, but recommended) My commits are signed

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.

Bug Report: Golang upgrade breaks golangci-lint

1 participant