From d91979b24fe3e20b4a1d0b6ebec5cf6e7f1633b2 Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Thu, 19 Oct 2023 17:13:29 +0200 Subject: [PATCH] fix: fix some lint issues (#3691) * update lint and add some lint fixes * remove panic from faucet responses * improve jsonfile tests * fix some lint issues * remove unused file * fix more lint issue * fix error handler for plugins tests * rollback some test assertions * rollback lint ci file * remove unused files and comments --------- Co-authored-by: Pantani --- .github/workflows/test-lint.yml | 1 + ignite/cmd/plugin_test.go | 4 +- ignite/internal/tools/gen-cli-docs/main.go | 2 +- ignite/pkg/cliui/clispinner/clispinner.go | 4 +- ignite/pkg/cliui/view/errorview/error.go | 4 +- ignite/pkg/cmdrunner/cmdrunner.go | 4 +- .../pkg/cosmosanalysis/cosmosanalysis_test.go | 4 +- .../pkg/cosmosanalysis/testdata/chain/go.sum | 1 + ignite/pkg/cosmosfaucet/http_faucet.go | 6 +-- ignite/pkg/cosmosfaucet/http_openapi.go | 2 +- .../adapter/postgres/postgres.go | 2 +- .../adapter/postgres/postgres_test.go | 3 +- ignite/pkg/debugger/server.go | 2 +- ignite/pkg/jsonfile/jsonfile.go | 24 ++++++++---- ignite/pkg/jsonfile/jsonfile_test.go | 39 ++++++++++++------- ignite/pkg/openapiconsole/console.go | 2 +- .../truncatedbuffer/truncatedbuffer_test.go | 9 +++-- ignite/pkg/xgenny/xgenny.go | 9 ++++- ignite/pkg/xhttp/response.go | 2 +- ignite/pkg/xhttp/server.go | 2 +- ignite/services/chain/runtime.go | 12 ++++-- ignite/services/doctor/doctor.go | 6 ++- ignite/services/plugin/interface.go | 14 +++---- ignite/services/plugin/plugin.go | 2 +- ignite/services/plugin/plugin_test.go | 3 +- integration/network/network_test.go | 1 + integration/node/cmd_query_bank_test.go | 2 +- 27 files changed, 105 insertions(+), 61 deletions(-) diff --git a/.github/workflows/test-lint.yml b/.github/workflows/test-lint.yml index 58c3d30fbb..9da1c01b40 100644 --- a/.github/workflows/test-lint.yml +++ b/.github/workflows/test-lint.yml @@ -6,6 +6,7 @@ on: - '**.md' branches: - main + - release/* concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} diff --git a/ignite/cmd/plugin_test.go b/ignite/cmd/plugin_test.go index baded90f0a..e8e154f62f 100644 --- a/ignite/cmd/plugin_test.go +++ b/ignite/cmd/plugin_test.go @@ -332,7 +332,7 @@ ignite rootCmd := buildRootCmd() tt.setup(t, pi) - linkPlugins(rootCmd, []*plugin.Plugin{p}) + _ = linkPlugins(rootCmd, []*plugin.Plugin{p}) if tt.expectedError != "" { require.Error(p.Error) @@ -540,7 +540,7 @@ func TestLinkPluginHooks(t *testing.T) { rootCmd := buildRootCmd() tt.setup(t, pi) - linkPlugins(rootCmd, []*plugin.Plugin{p}) + _ = linkPlugins(rootCmd, []*plugin.Plugin{p}) if tt.expectedError != "" { require.EqualError(p.Error, tt.expectedError) diff --git a/ignite/internal/tools/gen-cli-docs/main.go b/ignite/internal/tools/gen-cli-docs/main.go index 7370e368db..0768131bf3 100644 --- a/ignite/internal/tools/gen-cli-docs/main.go +++ b/ignite/internal/tools/gen-cli-docs/main.go @@ -123,7 +123,7 @@ func generateCmd(cmd *cobra.Command, w io.Writer) error { continue } - io.WriteString(w, "\n") + _, _ = io.WriteString(w, "\n") if err := generateCmd(cmd, w); err != nil { return err diff --git a/ignite/pkg/cliui/clispinner/clispinner.go b/ignite/pkg/cliui/clispinner/clispinner.go index 1a5c628a41..5bc6c5b48b 100644 --- a/ignite/pkg/cliui/clispinner/clispinner.go +++ b/ignite/pkg/cliui/clispinner/clispinner.go @@ -93,7 +93,7 @@ func (s *Spinner) SetCharset(charset []string) *Spinner { // SetColor sets the prefix for spinner. func (s *Spinner) SetColor(color string) *Spinner { - s.sp.Color(color) + _ = s.sp.Color(color) return s } @@ -107,7 +107,7 @@ func (s *Spinner) Start() *Spinner { func (s *Spinner) Stop() *Spinner { s.sp.Stop() s.sp.Prefix = "" - s.sp.Color(spinnerColor) + _ = s.sp.Color(spinnerColor) s.sp.UpdateCharSet(charset) s.sp.Stop() return s diff --git a/ignite/pkg/cliui/view/errorview/error.go b/ignite/pkg/cliui/view/errorview/error.go index 2eca7ef1cc..e0b4c47ef4 100644 --- a/ignite/pkg/cliui/view/errorview/error.go +++ b/ignite/pkg/cliui/view/errorview/error.go @@ -21,8 +21,8 @@ func (e Error) String() string { w := wordwrap.NewWriter(80) w.Breakpoints = []rune{' '} - w.Write([]byte(s)) - w.Close() + _, _ = w.Write([]byte(s)) + _ = w.Close() return colors.Error(w.String()) } diff --git a/ignite/pkg/cmdrunner/cmdrunner.go b/ignite/pkg/cmdrunner/cmdrunner.go index ad31599c62..7f33b56d83 100644 --- a/ignite/pkg/cmdrunner/cmdrunner.go +++ b/ignite/pkg/cmdrunner/cmdrunner.go @@ -189,7 +189,7 @@ type cmdSignal struct { *exec.Cmd } -func (e *cmdSignal) Signal(s os.Signal) { e.Cmd.Process.Signal(s) } +func (e *cmdSignal) Signal(s os.Signal) { _ = e.Cmd.Process.Signal(s) } func (e *cmdSignal) Write([]byte) (n int, err error) { return 0, nil } @@ -199,7 +199,7 @@ type cmdSignalWithWriter struct { w io.WriteCloser } -func (e *cmdSignalWithWriter) Signal(s os.Signal) { e.Cmd.Process.Signal(s) } +func (e *cmdSignalWithWriter) Signal(s os.Signal) { _ = e.Cmd.Process.Signal(s) } func (e *cmdSignalWithWriter) Write(data []byte) (n int, err error) { defer e.w.Close() diff --git a/ignite/pkg/cosmosanalysis/cosmosanalysis_test.go b/ignite/pkg/cosmosanalysis/cosmosanalysis_test.go index b1c8236267..f0421a523b 100644 --- a/ignite/pkg/cosmosanalysis/cosmosanalysis_test.go +++ b/ignite/pkg/cosmosanalysis/cosmosanalysis_test.go @@ -156,10 +156,12 @@ func TestFindImplementationNotFound(t *testing.T) { // No implementation found, err := cosmosanalysis.FindImplementation(tmpDir1, expectedInterface) + require.NoError(t, err) require.Len(t, found, 0) // Partial implementation found, err = cosmosanalysis.FindImplementation(tmpDir2, expectedInterface) + require.NoError(t, err) require.Len(t, found, 0) } @@ -189,7 +191,7 @@ func TestFindAppFilePath(t *testing.T) { appTestFilePath := filepath.Join(secondaryAppFolder, "my_own_app_test.go") err = os.WriteFile(appTestFilePath, appTestFile, 0o644) require.NoError(t, err) - pathFound, err = cosmosanalysis.FindAppFilePath(tmpDir) + _, err = cosmosanalysis.FindAppFilePath(tmpDir) require.Error(t, err) require.Contains(t, err.Error(), "cannot locate your app.go") diff --git a/ignite/pkg/cosmosanalysis/testdata/chain/go.sum b/ignite/pkg/cosmosanalysis/testdata/chain/go.sum index 4e66ab4cad..5dad4f8a10 100644 --- a/ignite/pkg/cosmosanalysis/testdata/chain/go.sum +++ b/ignite/pkg/cosmosanalysis/testdata/chain/go.sum @@ -261,6 +261,7 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= github.com/cometbft/cometbft v0.37.1/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= +github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= diff --git a/ignite/pkg/cosmosfaucet/http_faucet.go b/ignite/pkg/cosmosfaucet/http_faucet.go index 66b15d2ea1..5eff67c0f9 100644 --- a/ignite/pkg/cosmosfaucet/http_faucet.go +++ b/ignite/pkg/cosmosfaucet/http_faucet.go @@ -69,7 +69,7 @@ type FaucetInfoResponse struct { } func (f Faucet) faucetInfoHandler(w http.ResponseWriter, _ *http.Request) { - xhttp.ResponseJSON(w, http.StatusOK, FaucetInfoResponse{ + _ = xhttp.ResponseJSON(w, http.StatusOK, FaucetInfoResponse{ IsAFaucet: true, ChainID: f.chainID, }) @@ -94,11 +94,11 @@ func (f Faucet) coinsFromRequest(req TransferRequest) (sdk.Coins, error) { } func responseSuccess(w http.ResponseWriter) { - xhttp.ResponseJSON(w, http.StatusOK, TransferResponse{}) + _ = xhttp.ResponseJSON(w, http.StatusOK, TransferResponse{}) } func responseError(w http.ResponseWriter, code int, err error) { - xhttp.ResponseJSON(w, code, TransferResponse{ + _ = xhttp.ResponseJSON(w, code, TransferResponse{ Error: err.Error(), }) } diff --git a/ignite/pkg/cosmosfaucet/http_openapi.go b/ignite/pkg/cosmosfaucet/http_openapi.go index 05457fcb1a..a5533ec79d 100644 --- a/ignite/pkg/cosmosfaucet/http_openapi.go +++ b/ignite/pkg/cosmosfaucet/http_openapi.go @@ -21,5 +21,5 @@ type openAPIData struct { } func (f Faucet) openAPISpecHandler(w http.ResponseWriter, _ *http.Request) { - tmplOpenAPISpec.Execute(w, f.openAPIData) + _ = tmplOpenAPISpec.Execute(w, f.openAPIData) } diff --git a/ignite/pkg/cosmostxcollector/adapter/postgres/postgres.go b/ignite/pkg/cosmostxcollector/adapter/postgres/postgres.go index c88b7acd9c..9a008ac871 100644 --- a/ignite/pkg/cosmostxcollector/adapter/postgres/postgres.go +++ b/ignite/pkg/cosmostxcollector/adapter/postgres/postgres.go @@ -176,7 +176,7 @@ func (a Adapter) Save(ctx context.Context, txs []cosmosclient.TX) error { } // Rollback won't have any effect if the transaction is committed before - defer sqlTx.Rollback() + defer sqlTx.Rollback() //nolint:errcheck // Prepare insert statements to speed up "bulk" saving times txStmt, err := sqlTx.PrepareContext(ctx, sqlInsertTX) diff --git a/ignite/pkg/cosmostxcollector/adapter/postgres/postgres_test.go b/ignite/pkg/cosmostxcollector/adapter/postgres/postgres_test.go index 7cce2c6f57..05b4d1c61c 100644 --- a/ignite/pkg/cosmostxcollector/adapter/postgres/postgres_test.go +++ b/ignite/pkg/cosmostxcollector/adapter/postgres/postgres_test.go @@ -231,7 +231,8 @@ func TestQuery(t *testing.T) { // Act cr, err := adapter.Query(ctx, qry) if cr.Next() { - cr.Scan(&rowValue) + err = cr.Scan(&rowValue) + require.NoError(t, err) } // Assert diff --git a/ignite/pkg/debugger/server.go b/ignite/pkg/debugger/server.go index a83c3b6026..9e6e14d431 100644 --- a/ignite/pkg/debugger/server.go +++ b/ignite/pkg/debugger/server.go @@ -124,7 +124,7 @@ func Start(ctx context.Context, binaryPath string, options ...Option) (err error return fmt.Errorf("failed to run debug server: %w", err) } - defer server.Stop() + defer server.Stop() //nolint:errcheck // Wait until the context is done or the connected client disconnects select { diff --git a/ignite/pkg/jsonfile/jsonfile.go b/ignite/pkg/jsonfile/jsonfile.go index 5738422a4e..7ee796be6b 100644 --- a/ignite/pkg/jsonfile/jsonfile.go +++ b/ignite/pkg/jsonfile/jsonfile.go @@ -180,20 +180,28 @@ func (f *JSONFile) Field(key string, param interface{}) error { switch dataType { case jsonparser.Boolean, jsonparser.Array, jsonparser.Number, jsonparser.Object: err := json.Unmarshal(value, param) - if _, ok := err.(*json.UnmarshalTypeError); ok { //nolint:errorlint + var unmarshalTypeError *json.UnmarshalTypeError + if errors.As(err, &unmarshalTypeError) { return ErrInvalidValueType - } else if err != nil { - return err } case jsonparser.String: - paramStr, ok := param.(*string) - if !ok { - return ErrInvalidValueType - } - *paramStr, err = jsonparser.ParseString(value) + result, err := jsonparser.ParseString(value) if err != nil { return err } + paramStr, ok := param.(*string) + if ok { + *paramStr = result + break + } + var ( + unmarshalTypeError *json.UnmarshalTypeError + syntaxTypeError *json.SyntaxError + ) + if err := json.Unmarshal(value, param); errors.As(err, &unmarshalTypeError) || + errors.As(err, &syntaxTypeError) { + return ErrInvalidValueType + } case jsonparser.NotExist: case jsonparser.Null: case jsonparser.Unknown: diff --git a/ignite/pkg/jsonfile/jsonfile_test.go b/ignite/pkg/jsonfile/jsonfile_test.go index edb243b6ab..da2e073c39 100644 --- a/ignite/pkg/jsonfile/jsonfile_test.go +++ b/ignite/pkg/jsonfile/jsonfile_test.go @@ -115,13 +115,15 @@ func TestJSONFile_Field(t *testing.T) { } func TestJSONFile_Update(t *testing.T) { - jsonCoins, err := json.Marshal(sdk.NewCoin("bar", sdk.NewInt(500))) + coins := sdk.NewCoin("bar", sdk.NewInt(500)) + jsonCoins, err := json.Marshal(coins) require.NoError(t, err) tests := []struct { name string filepath string opts []UpdateFileOption + want []interface{} err error }{ { @@ -133,6 +135,7 @@ func TestJSONFile_Update(t *testing.T) { "22020096", ), }, + want: []interface{}{float64(22020096)}, }, { name: "update string field to number", @@ -143,6 +146,7 @@ func TestJSONFile_Update(t *testing.T) { 22020096, ), }, + want: []interface{}{float64(22020096)}, }, { name: "update number field", @@ -153,9 +157,10 @@ func TestJSONFile_Update(t *testing.T) { 1000, ), }, + want: []interface{}{float64(1000)}, }, { - name: "update coin field", + name: "update timestamp field", filepath: "testdata/jsonfile.json", opts: []UpdateFileOption{ WithKeyValueTimestamp( @@ -163,9 +168,10 @@ func TestJSONFile_Update(t *testing.T) { 10000000, ), }, + want: nil, // TODO find a way to test timestamp values }, { - name: "update all values type", + name: "update two values type", filepath: "testdata/jsonfile.json", opts: []UpdateFileOption{ WithKeyValue( @@ -176,14 +182,11 @@ func TestJSONFile_Update(t *testing.T) { "consensus_params.block.time_iota_ms", 1000, ), - WithKeyValueTimestamp( - "genesis_time", - 999999999, - ), }, + want: []interface{}{float64(3000000), float64(1000)}, }, { - name: "update bytes", + name: "update coin field", filepath: "testdata/jsonfile.json", opts: []UpdateFileOption{ WithKeyValueByte( @@ -191,6 +194,10 @@ func TestJSONFile_Update(t *testing.T) { jsonCoins, ), }, + want: []interface{}{map[string]interface{}{ + "denom": coins.Denom, + "amount": coins.Amount.String(), + }}, }, { name: "add non-existing field", @@ -201,6 +208,7 @@ func TestJSONFile_Update(t *testing.T) { "111", ), }, + want: []interface{}{float64(111)}, }, } for _, tt := range tests { @@ -238,10 +246,15 @@ func TestJSONFile_Update(t *testing.T) { for _, opt := range tt.opts { opt(updates) } - for key, value := range updates { - newValue := value - err = f.Field(key, &newValue) - require.Equal(t, value, newValue) + if tt.want != nil { + got := make([]interface{}, 0) + for key := range updates { + var newValue interface{} + err := f.Field(key, &newValue) + require.NoError(t, err) + got = append(got, newValue) + } + require.ElementsMatch(t, tt.want, got) } }) } @@ -333,7 +346,7 @@ func TestFromURL(t *testing.T) { { name: "invalid link", args: args{ - url: "https://github.com/invalid_example.json", + url: "https://google.com/invalid_example.json", }, err: ErrInvalidURL, }, diff --git a/ignite/pkg/openapiconsole/console.go b/ignite/pkg/openapiconsole/console.go index 36ffef8f4f..6c430d95ed 100644 --- a/ignite/pkg/openapiconsole/console.go +++ b/ignite/pkg/openapiconsole/console.go @@ -14,7 +14,7 @@ func Handler(title, specURL string) http.HandlerFunc { t, _ := template.ParseFS(index, "index.tpl") return func(w http.ResponseWriter, req *http.Request) { - t.Execute(w, struct { + _ = t.Execute(w, struct { Title string URL string }{ diff --git a/ignite/pkg/truncatedbuffer/truncatedbuffer_test.go b/ignite/pkg/truncatedbuffer/truncatedbuffer_test.go index 312cdbba17..3f21397b3a 100644 --- a/ignite/pkg/truncatedbuffer/truncatedbuffer_test.go +++ b/ignite/pkg/truncatedbuffer/truncatedbuffer_test.go @@ -1,7 +1,7 @@ package truncatedbuffer import ( - "math/rand" + "crypto/rand" "testing" "github.com/stretchr/testify/require" @@ -9,9 +9,12 @@ import ( func TestWriter(t *testing.T) { ranBytes10 := make([]byte, 10) - rand.Read(ranBytes10) + _, err := rand.Read(ranBytes10) + require.NoError(t, err) + ranBytes1000 := make([]byte, 1000) - rand.Read(ranBytes1000) + _, err = rand.Read(ranBytes1000) + require.NoError(t, err) // TruncatedBuffer has a max capacity b := NewTruncatedBuffer(100) diff --git a/ignite/pkg/xgenny/xgenny.go b/ignite/pkg/xgenny/xgenny.go index 4338a58c7f..6d9de723c8 100644 --- a/ignite/pkg/xgenny/xgenny.go +++ b/ignite/pkg/xgenny/xgenny.go @@ -39,7 +39,10 @@ func (w Walker) walkDir(wl packd.WalkFunc, path string) error { for _, entry := range entries { if entry.IsDir() { - w.walkDir(wl, filepath.Join(path, entry.Name())) + err := w.walkDir(wl, filepath.Join(path, entry.Name())) + if err != nil { + return err + } continue } @@ -57,7 +60,9 @@ func (w Walker) walkDir(wl packd.WalkFunc, path string) error { return err } - wl(trimPath, f) + if err := wl(trimPath, f); err != nil { + return err + } } return nil diff --git a/ignite/pkg/xhttp/response.go b/ignite/pkg/xhttp/response.go index a833c602d4..8212580885 100644 --- a/ignite/pkg/xhttp/response.go +++ b/ignite/pkg/xhttp/response.go @@ -23,7 +23,7 @@ func ResponseJSON(w http.ResponseWriter, status int, data interface{}) error { } w.Header().Set("Content-Type", "application/json") w.WriteHeader(status) - w.Write(bz) + _, _ = w.Write(bz) return err } diff --git a/ignite/pkg/xhttp/server.go b/ignite/pkg/xhttp/server.go index 16f017b6ee..0fb3494eed 100644 --- a/ignite/pkg/xhttp/server.go +++ b/ignite/pkg/xhttp/server.go @@ -18,7 +18,7 @@ func Serve(ctx context.Context, s *http.Server) error { shutdownCtx, cancel := context.WithTimeout(context.Background(), ShutdownTimeout) defer cancel() - s.Shutdown(shutdownCtx) + _ = s.Shutdown(shutdownCtx) }() err := s.ListenAndServe() diff --git a/ignite/services/chain/runtime.go b/ignite/services/chain/runtime.go index 72a8d1be24..fb7e8bf9b9 100644 --- a/ignite/services/chain/runtime.go +++ b/ignite/services/chain/runtime.go @@ -100,7 +100,9 @@ func (c Chain) appTOML(homePath string, cfg *chainconfig.Config) error { appConfig.Set("minimum-gas-prices", gas.String()) // Update config values with the validator's Cosmos SDK app config - updateTomlTreeValues(appConfig, validator.App) + if err := updateTomlTreeValues(appConfig, validator.App); err != nil { + return err + } // Make sure the API address have the protocol prefix appConfig.Set("api.address", apiAddr) @@ -150,7 +152,9 @@ func (c Chain) configTOML(homePath string, cfg *chainconfig.Config) error { tmConfig.Set("consensus.timeout_propose", "1s") // Update config values with the validator's Tendermint config - updateTomlTreeValues(tmConfig, validator.Config) + if err := updateTomlTreeValues(tmConfig, validator.Config); err != nil { + return err + } // Make sure the addresses have the protocol prefix tmConfig.Set("rpc.laddr", rpcAddr) @@ -187,7 +191,9 @@ func (c Chain) clientTOML(homePath string, cfg *chainconfig.Config) error { tmConfig.Set("broadcast-mode", "sync") // Update config values with the validator's client config - updateTomlTreeValues(tmConfig, validator.Client) + if err := updateTomlTreeValues(tmConfig, validator.Client); err != nil { + return err + } file, err := os.OpenFile(path, os.O_RDWR|os.O_TRUNC, 0o644) if err != nil { diff --git a/ignite/services/doctor/doctor.go b/ignite/services/doctor/doctor.go index 95f873ea63..87e07b7e9c 100644 --- a/ignite/services/doctor/doctor.go +++ b/ignite/services/doctor/doctor.go @@ -76,8 +76,10 @@ func (d *Doctor) MigrateConfig(_ context.Context) error { status := "OK" if version != chainconfig.LatestVersion { - f.Seek(0, 0) - + _, err := f.Seek(0, 0) + if err != nil { + return errf(fmt.Errorf("failed to reset the file: %w", err)) + } // migrate config file // Convert the current config to the latest version and update the YAML file var buf bytes.Buffer diff --git a/ignite/services/plugin/interface.go b/ignite/services/plugin/interface.go index b423f8485e..9a735d1fad 100644 --- a/ignite/services/plugin/interface.go +++ b/ignite/services/plugin/interface.go @@ -271,31 +271,31 @@ func (f Flag) feedFlagSet(fgr flagger) error { case FlagTypeBool: defVal, _ := strconv.ParseBool(f.DefValue) fs.BoolP(f.Name, f.Shorthand, defVal, f.Usage) - fs.Set(f.Name, f.Value) + _ = fs.Set(f.Name, f.Value) case FlagTypeInt: defVal, _ := strconv.Atoi(f.DefValue) fs.IntP(f.Name, f.Shorthand, defVal, f.Usage) - fs.Set(f.Name, f.Value) + _ = fs.Set(f.Name, f.Value) case FlagTypeUint: defVal, _ := strconv.ParseUint(f.DefValue, 10, 64) fs.UintP(f.Name, f.Shorthand, uint(defVal), f.Usage) - fs.Set(f.Name, f.Value) + _ = fs.Set(f.Name, f.Value) case FlagTypeInt64: defVal, _ := strconv.ParseInt(f.DefValue, 10, 64) fs.Int64P(f.Name, f.Shorthand, defVal, f.Usage) - fs.Set(f.Name, f.Value) + _ = fs.Set(f.Name, f.Value) case FlagTypeUint64: defVal, _ := strconv.ParseUint(f.DefValue, 10, 64) fs.Uint64P(f.Name, f.Shorthand, defVal, f.Usage) - fs.Set(f.Name, f.Value) + _ = fs.Set(f.Name, f.Value) case FlagTypeString: fs.StringP(f.Name, f.Shorthand, f.DefValue, f.Usage) - fs.Set(f.Name, f.Value) + _ = fs.Set(f.Name, f.Value) case FlagTypeStringSlice: s := strings.Trim(f.DefValue, "[]") defValue := strings.Fields(s) fs.StringSliceP(f.Name, f.Shorthand, defValue, f.Usage) - fs.Set(f.Name, strings.Trim(f.Value, "[]")) + _ = fs.Set(f.Name, strings.Trim(f.Value, "[]")) default: return fmt.Errorf("flagset unmarshal: unhandled flag type %q in flag %#v", f.Type, f) } diff --git a/ignite/services/plugin/plugin.go b/ignite/services/plugin/plugin.go index 0081c381c1..240effab4d 100644 --- a/ignite/services/plugin/plugin.go +++ b/ignite/services/plugin/plugin.go @@ -187,7 +187,7 @@ func (p *Plugin) KillClient() { } if p.isHost { - deleteConfCache(p.Path) + _ = deleteConfCache(p.Path) p.isHost = false } } diff --git a/ignite/services/plugin/plugin_test.go b/ignite/services/plugin/plugin_test.go index da3795b913..b3e6682dd0 100644 --- a/ignite/services/plugin/plugin_test.go +++ b/ignite/services/plugin/plugin_test.go @@ -503,7 +503,8 @@ func scaffoldPlugin(t *testing.T, dir, name string, sharedHost bool) string { modpath, err := gocmd.Env(gocmd.EnvGOMOD) require.NoError(err) modpath = filepath.Dir(modpath) - gomod.AddReplace("github.com/ignite/cli", "", modpath, "") + err = gomod.AddReplace("github.com/ignite/cli", "", modpath, "") + require.NoError(err) // Save go.mod data, err := gomod.Format() require.NoError(err) diff --git a/integration/network/network_test.go b/integration/network/network_test.go index 0761c3601a..092ddd13fb 100644 --- a/integration/network/network_test.go +++ b/integration/network/network_test.go @@ -1,3 +1,4 @@ +//nolint:unused package network_test import ( diff --git a/integration/node/cmd_query_bank_test.go b/integration/node/cmd_query_bank_test.go index ab3863125d..36f164fe07 100644 --- a/integration/node/cmd_query_bank_test.go +++ b/integration/node/cmd_query_bank_test.go @@ -37,7 +37,7 @@ func assertBankBalanceOutput(t *testing.T, output string, balances string) { table = append(table, []string{c.Amount.String(), c.Denom}) } var expectedBalances strings.Builder - entrywriter.MustWrite(&expectedBalances, []string{"Amount", "Denom"}, table...) + _ = entrywriter.MustWrite(&expectedBalances, []string{"Amount", "Denom"}, table...) assert.Contains(t, output, expectedBalances.String()) }