Skip to content

upgrade golang-lint to v2 #5178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2025
Merged

Conversation

harshavardhana
Copy link
Member

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers
under the terms of the Apache 2 license.
By creating this pull request I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 license.

Description

upgrade golang-lint to v2

Motivation and Context

upgraded linters, and more checks

How to test this PR?

CI/CD

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Fixes a regression (If yes, please add commit-id or PR # here)
  • Unit tests added/updated
  • Internal documentation updated
  • Create a documentation update request here

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request upgrades golang-lint to v2 while refactoring several code paths to use modern switch-case syntax, simplify variable initialization, and update field references for consistency. Key changes include:

  • Replacing nested if-else statements with switch-case in OS and HTTP method handling.
  • Refining variable initializations and field references for expiration, progress bar updates, and metadata parsing.
  • Updating linters configuration to align with golangci-lint v2 requirements.

Reviewed Changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cmd/mirror-main.go Replaced if-else with switch-case for OS-specific logic.
cmd/ilm/utils.go Updated expiration date check to use the correct IsZero() method.
cmd/idp-ldap-subcommands.go Simplified variable initialization using short declaration syntax.
cmd/find.go Updated field references and exit status parsing logic.
cmd/duration.go Revised the duration parsing condition for improved numerical checks.
cmd/cp-main_contrib.go Refactored token handling using switch-case in parser logic.
cmd/cp-main.go Updated progress bar API calls to the new method names.
cmd/config.go Modified URL validation logic for stricter argument errors.
cmd/config-migrate.go Converted chained if-else checks into a switch-case for host mapping.
cmd/client-sts_test.go Combined variable initialization for conciseness.
cmd/client-s3_test.go Switched to modern switch-case syntax for HTTP method dispatch.
cmd/client-admin_test.go Modernized switch-case use in test handlers.
cmd/client-admin.go Simplified TLS usage determination using a concise comparison.
cmd/admin-replicate-status.go Updated switch-case patterns in generating replication status summaries.
cmd/admin-replicate-remove.go Corrected field references for error details in replication remove status.
cmd/admin-policy-attach.go Replaced direct field comparison with the Equal method for timestamps.
cmd/admin-heal-ui.go Removed an unnecessary return statement.
cmd/admin-heal-result-item.go Updated struct field accesses to use the new field names.
cmd/admin-cluster-bucket-import.go Updated bucket metadata references for consistency with new structures.
.golangci.yml Adjusted and expanded linters configuration to support golangci-lint v2.
Comments suppressed due to low confidence (1)

.golangci.yml:7

  • Duplicate linter entries (e.g. 'gomodguard', 'misspell', 'revive', 'staticcheck') are present in the 'enable' list, which may lead to unexpected behavior. Consider removing the duplicates to streamline the configuration.
   -    - gomodguard

@harshavardhana harshavardhana merged commit c652022 into minio:master Mar 28, 2025
5 checks passed
@harshavardhana harshavardhana deleted the update-lint branch March 28, 2025 08:05
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