Skip to content

Commit

Permalink
chore: upgrade to golangci-lint v1.57.1 (#3219)
Browse files Browse the repository at this point in the history
Motivated by
#3213 (review)
  • Loading branch information
rootulp authored Apr 1, 2024
1 parent fb20954 commit c032708
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
**/**.go
go.mod
go.sum
- uses: golangci/golangci-lint-action@v3.6.0
- uses: golangci/golangci-lint-action@v4.0.0
with:
version: v1.54.2
version: v1.57.1
args: --timeout 10m
github-token: ${{ secrets.github_token }}
if: env.GIT_DIFF
Expand Down
2 changes: 1 addition & 1 deletion app/test/process_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestProcessProposal(t *testing.T) {
{
name: "valid untouched data",
input: validData(),
mutator: func(d *tmproto.Data) {},
mutator: func(_ *tmproto.Data) {},
expectedResult: abci.ResponseProcessProposal_ACCEPT,
},
{
Expand Down
2 changes: 1 addition & 1 deletion cmd/celestia-appd/cmd/addrbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func addrbookCommand() *cobra.Command {
"The first argument (peers.txt) should contain a new line separated list of peers. The format for a peer is `id@ip:port` or `id@domain:port`.\n" +
"The second argument (addrbook.json) should contain the complete file path, including both the directory path and the desired output file name, in the following format: `path/to/filename`. The address book is saved to the output file in JSON format.\n",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
inputFile := args[0]
outputFile := args[1]

Expand Down
8 changes: 4 additions & 4 deletions test/cmd/txsim/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ func command() *cobra.Command {
Use: "txsim",
Short: "Celestia Transaction Simulator",
Long: `
Txsim is a tool for randomized transaction generation on celestia networks. The tool relies on
defined sequences; recursive patterns between one or more accounts which will continually submit
transactions. You can use flags or environment variables (TXSIM_RPC, TXSIM_GRPC, TXSIM_SEED,
Txsim is a tool for randomized transaction generation on celestia networks. The tool relies on
defined sequences; recursive patterns between one or more accounts which will continually submit
transactions. You can use flags or environment variables (TXSIM_RPC, TXSIM_GRPC, TXSIM_SEED,
TXSIM_POLL, TXSIM_KEYPATH) to configure the client. The keyring provided should have at least one
well funded account that can act as the master account. The command runs until all sequences error.`,
Example: "txsim --key-path /path/to/keyring --rpc-endpoints localhost:26657 --grpc-endpoints localhost:9090 --seed 1234 --poll-time 1s --blob 5",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
var (
keys keyring.Keyring
err error
Expand Down
12 changes: 6 additions & 6 deletions test/e2e/cmd/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewCLI() *CLI {
Use: "e2e",
Short: "Command line runner for celestia app e2e framework",
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
file, err := cmd.Flags().GetString("file")
if err != nil {
return err
Expand All @@ -46,7 +46,7 @@ func NewCLI() *CLI {
cli.testnet = testnet
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
ctx := cmd.Context()
if err := e2e.Cleanup(ctx, cli.testnet); err != nil {
return fmt.Errorf("preparing testnet: %w", err)
Expand Down Expand Up @@ -79,31 +79,31 @@ func NewCLI() *CLI {
cli.root.AddCommand(&cobra.Command{
Use: "setup",
Short: "Setups a testnet",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
return e2e.Setup(cmd.Context(), cli.testnet)
},
})

cli.root.AddCommand(&cobra.Command{
Use: "start",
Short: "Starts a testnet",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
return e2e.Start(cmd.Context(), cli.testnet)
},
})

cli.root.AddCommand(&cobra.Command{
Use: "stop",
Short: "Stops a testnet",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
return e2e.Stop(cmd.Context(), cli.testnet)
},
})

cli.root.AddCommand(&cobra.Command{
Use: "cleanup",
Short: "Tears down network and removes all resources",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
return e2e.Cleanup(cmd.Context(), cli.testnet)
},
})
Expand Down
2 changes: 1 addition & 1 deletion x/blob/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestPFBAnteHandler(t *testing.T) {
txBuilder := txConfig.NewTxBuilder()
require.NoError(t, txBuilder.SetMsgs(tc.pfb))
tx := txBuilder.GetTx()
_, err := anteHandler.AnteHandle(ctx, tx, false, func(ctx sdk.Context, tx sdk.Tx, simulate bool) (sdk.Context, error) { return ctx, nil })
_, err := anteHandler.AnteHandle(ctx, tx, false, func(ctx sdk.Context, _ sdk.Tx, _ bool) (sdk.Context, error) { return ctx, nil })
if tc.wantErr {
require.Error(t, err)
} else {
Expand Down
2 changes: 1 addition & 1 deletion x/blob/client/cli/payforblob.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func CmdPayForBlob() *cobra.Command {
// TODO: allow for more than one blob to be sumbmitted via the CLI
"This command currently only supports a single blob per invocation.\n",
Aliases: []string{"PayForBlob"},
Args: func(cmd *cobra.Command, args []string) error {
Args: func(_ *cobra.Command, args []string) error {
if len(args) < 2 {
return fmt.Errorf("PayForBlobs requires two arguments: namespaceID and blob")
}
Expand Down
2 changes: 1 addition & 1 deletion x/blob/client/cli/query_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func CmdQueryParams() *cobra.Command {
Use: "params",
Short: "shows the parameters of the module",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)

queryClient := types.NewQueryClient(clientCtx)
Expand Down
12 changes: 6 additions & 6 deletions x/blob/types/payforblob.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ func NewMsgPayForBlobs(signer string, blobs ...*Blob) (*MsgPayForBlobs, error) {
return nil, err
}

namespaceVersions, namespaceIds, sizes, shareVersions := extractBlobComponents(blobs)
namespaceVersions, namespaceIDs, sizes, shareVersions := extractBlobComponents(blobs)
namespaces := []appns.Namespace{}
for i := range namespaceVersions {
namespace, err := appns.New(uint8(namespaceVersions[i]), namespaceIds[i])
namespace, err := appns.New(uint8(namespaceVersions[i]), namespaceIDs[i])
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -325,20 +325,20 @@ func ValidateBlobs(blobs ...*Blob) error {

// extractBlobComponents separates and returns the components of a slice of
// blobs.
func extractBlobComponents(pblobs []*tmproto.Blob) (namespaceVersions []uint32, namespaceIds [][]byte, sizes []uint32, shareVersions []uint32) {
func extractBlobComponents(pblobs []*tmproto.Blob) (namespaceVersions []uint32, namespaceIDs [][]byte, sizes []uint32, shareVersions []uint32) {
namespaceVersions = make([]uint32, len(pblobs))
namespaceIds = make([][]byte, len(pblobs))
namespaceIDs = make([][]byte, len(pblobs))
sizes = make([]uint32, len(pblobs))
shareVersions = make([]uint32, len(pblobs))

for i, pblob := range pblobs {
namespaceVersions[i] = pblob.NamespaceVersion
namespaceIds[i] = pblob.NamespaceId
namespaceIDs[i] = pblob.NamespaceId
sizes[i] = uint32(len(pblob.Data))
shareVersions[i] = pblob.ShareVersion
}

return namespaceVersions, namespaceIds, sizes, shareVersions
return namespaceVersions, namespaceIDs, sizes, shareVersions
}

// merkleMountainRangeSizes returns the sizes (number of leaf nodes) of the
Expand Down
4 changes: 2 additions & 2 deletions x/blob/types/payforblob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,10 @@ func invalidNamespaceVersionMsgPayForBlobs(t *testing.T) *MsgPayForBlobs {
commitments, err := CreateCommitments(blobs)
require.NoError(t, err)

namespaceVersions, namespaceIds, sizes, shareVersions := extractBlobComponents(blobs)
namespaceVersions, namespaceIDs, sizes, shareVersions := extractBlobComponents(blobs)
namespaces := []appns.Namespace{}
for i := range namespaceVersions {
namespace, err := appns.New(uint8(namespaceVersions[i]), namespaceIds[i])
namespace, err := appns.New(uint8(namespaceVersions[i]), namespaceIDs[i])
require.NoError(t, err)
namespaces = append(namespaces, namespace)
}
Expand Down
6 changes: 3 additions & 3 deletions x/mint/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func GetCmdQueryInflationRate() *cobra.Command {
Use: "inflation",
Short: "Query the current inflation rate",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
Expand Down Expand Up @@ -65,7 +65,7 @@ func GetCmdQueryAnnualProvisions() *cobra.Command {
Use: "annual-provisions",
Short: "Query the current annual provisions",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
Expand Down Expand Up @@ -93,7 +93,7 @@ func GetCmdQueryGenesisTime() *cobra.Command {
Use: "genesis-time",
Short: "Query the genesis time",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion x/qgb/client/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (s *CLITestSuite) TestQueryAttestationByNonce() {
}

for _, tc := range testCases {
s.T().Run(tc.name, func(t *testing.T) {
s.T().Run(tc.name, func(_ *testing.T) {
cmd := client.CmdQueryAttestationByNonce()
clientCtx := val.ClientCtx

Expand Down

0 comments on commit c032708

Please sign in to comment.