From 35ecd70c4cf31cf870eeb0b7e1e7558998132c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20C=2E=20Morency?= <1102868+fmorency@users.noreply.github.com> Date: Thu, 9 May 2024 09:03:34 -0400 Subject: [PATCH] fix: qol (#55) --- .github/workflows/build.yml | 7 +++-- .github/workflows/codeql.yml | 2 +- .github/workflows/e2e.yml | 2 +- .github/workflows/release-bin.yaml | 2 +- .github/workflows/test.yml | 2 +- Makefile | 48 +++++++++++++++++++++++------- app/upgrades/noop/upgrades.go | 2 +- cmd/manifestd/cmd/testnet.go | 2 +- go.mod | 2 +- go.work | 2 +- interchaintest/go.mod | 2 +- interchaintest/helpers/manifest.go | 3 +- interchaintest/mainfest_test.go | 3 +- x/manifest/client/cli/query.go | 2 +- 14 files changed, 56 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 36c6ffc..30153a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ concurrency: cancel-in-progress: true env: - GO_VERSION: 1.22.2 + GO_VERSION: 1.22.3 jobs: build: @@ -36,7 +36,10 @@ jobs: env: GOOS: ${{ matrix.targetos }} GOARCH: ${{ matrix.arch }} - + - name: lint + run: make lint + - name: govulncheck + run: make govulncheck - name: Compile binary run: | go mod download diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index b6a7540..30349c6 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -14,7 +14,7 @@ concurrency: cancel-in-progress: true env: - GO_VERSION: 1.22.2 + GO_VERSION: 1.22.3 jobs: analyze: diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 8c8df43..fd385df 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -16,7 +16,7 @@ permissions: packages: write env: - GO_VERSION: 1.22.2 + GO_VERSION: 1.22.3 TAR_PATH: /tmp/manifest-docker-image.tar IMAGE_NAME: manifest-docker-image diff --git a/.github/workflows/release-bin.yaml b/.github/workflows/release-bin.yaml index 9cca440..d0e1b6e 100644 --- a/.github/workflows/release-bin.yaml +++ b/.github/workflows/release-bin.yaml @@ -20,7 +20,7 @@ jobs: - uses: actions/setup-go@v2 with: - go-version: '1.22.2' + go-version: '1.22.3' - name: Clean up dist directory run: rm -rf dist diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6149417..cfdc56d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ on: types: [opened, reopened, synchronize] env: - GO_VERSION: 1.22.2 + GO_VERSION: 1.22.3 concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/Makefile b/Makefile index 9cf8716..2178e4b 100644 --- a/Makefile +++ b/Makefile @@ -166,15 +166,7 @@ test: @echo "--> Running tests" go test -v ./... -test-integration: - @echo "--> Running integration tests" - cd integration; go test -v ./... - -.PHONY: test test-integration - -################# -### Test ### -################# +.PHONY: test coverage: ## Run coverage report @echo "--> Creating GOCOVERDIR" @@ -227,7 +219,7 @@ proto-lint: ################# golangci_lint_cmd=golangci-lint -golangci_version=v1.51.2 +golangci_version=v1.58.0 lint: @echo "--> Running linter" @@ -239,4 +231,38 @@ lint-fix: @go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version) @$(golangci_lint_cmd) run ./... --fix --timeout 15m -.PHONY: lint lint-fix \ No newline at end of file +.PHONY: lint lint-fix + +#### FORMAT #### +goimports_version=latest + +format-install: + @echo "--> Installing goimports $(goimports_version)" + @go install golang.org/x/tools/cmd/goimports@$(goimports_version) + @echo "--> Installing goimports $(goimports_version) complete" + +format: ## Run formatter (goimports) + @echo "--> Running goimports" + $(MAKE) format-install + @find . -name '*.go' -not -name '*.pulsar.go' -not -name '*.pb.go' -exec goimports -w -local github.com/liftedinit/manifest-ledger {} \; + +#### GOVULNCHECK #### +govulncheck_version=latest + +govulncheck-install: + @echo "--> Installing govulncheck $(govulncheck_version)" + @go install golang.org/x/vuln/cmd/govulncheck@$(govulncheck_version) + @echo "--> Installing govulncheck $(govulncheck_version) complete" + +govulncheck: ## Run govulncheck + @echo "--> Running govulncheck" + $(MAKE) govulncheck-install + @govulncheck ./... + +#### VET #### + +vet: ## Run go vet + @echo "--> Running go vet" + @go vet ./... + +.PHONY: vet diff --git a/app/upgrades/noop/upgrades.go b/app/upgrades/noop/upgrades.go index 5a7ea43..385a1b8 100644 --- a/app/upgrades/noop/upgrades.go +++ b/app/upgrades/noop/upgrades.go @@ -28,7 +28,7 @@ func CreateUpgradeHandler( configurator module.Configurator, _ *upgrades.AppKeepers, ) upgradetypes.UpgradeHandler { - return func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { return mm.RunMigrations(ctx, configurator, fromVM) } } diff --git a/cmd/manifestd/cmd/testnet.go b/cmd/manifestd/cmd/testnet.go index 43f23d6..aa94e62 100644 --- a/cmd/manifestd/cmd/testnet.go +++ b/cmd/manifestd/cmd/testnet.go @@ -92,7 +92,7 @@ func addTestnetFlagsToCmd(cmd *cobra.Command) { cmd.Flags().String(flags.FlagKeyType, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for") // support old flags name for backwards compatibility - cmd.Flags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName { + cmd.Flags().SetNormalizeFunc(func(_ *pflag.FlagSet, name string) pflag.NormalizedName { if name == flags.FlagKeyAlgorithm { name = flags.FlagKeyType } diff --git a/go.mod b/go.mod index 0ca736c..52073a2 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/liftedinit/manifest-ledger -go 1.22.2 +go 1.22.3 replace ( // core v0.12 was tagged wrong (SDK v51) diff --git a/go.work b/go.work index ea5261c..1ef3033 100644 --- a/go.work +++ b/go.work @@ -1,4 +1,4 @@ -go 1.22.2 +go 1.22.3 use ( . diff --git a/interchaintest/go.mod b/interchaintest/go.mod index 82e8aad..e5939ac 100644 --- a/interchaintest/go.mod +++ b/interchaintest/go.mod @@ -1,6 +1,6 @@ module github.com/liftedinit/manifest-ledger/interchaintest -go 1.22.2 +go 1.22.3 replace ( cosmossdk.io/core => cosmossdk.io/core v0.11.0 // proper SDK v50 version diff --git a/interchaintest/helpers/manifest.go b/interchaintest/helpers/manifest.go index 1ed3274..a7aec5c 100644 --- a/interchaintest/helpers/manifest.go +++ b/interchaintest/helpers/manifest.go @@ -6,9 +6,10 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - manifesttypes "github.com/liftedinit/manifest-ledger/x/manifest/types" "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v8/ibc" + + manifesttypes "github.com/liftedinit/manifest-ledger/x/manifest/types" ) func ManifestUpdateParams(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, poaAdmin ibc.Wallet, addressPairs string, automaticInflation string, coinInflationPerYear string, flags ...string) (sdk.TxResponse, error) { diff --git a/interchaintest/mainfest_test.go b/interchaintest/mainfest_test.go index a0e0574..4c2cf3f 100644 --- a/interchaintest/mainfest_test.go +++ b/interchaintest/mainfest_test.go @@ -7,7 +7,6 @@ import ( "testing" sdkmath "cosmossdk.io/math" - "github.com/liftedinit/manifest-ledger/interchaintest/helpers" "github.com/strangelove-ventures/interchaintest/v8" "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v8/testreporter" @@ -16,6 +15,8 @@ import ( "go.uber.org/zap/zapcore" "go.uber.org/zap/zaptest" + "github.com/liftedinit/manifest-ledger/interchaintest/helpers" + sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/manifest/client/cli/query.go b/x/manifest/client/cli/query.go index 1b5f29a..5aa9fba 100644 --- a/x/manifest/client/cli/query.go +++ b/x/manifest/client/cli/query.go @@ -28,7 +28,7 @@ func GetCmdParams() *cobra.Command { Use: "params", Short: "Show all module params", Args: cobra.ExactArgs(0), - 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