Skip to content
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

refactor: clarify variable name #1568

Open
wants to merge 1 commit into
base: v0.34.x-celestia
Choose a base branch
from

Conversation

0xwitty
Copy link

@0xwitty 0xwitty commented Dec 20, 2024

Description

Fix addresses a potential source of confusion in the code where the variable cmd was being reused as a local variable, despite already being defined as an imported package:

cmd "github.com/tendermint/tendermint/cmd/cometbft/commands"

By redefining cmd in the local scope, it could create ambiguity and make the code harder to maintain. To resolve this, the local variable has been renamed to baseCmd, improving clarity and avoiding any potential issues.

Changes:

Before:

cmd := cli.PrepareBaseCmd(rootCmd, "CMT", os.ExpandEnv(filepath.Join("$HOME", cfg.DefaultTendermintDir)))
if err := cmd.Execute(); err != nil {
	panic(err)
}

After:

baseCmd := cli.PrepareBaseCmd(rootCmd, "CMT", os.ExpandEnv(filepath.Join("$HOME", cfg.DefaultTendermintDir)))
if err := baseCmd.Execute(); err != nil {
	panic(err)
}

This adjustment ensures that the code is more readable and less error-prone while maintaining its intended functionality.

PR checklist

  • Tests written/updated
  • Changelog entry added in .changelog (we use
    unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments

@0xwitty 0xwitty requested a review from a team as a code owner December 20, 2024 07:10
@0xwitty 0xwitty requested review from rootulp and rach-id and removed request for a team December 20, 2024 07:10
@rootulp rootulp changed the title fix: Clarify Variable Naming to Avoid Confusion Update main.go fix: clarify variable name Dec 20, 2024
@rootulp rootulp changed the title fix: clarify variable name refactor: clarify variable name Dec 20, 2024
@0xwitty 0xwitty requested a review from rootulp December 21, 2024 12:59
@0xwitty 0xwitty requested a review from rach-id December 24, 2024 07:52
panic(err)
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this fails lint

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.

3 participants