From 309193aae612a94bc8d1ee6f557af204a7720044 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Mon, 27 Jun 2022 16:34:22 +0200 Subject: [PATCH] fix: make linters happy --- Dockerfile | 8 +++++--- app/app.go | 25 +++++++++++++------------ app/encoding.go | 2 +- app/export.go | 1 + cmd/okp4d/genaccounts.go | 1 + cmd/okp4d/root.go | 3 +-- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 79f4c1b8..d9a1283c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ #--- Build stage -FROM golang:1.18.2-alpine3.15 AS go-builder +FROM golang:1.18.2-alpine3.16 AS go-builder WORKDIR /src @@ -7,10 +7,12 @@ WORKDIR /src ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a -RUN set -eux; apk add --no-cache ca-certificates build-base git \ +# hadolint ignore=DL4006 +RUN set -eux \ + && apk add --no-cache ca-certificates=20211220-r0 build-base=0.5-r3 git=2.36.1-r0 \ && sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 7d2239e9f25e96d0d4daba982ce92367aacf0cbd95d2facb8442268f2b1cc1fc \ && sha256sum /lib/libwasmvm_muslc.x86_64.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479 \ - && cp /lib/libwasmvm_muslc.$(uname -m).a /lib/libwasmvm_muslc.a + && cp "/lib/libwasmvm_muslc.$(uname -m).a" /lib/libwasmvm_muslc.a COPY . /src/ diff --git a/app/app.go b/app/app.go index 47aaa98b..d6f5b031 100644 --- a/app/app.go +++ b/app/app.go @@ -146,17 +146,17 @@ var ( // DefaultNodeHome default home directories for the application daemon. DefaultNodeHome string - // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address + // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address. Bech32PrefixAccAddr = AccountAddressPrefix - // Bech32PrefixAccPub defines the Bech32 prefix of an account's public key + // Bech32PrefixAccPub defines the Bech32 prefix of an account's public key. Bech32PrefixAccPub = AccountAddressPrefix + sdk.PrefixPublic - // Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address + // Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address. Bech32PrefixValAddr = AccountAddressPrefix + sdk.PrefixValidator + sdk.PrefixOperator - // Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key + // Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key. Bech32PrefixValPub = AccountAddressPrefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic - // Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address + // Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address. Bech32PrefixConsAddr = AccountAddressPrefix + sdk.PrefixValidator + sdk.PrefixConsensus - // Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key + // Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key. Bech32PrefixConsPub = AccountAddressPrefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic // ModuleBasics defines the module BasicManager is in charge of setting up basic, @@ -223,7 +223,7 @@ func init() { DefaultNodeHome = filepath.Join(userHomeDir, "."+Name) } -// App extends an ABCI application, but with most of its parameters exported. +// OKP4App extends an ABCI application, but with most of its parameters exported. // They are exported for convenience in creating helper functions, as object // capabilities aren't needed for testing. type OKP4App struct { @@ -262,7 +262,7 @@ type OKP4App struct { FeeGrantKeeper feegrantkeeper.Keeper WasmKeeper wasm.Keeper - // make scoped keepers public for test purposes + // make scoped keepers public for test purposes. ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedICAHostKeeper capabilitykeeper.ScopedKeeper ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper @@ -270,14 +270,15 @@ type OKP4App struct { ScopedTransferKeeper capabilitykeeper.ScopedKeeper ScopedWasmKeeper capabilitykeeper.ScopedKeeper - // mm is the module manager + // mm is the module manager. mm *module.Manager - // sm is the simulation manager + // sm is the simulation manager. sm *module.SimulationManager } -// NewOKP4App returns a reference to an initialized OKP4 blockchain app +// NewOKP4App returns a reference to an initialized OKP4 blockchain app. +// nolint:funlen func NewOKP4App( logger log.Logger, db dbm.DB, @@ -671,7 +672,7 @@ func NewOKP4App( wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.WasmKeeper), ) if err != nil { - panic(fmt.Errorf("failed to register snapshot extension: %s", err)) + panic(fmt.Errorf("failed to register snapshot extension: %w", err)) } } diff --git a/app/encoding.go b/app/encoding.go index 00232a9a..a0376b15 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -5,7 +5,7 @@ import ( "github.com/okp4/okp4d/app/params" ) -// MakeEncodingConfig creates a new EncodingConfig with all modules registered +// MakeEncodingConfig creates a new EncodingConfig with all modules registered. func MakeEncodingConfig() params.EncodingConfig { encodingConfig := params.MakeEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) diff --git a/app/export.go b/app/export.go index ffc660dd..8a9a03b7 100644 --- a/app/export.go +++ b/app/export.go @@ -49,6 +49,7 @@ func (app *OKP4App) 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 func (app *OKP4App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { applyAllowedAddrs := false diff --git a/cmd/okp4d/genaccounts.go b/cmd/okp4d/genaccounts.go index 9acf2cea..89b2dc6b 100644 --- a/cmd/okp4d/genaccounts.go +++ b/cmd/okp4d/genaccounts.go @@ -27,6 +27,7 @@ const ( ) // AddGenesisAccountCmd returns add-genesis-account cobra Command. +// nolint:funlen,gocognit,nestif,cyclop func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command { cmd := &cobra.Command{ Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]", diff --git a/cmd/okp4d/root.go b/cmd/okp4d/root.go index 47442e82..698907a9 100644 --- a/cmd/okp4d/root.go +++ b/cmd/okp4d/root.go @@ -37,7 +37,7 @@ import ( "github.com/tendermint/tendermint/libs/log" ) -// NewRootCmd creates a new root command for the OKP4 application +// NewRootCmd creates a new root command for the OKP4 application. func NewRootCmd() (*cobra.Command, params.EncodingConfig) { cfg := sdk.GetConfig() cfg.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub) @@ -80,7 +80,6 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { if err := server.InterceptConfigsPreRunHandler(cmd, "", nil); err != nil { return err - } return nil