- 
                Notifications
    
You must be signed in to change notification settings  - Fork 4.5k
 
fix: golangci-lint staticcheck errors #22640
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
Conversation
There was a problem hiding this 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 PR fixes golangci-lint staticcheck errors across the codebase by replacing deprecated or inefficient Go constructs with their modern equivalents.
Key changes include:
- Replacing deprecated 
fuzz.Continue.Randmethods with directfuzz.Continuemethods - Simplifying boolean comparisons and string operations
 - Improving loop constructs and variable assignments
 
Reviewed Changes
Copilot reviewed 73 out of 73 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description | 
|---|---|
| testrpc/wait.go | Simplified field access by removing redundant QueryMeta wrapper | 
| snapshot/snapshot_test.go | Improved loop condition for leader check | 
| proto/private/pbservice/convert_test.go | Updated fuzz.Continue method calls to remove deprecated Rand field | 
| lib/template/hil.go | Replaced strings.Index with strings.Contains for better readability | 
| lib/hoststats/cpu_test.go | Replaced time.Now().Sub() with time.Since() | 
| internal/resource/protoc-gen-json-shim/internal/generate/generate.go | Simplified boolean comparison and replaced strings.Replace with strings.ReplaceAll | 
| internal/resource/protoc-gen-deepcopy/internal/generate/generate.go | Simplified boolean comparison | 
| internal/resource/decode_test.go | Fixed field access path by removing redundant Resource wrapper | 
| internal/controller/controllertest/builder.go | Simplified slice append operation | 
| connect/certgen/certgen.go | Removed redundant type specifications in variable declarations | 
| command/version/formatter_test.go | Removed unnecessary fmt.Sprintf wrapper | 
| command/snapshot/inspect/formatter_test.go | Removed unnecessary fmt.Sprintf wrapper | 
| command/services/export/export.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/resource/read/read.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/resource/read-grpc/read.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/resource/list/list.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/resource/list-grpc/list.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/resource/helper.go | Improved switch statement efficiency and readability | 
| command/resource/delete/delete.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/resource/delete-grpc/delete.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/resource/client/client.go | Simplified slice append and improved buffer string conversion | 
| command/peering/list/list.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/peering/exportedservices/exported_services.go | Simplified field access by removing redundant EnterpriseMeta wrapper | 
| command/operator/autopilot/state/formatter.go | Replaced string concatenation with fmt.Fprintf for better performance | 
| command/logout/logout.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/login/login.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/lock/lock.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/kv/get/kv_get.go | Simplified boolean logic and removed unnecessary fmt.Sprintf wrapper | 
| command/keyring/keyring.go | Replaced string concatenation with fmt.Fprintf for better performance | 
| command/keygen/keygen.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/intention/match/match.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/intention/list/intention_list.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/intention/delete/delete.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/intention/check/check.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/flags/flag_slice_value_test.go | Simplified variable declaration | 
| command/exec/exec.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/connect/redirecttraffic/redirect_traffic.go | Simplified multiple slice append operations | 
| command/connect/proxy/proxy.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/connect/envoy/flags.go | Replaced string concatenation with fmt.Fprintf for better performance | 
| command/connect/envoy/envoy_test.go | Replaced strings.Replace with strings.ReplaceAll | 
| command/connect/envoy/envoy.go | Replaced strings.Replace with strings.ReplaceAll | 
| command/config/config.go | Simplified boolean comparison | 
| command/cli/cli.go | Simplified field access by removing redundant BasicUi wrapper | 
| command/catalog/list/nodes/catalog_list_nodes.go | Simplified variable declaration | 
| command/acl/token/read/token_read_test.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/token/formatter.go | Simplified field access and replaced string concatenation with fmt.Fprintf | 
| command/acl/token/delete/token_delete_test.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/templatedpolicy/preview/templated_policy_preview.go | Improved comparison logic | 
| command/acl/templatedpolicy/formatter.go | Replaced string concatenation with fmt.Fprintf for better performance | 
| command/acl/role/update/role_update.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/role/read/role_read_test.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/role/read/role_read.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/role/delete/role_delete_test.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/role/delete/role_delete.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/policy/update/policy_update.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/policy/read/policy_read_test.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/policy/read/policy_read.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/policy/delete/policy_delete_test.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/policy/delete/policy_delete.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/policy/create/policy_create.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/bindingrule/read/bindingrule_read_test.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/bindingrule/read/bindingrule_read.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/bindingrule/delete/bindingrule_delete_test.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/bindingrule/delete/bindingrule_delete.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/authmethod/update/authmethod_update.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/authmethod/read/authmethod_read.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/authmethod/delete/authmethod_delete_test.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/authmethod/delete/authmethod_delete.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/authmethod/create/authmethod_create.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| command/acl/agenttokens/agent_tokens.go | Removed unnecessary fmt.Sprintf wrapper for static string | 
| acl/policy_authorizer.go | Simplified field access by removing redundant wrapper | 
| acl/policy.go | Simplified field access by removing redundant EnterpriseRule wrapper | 
| acl/authorizer.go | Simplified field access by removing redundant Authorizer wrapper | 
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.18,1.19,1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
    
      
        4 similar comments
      
    
  
    | 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.18,1.19,1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.18,1.19,1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.18,1.19,1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.18,1.19,1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
    
      
        4 similar comments
      
    
  
    | 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
    
      
        29 similar comments
      
    
  
    | 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
| 
           📣 Hi @sreeram77! a backport is missing for this PR [22640] for versions [1.20] please perform the backport manually and add the following snippet to your backport PR description:  | 
    
Description
Testing & Reproduction steps
Links
PR Checklist
PCI review checklist
I have documented a clear reason for, and description of, the change I am making.
If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
If applicable, I've documented the impact of any changes to security controls.
Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.