Skip to content

Commit

Permalink
Linting.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Mar 21, 2023
1 parent f898466 commit fbc24b8
Show file tree
Hide file tree
Showing 77 changed files with 118 additions and 168 deletions.
2 changes: 1 addition & 1 deletion cmd/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ func init() {
RootCmd.AddCommand(accountCmd)
}

func accountFlags(cmd *cobra.Command) {
func accountFlags(_ *cobra.Command) {
}
2 changes: 1 addition & 1 deletion cmd/account/create/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type dataOut struct {
account e2wtypes.Account
}

func output(ctx context.Context, data *dataOut) (string, error) {
func output(_ context.Context, data *dataOut) (string, error) {
if data == nil {
return "", errors.New("no data")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/derive/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type dataIn struct {
showWithdrawalCredentials bool
}

func input(ctx context.Context) (*dataIn, error) {
func input(_ context.Context) (*dataIn, error) {
data := &dataIn{}

// Quiet.
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/derive/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type dataOut struct {
key *e2types.BLSPrivateKey
}

func output(ctx context.Context, data *dataOut) (string, error) {
func output(_ context.Context, data *dataOut) (string, error) {
if data == nil {
return "", errors.New("no data")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/import/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type dataOut struct {
account e2wtypes.Account
}

func output(ctx context.Context, data *dataOut) (string, error) {
func output(_ context.Context, data *dataOut) (string, error) {
if data == nil {
return "", errors.New("no data")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/account/key/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type dataOut struct {
key []byte
}

func output(ctx context.Context, data *dataOut) (string, error) {
func output(_ context.Context, data *dataOut) (string, error) {
if data == nil {
return "", errors.New("no data")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/attester.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ func init() {
RootCmd.AddCommand(attesterCmd)
}

func attesterFlags(cmd *cobra.Command) {
func attesterFlags(_ *cobra.Command) {
}
2 changes: 1 addition & 1 deletion cmd/attester/duties/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type dataOut struct {
duty *api.AttesterDuty
}

func output(ctx context.Context, data *dataOut) (string, error) {
func output(_ context.Context, data *dataOut) (string, error) {
if data == nil {
return "", errors.New("no data")
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/attester/duties/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) {
verbose: data.verbose,
}

duty, err := duty(ctx, data.eth2Client, validator, data.epoch, data.slotsPerEpoch)
duty, err := duty(ctx, data.eth2Client, validator, data.epoch)
if err != nil {
return nil, errors.Wrap(err, "failed to obtain duty for validator")
}
Expand All @@ -87,7 +87,7 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) {
return results, nil
}

func duty(ctx context.Context, eth2Client eth2client.Service, validator *api.Validator, epoch spec.Epoch, slotsPerEpoch uint64) (*api.AttesterDuty, error) {
func duty(ctx context.Context, eth2Client eth2client.Service, validator *api.Validator, epoch spec.Epoch) (*api.AttesterDuty, error) {
// Find the attesting slot for the given epoch.
duties, err := eth2Client.(eth2client.AttesterDutiesProvider).AttesterDuties(ctx, epoch, []spec.ValidatorIndex{validator.Index})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/attester/inclusion/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type dataOut struct {
targetTimely bool
}

func output(ctx context.Context, data *dataOut) (string, error) {
func output(_ context.Context, data *dataOut) (string, error) {
buf := strings.Builder{}
if data == nil {
return buf.String(), errors.New("no data")
Expand Down
4 changes: 2 additions & 2 deletions cmd/attester/inclusion/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) {
verbose: data.verbose,
}

duty, err := duty(ctx, data.eth2Client, validator, data.epoch, data.slotsPerEpoch)
duty, err := duty(ctx, data.eth2Client, validator, data.epoch)
if err != nil {
return nil, errors.Wrap(err, "failed to obtain duty for validator")
}
Expand Down Expand Up @@ -175,7 +175,7 @@ func calcTargetCorrect(ctx context.Context, data *dataIn, attestation *phase0.At
}
}

func duty(ctx context.Context, eth2Client eth2client.Service, validator *api.Validator, epoch phase0.Epoch, slotsPerEpoch uint64) (*api.AttesterDuty, error) {
func duty(ctx context.Context, eth2Client eth2client.Service, validator *api.Validator, epoch phase0.Epoch) (*api.AttesterDuty, error) {
// Find the attesting slot for the given epoch.
duties, err := eth2Client.(eth2client.AttesterDutiesProvider).AttesterDuties(ctx, epoch, []phase0.ValidatorIndex{validator.Index})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ func init() {
RootCmd.AddCommand(blockCmd)
}

func blockFlags(cmd *cobra.Command) {
func blockFlags(_ *cobra.Command) {
}
2 changes: 1 addition & 1 deletion cmd/block/analyze/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ type attestationData struct {
Index int `json:"index"`
}

func newCommand(ctx context.Context) (*command, error) {
func newCommand(_ context.Context) (*command, error) {
c := &command{
quiet: viper.GetBool("quiet"),
verbose: viper.GetBool("verbose"),
Expand Down
3 changes: 1 addition & 2 deletions cmd/block/analyze/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ func (c *command) outputTxt(_ context.Context) (string, error) {
if attestation.NewVotes == 0 {
builder.WriteString("\n")
continue
} else {
builder.WriteString(", ")
}
builder.WriteString(", ")
switch {
case !attestation.HeadCorrect:
builder.WriteString("head vote incorrect, ")
Expand Down
10 changes: 3 additions & 7 deletions cmd/block/analyze/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ func (c *command) analyze(ctx context.Context, block *spec.VersionedSignedBeacon
return err
}

if err := c.analyzeSyncCommittees(ctx, block); err != nil {
return err
}

return nil
return c.analyzeSyncCommittees(ctx, block)
}

func (c *command) analyzeAttestations(ctx context.Context, block *spec.VersionedSignedBeaconBlock) error {
Expand Down Expand Up @@ -213,7 +209,7 @@ func (c *command) fetchParents(ctx context.Context, block *spec.VersionedSignedB
return c.fetchParents(ctx, parentBlock, minSlot)
}

func (c *command) processParentBlock(ctx context.Context, block *spec.VersionedSignedBeaconBlock) error {
func (c *command) processParentBlock(_ context.Context, block *spec.VersionedSignedBeaconBlock) error {
attestations, err := block.Attestations()
if err != nil {
return err
Expand Down Expand Up @@ -412,7 +408,7 @@ func (c *command) calcTargetCorrect(ctx context.Context, attestation *phase0.Att
return bytes.Equal(root[:], attestation.Data.Target.Root[:]), nil
}

func (c *command) analyzeSyncCommittees(ctx context.Context, block *spec.VersionedSignedBeaconBlock) error {
func (c *command) analyzeSyncCommittees(_ context.Context, block *spec.VersionedSignedBeaconBlock) error {
c.analysis.SyncCommitee = &syncCommitteeAnalysis{}
switch block.Version {
case spec.DataVersionPhase0:
Expand Down
12 changes: 6 additions & 6 deletions cmd/block/info/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ type dataOut struct {
slotsPerEpoch uint64
}

func output(ctx context.Context, data *dataOut) (string, error) {
func output(_ context.Context, data *dataOut) (string, error) {
if data == nil {
return "", errors.New("no data")
}

return "", nil
}

func outputBlockGeneral(ctx context.Context,
func outputBlockGeneral(_ context.Context,
verbose bool,
slot phase0.Slot,
blockRoot phase0.Root,
Expand Down Expand Up @@ -89,7 +89,7 @@ func outputBlockGeneral(ctx context.Context,
return res.String(), nil
}

func outputBlockETH1Data(ctx context.Context, eth1Data *phase0.ETH1Data) (string, error) {
func outputBlockETH1Data(_ context.Context, eth1Data *phase0.ETH1Data) (string, error) {
res := strings.Builder{}

res.WriteString(fmt.Sprintf("Ethereum 1 deposit count: %d\n", eth1Data.DepositCount))
Expand Down Expand Up @@ -194,7 +194,7 @@ func outputBlockAttesterSlashings(ctx context.Context, eth2Client eth2client.Ser
return res.String(), nil
}

func outputBlockDeposits(ctx context.Context, verbose bool, deposits []*phase0.Deposit) (string, error) {
func outputBlockDeposits(_ context.Context, verbose bool, deposits []*phase0.Deposit) (string, error) {
res := strings.Builder{}

// Deposits.
Expand Down Expand Up @@ -638,7 +638,7 @@ func outputPhase0BlockText(ctx context.Context, data *dataOut, signedBlock *phas
return res.String(), nil
}

func outputCapellaBlockExecutionPayload(ctx context.Context,
func outputCapellaBlockExecutionPayload(_ context.Context,
verbose bool,
payload *capella.ExecutionPayload,
) (
Expand Down Expand Up @@ -706,7 +706,7 @@ func outputCapellaBlockExecutionPayload(ctx context.Context,
return res.String(), nil
}

func outputBellatrixBlockExecutionPayload(ctx context.Context,
func outputBellatrixBlockExecutionPayload(_ context.Context,
verbose bool,
payload *bellatrix.ExecutionPayload,
) (
Expand Down
2 changes: 1 addition & 1 deletion cmd/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ func init() {
RootCmd.AddCommand(chainCmd)
}

func chainFlags(cmd *cobra.Command) {
func chainFlags(_ *cobra.Command) {
}
2 changes: 1 addition & 1 deletion cmd/chain/eth1votes/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type vote struct {
Count int `json:"count"`
}

func newCommand(ctx context.Context) (*command, error) {
func newCommand(_ context.Context) (*command, error) {
c := &command{
quiet: viper.GetBool("quiet"),
verbose: viper.GetBool("verbose"),
Expand Down
4 changes: 2 additions & 2 deletions cmd/chain/eth1votes/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (c *command) output(ctx context.Context) (string, error) {
return c.outputText(ctx)
}

func (c *command) outputJSON(ctx context.Context) (string, error) {
func (c *command) outputJSON(_ context.Context) (string, error) {
votes := make([]*vote, 0, len(c.votes))
totalVotes := 0
for _, vote := range c.votes {
Expand Down Expand Up @@ -71,7 +71,7 @@ func (c *command) outputJSON(ctx context.Context) (string, error) {
return string(data), nil
}

func (c *command) outputText(ctx context.Context) (string, error) {
func (c *command) outputText(_ context.Context) (string, error) {
builder := strings.Builder{}

builder.WriteString("Voting period: ")
Expand Down
2 changes: 1 addition & 1 deletion cmd/chain/queues/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type command struct {
exitQueue int
}

func newCommand(ctx context.Context) (*command, error) {
func newCommand(_ context.Context) (*command, error) {
c := &command{
quiet: viper.GetBool("quiet"),
verbose: viper.GetBool("verbose"),
Expand Down
4 changes: 2 additions & 2 deletions cmd/chain/queues/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (c *command) output(ctx context.Context) (string, error) {
return c.outputText(ctx)
}

func (c *command) outputJSON(ctx context.Context) (string, error) {
func (c *command) outputJSON(_ context.Context) (string, error) {
output := &jsonOutput{
ActivationQueue: c.activationQueue,
ExitQueue: c.exitQueue,
Expand All @@ -49,7 +49,7 @@ func (c *command) outputJSON(ctx context.Context) (string, error) {
return string(data), nil
}

func (c *command) outputText(ctx context.Context) (string, error) {
func (c *command) outputText(_ context.Context) (string, error) {
builder := strings.Builder{}

if c.activationQueue > 0 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/chain/time/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type dataIn struct {
epoch string
}

func input(ctx context.Context) (*dataIn, error) {
func input(_ context.Context) (*dataIn, error) {
data := &dataIn{}

if viper.GetDuration("timeout") == 0 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/chain/time/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type dataOut struct {
syncCommitteePeriodEpochEnd spec.Epoch
}

func output(ctx context.Context, data *dataOut) (string, error) {
func output(_ context.Context, data *dataOut) (string, error) {
if data == nil {
return "", errors.New("no data")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/chain/verify/signedcontributionandproof/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type command struct {
additionalInfo string
}

func newCommand(ctx context.Context) (*command, error) {
func newCommand(_ context.Context) (*command, error) {
c := &command{
quiet: viper.GetBool("quiet"),
verbose: viper.GetBool("verbose"),
Expand Down
2 changes: 1 addition & 1 deletion cmd/chain/verify/signedcontributionandproof/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"strings"
)

func (c *command) output(ctx context.Context) (string, error) {
func (c *command) output(_ context.Context) (string, error) {
if c.quiet {
return "", nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ func init() {
RootCmd.AddCommand(depositCmd)
}

func depositFlags(cmd *cobra.Command) {
func depositFlags(_ *cobra.Command) {
}
2 changes: 1 addition & 1 deletion cmd/epoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func init() {
RootCmd.AddCommand(epochCmd)
}

func epochFlags(cmd *cobra.Command) {
func epochFlags(_ *cobra.Command) {
epochSummaryCmd.Flags().String("epoch", "", "the epoch for which to obtain information (default current, can be 'current', 'last' or a number)")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/epoch/summary/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ type nonParticipatingValidator struct {
Committee phase0.CommitteeIndex `json:"committee_index"`
}

func newCommand(ctx context.Context) (*command, error) {
func newCommand(_ context.Context) (*command, error) {
c := &command{
quiet: viper.GetBool("quiet"),
verbose: viper.GetBool("verbose"),
Expand Down
6 changes: 1 addition & 5 deletions cmd/epoch/summary/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ func (c *command) process(ctx context.Context) error {
if err := c.processAttesterDuties(ctx); err != nil {
return err
}
if err := c.processSyncCommitteeDuties(ctx); err != nil {
return err
}

return nil
return c.processSyncCommitteeDuties(ctx)
}

func (c *command) processProposerDuties(ctx context.Context) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ func init() {
RootCmd.AddCommand(exitCmd)
}

func exitFlags(cmd *cobra.Command) {
func exitFlags(_ *cobra.Command) {
}
2 changes: 1 addition & 1 deletion cmd/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ func init() {
RootCmd.AddCommand(nodeCmd)
}

func nodeFlags(cmd *cobra.Command) {
func nodeFlags(_ *cobra.Command) {
}
2 changes: 1 addition & 1 deletion cmd/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ func init() {
RootCmd.AddCommand(proposerCmd)
}

func proposerFlags(cmd *cobra.Command) {
func proposerFlags(_ *cobra.Command) {
}
2 changes: 1 addition & 1 deletion cmd/proposer/duties/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type results struct {
Duties []*apiv1.ProposerDuty `json:"duties"`
}

func newCommand(ctx context.Context) (*command, error) {
func newCommand(_ context.Context) (*command, error) {
c := &command{
quiet: viper.GetBool("quiet"),
verbose: viper.GetBool("verbose"),
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var RootCmd = &cobra.Command{
PersistentPreRunE: persistentPreRunE,
}

func persistentPreRunE(cmd *cobra.Command, args []string) error {
func persistentPreRunE(cmd *cobra.Command, _ []string) error {
if cmd.Name() == "help" {
// User just wants help
return nil
Expand Down
Loading

0 comments on commit fbc24b8

Please sign in to comment.