From 4c07c87fac3da3e87108be2669189431bd92e012 Mon Sep 17 00:00:00 2001 From: Christophe Camel Date: Wed, 2 Feb 2022 12:07:03 +0100 Subject: [PATCH] style: make go linter happy again --- app/app.go | 25 +++++++++++++------------ app/export.go | 2 +- app/simulation_test.go | 2 +- testutil/network/network.go | 2 +- testutil/nullify/nullify.go | 1 + testutil/sample/sample.go | 2 +- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/app.go b/app/app.go index 698cb97bc..17482c0ce 100644 --- a/app/app.go +++ b/app/app.go @@ -119,7 +119,7 @@ func getGovProposalHandlers() []govclient.ProposalHandler { } var ( - // DefaultNodeHome default home directories for the application daemon + // DefaultNodeHome default home directories for the application daemon. DefaultNodeHome string // ModuleBasics defines the module BasicManager is in charge of setting up basic, @@ -146,7 +146,7 @@ var ( // this line is used by starport scaffolding # stargate/app/moduleBasic ) - // module account permissions + // module account permissions. maccPerms = map[string][]string{ authtypes.FeeCollectorName: nil, distrtypes.ModuleName: nil, @@ -222,6 +222,7 @@ type App struct { } // New returns a reference to an initialized blockchain app +// nolint:funlen // This function is generated by starport func New( logger log.Logger, db dbm.DB, @@ -482,23 +483,23 @@ func New( return app } -// Name returns the name of the App +// Name returns the name of the App. func (app *App) Name() string { return app.BaseApp.Name() } -// GetBaseApp returns the base app of the application +// GetBaseApp returns the base app of the application. func (app App) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } -// BeginBlocker application updates every begin block +// BeginBlocker application updates every begin block. func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) } -// EndBlocker application updates every end block +// EndBlocker application updates every end block. func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { return app.mm.EndBlock(ctx, req) } -// InitChainer application update at chain initialization +// InitChainer application update at chain initialization. func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { var genesisState GenesisState if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { @@ -508,7 +509,7 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res return app.mm.InitGenesis(ctx, app.appCodec, genesisState) } -// LoadHeight loads a particular height +// LoadHeight loads a particular height. func (app *App) LoadHeight(height int64) error { return app.LoadVersion(height) } @@ -539,7 +540,7 @@ func (app *App) AppCodec() codec.Codec { return app.appCodec } -// InterfaceRegistry returns an InterfaceRegistry +// InterfaceRegistry returns an InterfaceRegistry. func (app *App) InterfaceRegistry() types.InterfaceRegistry { return app.interfaceRegistry } @@ -604,7 +605,7 @@ func (app *App) RegisterTendermintService(clientCtx client.Context) { tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry) } -// GetMaccPerms returns a copy of the module account permissions +// GetMaccPerms returns a copy of the module account permissions. func GetMaccPerms() map[string][]string { dupMaccPerms := make(map[string][]string) for k, v := range maccPerms { @@ -613,7 +614,7 @@ func GetMaccPerms() map[string][]string { return dupMaccPerms } -// initParamsKeeper init params keeper and its subspaces +// initParamsKeeper init params keeper and its subspaces. func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) paramskeeper.Keeper { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) @@ -632,7 +633,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino return paramsKeeper } -// SimulationManager implements the SimulationApp interface +// SimulationManager implements the SimulationApp interface. func (app *App) SimulationManager() *module.SimulationManager { return app.sm } diff --git a/app/export.go b/app/export.go index a744e5496..162d71977 100644 --- a/app/export.go +++ b/app/export.go @@ -18,7 +18,6 @@ import ( func (app *App) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []string, ) (servertypes.ExportedApp, error) { - // as if they could withdraw from the start of the next block ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) @@ -51,6 +50,7 @@ func (app *App) ExportAppStateAndValidators( // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated // in favour of export at a block height +// nolint:funlen // This is an auto generated function by starport. func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { applyAllowedAddrs := false diff --git a/app/simulation_test.go b/app/simulation_test.go index 22eada914..b94bcb6d6 100644 --- a/app/simulation_test.go +++ b/app/simulation_test.go @@ -58,7 +58,7 @@ var defaultConsensusParams = &abci.ConsensusParams{ // Running using starport command: // `starport chain simulate -v --numBlocks 200 --blockSize 50` // Running as go benchmark test: -// `go test -benchmem -run=^$ -bench ^BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true` +// `go test -benchmem -run=^$ -bench ^BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true`. func BenchmarkSimulation(b *testing.B) { simapp.FlagEnabledValue = true simapp.FlagCommitValue = true diff --git a/testutil/network/network.go b/testutil/network/network.go index 22b8a5bdd..704e186a6 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -44,7 +44,7 @@ func New(t *testing.T, configs ...network.Config) *network.Network { } // DefaultConfig will initialize config for the network with custom application, -// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig +// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig. func DefaultConfig() network.Config { encoding := cosmoscmd.MakeEncodingConfig(app.ModuleBasics) return network.Config{ diff --git a/testutil/nullify/nullify.go b/testutil/nullify/nullify.go index 3b968c09c..b5c8a7eee 100644 --- a/testutil/nullify/nullify.go +++ b/testutil/nullify/nullify.go @@ -16,6 +16,7 @@ var ( // Fill analyze all struct fields and slices with // reflection and initialize the nil and empty slices, // structs, and pointers. +// nolint: exhaustive func Fill(x interface{}) interface{} { v := reflect.Indirect(reflect.ValueOf(x)) switch v.Kind() { diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 98f2153ed..671742a41 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// AccAddress returns a sample account address +// AccAddress returns a sample account address. func AccAddress() string { pk := ed25519.GenPrivKey().PubKey() addr := pk.Address()