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/docs/docs/08-references/01-cli.md b/docs/docs/08-references/01-cli.md index 7f38f23d3a..27243d2fb0 100644 --- a/docs/docs/08-references/01-cli.md +++ b/docs/docs/08-references/01-cli.md @@ -3307,19 +3307,7 @@ array.coin. An example of using field types: ignite scaffold list pool amount:coin tags:array.string height:int -Supported types: - -| Type | Alias | Index | Code Type | Description | -|--------------|---------|-------|-----------|---------------------------------| -| string | - | yes | string | Text type | -| array.string | strings | no | []string | List of text type | -| bool | - | yes | bool | Boolean type | -| int | - | yes | int32 | Integer type | -| array.int | ints | no | []int32 | List of integers types | -| uint | - | yes | uint64 | Unsigned integer type | -| array.uint | uints | no | []uint64 | List of unsigned integers types | -| coin | - | no | sdk.Coin | Cosmos SDK coin type | -| array.coin | coins | no | sdk.Coins | List of Cosmos SDK coin types | +For detailed type information use ignite scaffold type --help "Index" indicates whether the type can be used as an index in "ignite scaffold map". @@ -3398,7 +3386,7 @@ incrementing integer, whereas "map" values are indexed by a user-provided value Let's use the same blog post example: - ignite scaffold map post title body + ignite scaffold map post title body:string This command scaffolds a "Post" type and CRUD functionality to create, read, updated, and delete posts. However, when creating a new post with your chain's @@ -3427,6 +3415,8 @@ Since the behavior of "list" and "map" scaffolding is very similar, you can use the "--no-message", "--module", "--signer" flags as well as the colon syntax for custom types. +For detailed type information use ignite scaffold type --help + ``` ignite scaffold map NAME [field]... [flags] @@ -3480,6 +3470,8 @@ The command above will create a new message MsgAddPool with three fields: amount (in tokens), denom (a string), and active (a boolean). The message will be added to the "dex" module. +For detailed type information use ignite scaffold type --help + By default, the message is defined as a proto message in the "proto/{app}/{module}/tx.proto" and registered in the "Msg" service. A CLI command to create and broadcast a transaction with MsgAddPool is created in the module's @@ -3503,7 +3495,7 @@ for details. ``` -ignite scaffold message [name] [field1] [field2] ... [flags] +ignite scaffold message [name] [field1:type1] [field2:type2] ... [flags] ``` **Options** @@ -3648,8 +3640,14 @@ ignite scaffold packet [packetName] [field1] [field2] ... --module [moduleName] Query for fetching data from a blockchain +**Synopsis** + +Query for fetching data from a blockchain. + +For detailed type information use ignite scaffold type --help. + ``` -ignite scaffold query [name] [request_field1] [request_field2] ... [flags] +ignite scaffold query [name] [field1:type1] [field2:type2] ... [flags] ``` **Options** @@ -3695,8 +3693,20 @@ ignite scaffold react [flags] CRUD for data stored in a single location +**Synopsis** + +CRUD for data stored in a single location. + +For detailed type information use ignite scaffold type --help. + +``` +ignite scaffold single NAME [field:type]... [flags] +``` + +**Examples** + ``` -ignite scaffold single NAME [field]... [flags] + ignite scaffold single todo-single title:string done:bool ``` **Options** @@ -3721,8 +3731,40 @@ ignite scaffold single NAME [field]... [flags] Type definition +**Synopsis** + +Type information + +Currently supports: + +| Type | Alias | Index | Code Type | Description | +|--------------|---------|-------|-----------|---------------------------------| +| string | - | yes | string | Text type | +| array.string | strings | no | []string | List of text type | +| bool | - | yes | bool | Boolean type | +| int | - | yes | int32 | Integer type | +| array.int | ints | no | []int32 | List of integers types | +| uint | - | yes | uint64 | Unsigned integer type | +| array.uint | uints | no | []uint64 | List of unsigned integers types | +| coin | - | no | sdk.Coin | Cosmos SDK coin type | +| array.coin | coins | no | sdk.Coins | List of Cosmos SDK coin types | + +Field Usage: + - fieldName + - fieldName:fieldType + +If no :fieldType, default (string) is used + + + +``` +ignite scaffold type NAME [field:type] ... [flags] +``` + +**Examples** + ``` -ignite scaffold type NAME [field]... [flags] + ignite scaffold type todo-item priority:int desc:string tags:array.string done:bool ``` **Options** diff --git a/ignite/cmd/plugin_test.go b/ignite/cmd/plugin_test.go index d92683bdc3..c0e4e13eca 100644 --- a/ignite/cmd/plugin_test.go +++ b/ignite/cmd/plugin_test.go @@ -370,7 +370,7 @@ ignite rootCmd := buildRootCmd(ctx) tt.setup(t, ctx, pi) - linkPlugins(ctx, rootCmd, []*plugin.Plugin{p}) + _ = linkPlugins(ctx, rootCmd, []*plugin.Plugin{p}) if tt.expectedError != "" { require.Error(p.Error) @@ -605,7 +605,7 @@ func TestLinkPluginHooks(t *testing.T) { rootCmd := buildRootCmd(ctx) tt.setup(t, ctx, pi) - linkPlugins(ctx, rootCmd, []*plugin.Plugin{p}) + _ = linkPlugins(ctx, 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/plugin.go b/ignite/services/plugin/plugin.go index 346f94e36e..b23a46711b 100644 --- a/ignite/services/plugin/plugin.go +++ b/ignite/services/plugin/plugin.go @@ -190,7 +190,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 01eb160a6f..7ddca88daf 100644 --- a/ignite/services/plugin/plugin_test.go +++ b/ignite/services/plugin/plugin_test.go @@ -522,8 +522,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()) }