Skip to content

Conversation

@sreeram77
Copy link
Member

Description

  • fix: golangci-lint staticcheck errors

Testing & Reproduction steps

Links

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

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.

@sreeram77 sreeram77 requested a review from Copilot August 28, 2025 08:23
@sreeram77 sreeram77 requested a review from a team as a code owner August 28, 2025 08:23
@sreeram77 sreeram77 added pr/no-changelog PR does not need a corresponding .changelog entry backport/all Apply backports for all active releases per .release/versions.hcl labels Aug 28, 2025
@github-actions github-actions bot added theme/health-checks Health Check functionality theme/cli Flags and documentation for the CLI interface theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies theme/envoy/xds Related to Envoy support labels Aug 28, 2025
Copy link
Contributor

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 PR fixes golangci-lint staticcheck errors by removing redundant type specifications, simplifying variable declarations, and correcting field accesses to use embedded structs directly rather than accessing them through parent struct fields.

  • Simplifies variable declarations by removing redundant type specifications where the compiler can infer types
  • Fixes field access patterns to use embedded struct fields directly instead of through their parent structs
  • Replaces deprecated string replacement patterns with more efficient alternatives

Reviewed Changes

Copilot reviewed 104 out of 104 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
command/catalog/list/nodes/catalog_list_nodes.go Removes redundant type specification from variable declaration
command/agent/agent_test.go Fixes field access to use embedded struct fields directly
agent/xds/*.go Multiple fixes for embedded struct field access and variable declarations
agent/structs/*.go Extensive fixes for embedded struct field access patterns
agent/util.go Improves type assertion handling with type switches
agent/testagent.go Fixes field access to use embedded struct fields directly
agent/rpcclient/health/*.go Fixes QueryOptions field access patterns
agent/rpc/peering/service*.go Fixes Config field access and string replacement patterns
agent/*.go Various fixes for field access patterns and variable declarations
Comments suppressed due to low confidence (3)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@sreeram77 sreeram77 force-pushed the sreeram77/staticcheck-fix branch from a3a889b to f3992e0 Compare August 28, 2025 08:52
@sreeram77 sreeram77 enabled auto-merge (squash) August 28, 2025 09:12
@sreeram77 sreeram77 merged commit 469dd1f into main Aug 28, 2025
161 of 163 checks passed
@sreeram77 sreeram77 deleted the sreeram77/staticcheck-fix branch August 28, 2025 09:38
@hc-github-team-consul-core hc-github-team-consul-core added backport/1.21 This release series is longer active on CE, use backport/ent/1.21 backport/ent/1.18 Changes are backported to 1.18 ent backport/ent/1.19 Changes are backported to 1.19 ent backport/ent/1.20 backport to ent 1.20 labels Aug 28, 2025
sreeram77 added a commit that referenced this pull request Aug 29, 2025
* fix: golangci-lint staticcheck errors

* fix: missing braces for else in mesh_gateway.go

* fix: remove unnecessary type check in otel_sink_test.go
sreeram77 added a commit that referenced this pull request Aug 29, 2025
* fix: golangci-lint staticcheck errors (#22642)

* fix: golangci-lint staticcheck errors

* fix: missing braces for else in mesh_gateway.go

* fix: remove unnecessary type check in otel_sink_test.go

* fix: golangci-lint issues (#22644)

* upgrade: golangci-lint to v2 (#22648)

* fix: golangci-lint issues

* migrate golangci-lint config to v2

* upgrade: golangci-lint to v2.4.0

* fix: linter issues in agent/consul (#22651)

* Fixing bind addr issue, ipv6 bracket, valid peering token issue m go-discover update (#22584)

* Fixing bind addr issue, ipv6 bracket and valid peering token issue

* Making addr and port compatible with ipv6

* Updating go-discover to v1.1.0

* Updating testcases

* chore:added workflow to delete stale branches (#22658)

* upgrade: go to v1.25 (#22652)

* update: go version to 1.25

* update: gotestsum version

* update: mog, buf and deep-copy

* fix: add workaround to install covdata in go toolchain

* update: regen proto files

* fix: install deep-copy with go 1.23

* add: changelog

* update: regen deepcopy files

* fix: non-constant format string in formatter

* upgrade: mockery and proto-gen, and regen files (#22634)

* update: mockery to v3 and generate mocks

* update: protoc-gen to v1.5.1 and regen proto go files

* fix: use InterfaceName_mock.go for filename in mockery

* update: generate mock files with mockery v3

* fix: case in structname in mockery config

* update: testcase errMsg in TestPatchStruct

* update: increase timeout for context in TestSubscribeBackend_IntegrationWithServer_TLSReload

---------

Co-authored-by: Sreeram Narayanan <[email protected]>
Co-authored-by: P Ajay Rao <[email protected]>
Co-authored-by: Vikramarjuna <[email protected]>
@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.18,1.19,1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

4 similar comments
@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.18,1.19,1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.18,1.19,1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.18,1.19,1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.18,1.19,1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.18,1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

29 similar comments
@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

@hc-github-team-consul-core
Copy link
Collaborator

📣 Hi @sreeram77! a backport is missing for this PR [22642] for versions [1.20,1.21] please perform the backport manually and add the following snippet to your backport PR description:

<details>
	<summary> Overview of commits </summary>
		- <<backport commit 1>>
		- <<backport commit 2>>
		...
</details>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/all Apply backports for all active releases per .release/versions.hcl backport/ent/1.18 Changes are backported to 1.18 ent backport/ent/1.19 Changes are backported to 1.19 ent backport/ent/1.20 backport to ent 1.20 backport/1.21 This release series is longer active on CE, use backport/ent/1.21 pr/no-changelog PR does not need a corresponding .changelog entry theme/cli Flags and documentation for the CLI interface theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies theme/envoy/xds Related to Envoy support theme/health-checks Health Check functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants