Skip to content

all: enable and resolve uncheckedInlineErr, preferStringWriter, preferFprint, and deprecatedComment linter checks - #23097

Open
Sahil-4555 wants to merge 13 commits into
erigontech:mainfrom
Sahil-4555:linter/enable-nilvalreturn
Open

all: enable and resolve uncheckedInlineErr, preferStringWriter, preferFprint, and deprecatedComment linter checks#23097
Sahil-4555 wants to merge 13 commits into
erigontech:mainfrom
Sahil-4555:linter/enable-nilvalreturn

Conversation

@Sahil-4555

Copy link
Copy Markdown
Collaborator

Enables four gocritic linter rules (uncheckedInlineErr, preferStringWriter, preferFprint, and deprecatedComment) in .golangci.yml and resolves all code violations across the repository.

  1. uncheckedInlineErr

    • Rule: Flags inlined error initializations where the error variable is not cleanly evaluated in the condition.
    • Changes: Un-inlined error assignment err := utils.SetNodeConfig(...) prior to if err != nil check in cmd/erigon/node/node.go.
  2. preferStringWriter

    • Rule: Prefers w.WriteString(s) over w.Write([]byte(s)) to avoid unnecessary string-to-byte allocations on writers implementing io.StringWriter.
    • Changes: Refactored Write([]byte(...)) calls to WriteString(...) in cmd/rpctest/rpctest/utils.go and db/state/commitment_convert.go.
  3. preferFprint

    • Rule: Prefers fmt.Fprintf(w, ...) over w.WriteString(fmt.Sprintf(...)) for cleaner syntax and reduced allocations.
    • Changes: Refactored string formatting calls to fmt.Fprintf across cmd/capcli/cli.go and execution/commitment/hex_patricia_hashed.go.
  4. deprecatedComment

    • Rule: Enforces standard Go formatting for Deprecated: notices by placing them in a dedicated paragraph so IDEs and Go tooling correctly parse deprecation hints.
    • Changes: Added blank comment lines before Deprecated: notices across:
      • cl/cltypes/solid/hashutil.go
      • node/cli/flags.go
      • p2p/enode/node.go
      • rpc/jsonrpc/eth_deprecated.go
      • rpc/subscription.go

@erigon-copilot

erigon-copilot Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

[SharovBot] 🤖 Closed by automated review.

This PR appears to be an AI-generated stylistic/convention change (linter compliance: preferFprint, preferStringWriter, deprecatedComment fixups) from a non-core contributor.

These types of changes are not being accepted at this time. The changes will be included in a consolidated weekly cleanup PR. If you believe this was closed in error, please reach out to a maintainer.

@erigon-copilot erigon-copilot Bot closed this Aug 7, 2026
@Sahil-4555 Sahil-4555 reopened this Aug 7, 2026
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