Skip to content

chore(ci): update golangci lint v2.1.5#2615

Merged
Jguer merged 5 commits intonextfrom
update-golangci-lint-v2.1.5
May 1, 2025
Merged

chore(ci): update golangci lint v2.1.5#2615
Jguer merged 5 commits intonextfrom
update-golangci-lint-v2.1.5

Conversation

@Jguer
Copy link
Copy Markdown
Owner

@Jguer Jguer commented May 1, 2025

This pull request introduces a variety of changes, including updates to linting configurations, Dockerfile improvements, code refactoring, and bug fixes. The most significant updates involve enhancing the linting setup, refactoring switch statements for better readability, and improving type safety in the codebase.

Linting and Configuration Updates:

  • Updated .golangci.yml to enable a specific set of linters, including errcheck, staticcheck, and gocritic, while removing deprecated configurations and adding exclusions for generated files and specific paths. [1] [2]
  • Added golangci-lint as the default linting tool in .vscode/settings.json and configured gopls for consistent formatting.
  • Upgraded golangci-lint version from v1.64.6 to v2.1.5 in ci.Dockerfile.

Code Refactoring:

  • Refactored multiple if-else chains into switch statements for improved readability, e.g., in clean.go, workdir/preparer.go, and upgrade/service.go. [1] [2] [3]
  • Renamed variables for clarity and consistency, such as min to minVal and max to maxVal in pkg/intrange/intrange.go.

Bug Fixes:

  • Fixed logical errors in conditional expressions, such as replacing !(A || B) with !A && !B in query_builder.go.
  • Resolved incorrect type usage by changing Reason int to Reason uint in pkg/dep/dep_graph.go.

Dockerfile and Workflow Enhancements:

  • Added /app/bin to PATH in .devcontainer/Dockerfile to ensure binaries are accessible during development.
  • Uncommented and re-enabled the linting step in .github/workflows/testing.yml to integrate lint checks into the CI pipeline.

Miscellaneous Improvements:

  • Simplified redundant checks, such as removing unnecessary nil checks for slices in parser.go.
  • Improved test cases in intrange_test.go by using more concise syntax for mapset initialization. [1] [2]

@Jguer Jguer merged commit b745f87 into next May 1, 2025
5 of 6 checks passed
@Jguer Jguer deleted the update-golangci-lint-v2.1.5 branch May 1, 2025 08:00
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.

1 participant