diff --git a/errors/CHANGELOG.md b/errors/CHANGELOG.md index fc2159188a..2074983d4a 100644 --- a/errors/CHANGELOG.md +++ b/errors/CHANGELOG.md @@ -33,7 +33,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Changes -* [#24568](https://github.com/cosmos/cosmos-sdk/pull/24568) Registering the same error code twice no longer will panic - a warning error will be logged to `stderr`. +* [#24568](https://github.com/cosmos/cosmos-sdk/pull/24568) Registering the same error code twice will no longer panic - a warning error will be logged to `stderr`. ## [v1.0.2](https://github.com/cosmos/cosmos-sdk/releases/tag/errors%2Fv1.0.2) diff --git a/errors/abci.go b/errors/abci.go index 603f3b36ff..5cdf7d90ee 100644 --- a/errors/abci.go +++ b/errors/abci.go @@ -6,24 +6,24 @@ import ( ) const ( - // SuccessABCICode declares an ABCI response use 0 to signal that the + // SuccessABCICode declares an ABCI response uses 0 to signal that the // processing was successful and no error is returned. SuccessABCICode uint32 = 0 // All unclassified errors that do not provide an ABCI code are clubbed // under an internal error code and a generic message instead of - // detailed error string. + // a detailed error string. internalABCICodespace = UndefinedCodespace internalABCICode uint32 = 1 ) // ABCIInfo returns the ABCI error information as consumed by the tendermint -// client. Returned codespace, code, and log message should be used as a ABCI response. +// client. Returned codespace, code, and log message should be used as an ABCI response. // Any error that does not provide ABCICode information is categorized as error // with code 1, codespace UndefinedCodespace // When not running in a debug mode all messages of errors that do not provide // ABCICode information are replaced with generic "internal error". Errors -// without an ABCICode information as considered internal. +// without an ABCICode information are considered internal. func ABCIInfo(err error, debug bool) (codespace string, code uint32, log string) { if errIsNil(err) { return "", SuccessABCICode, "" diff --git a/errors/abci_test.go b/errors/abci_test.go index be300d9313..7dacb30e08 100644 --- a/errors/abci_test.go +++ b/errors/abci_test.go @@ -65,7 +65,7 @@ func (s *abciTestSuite) TestABCInfo() { wantSpace: UndefinedCodespace, }, // This is hard to test because of attached stacktrace. This - // case is tested in an another test. + // case is tested in another test. // "wrapped stdlib is a full message in debug mode": { // err: Wrap(io.EOF, "cannot read file"), // debug: true, diff --git a/errors/doc.go b/errors/doc.go index a10c61acc1..85145c1420 100644 --- a/errors/doc.go +++ b/errors/doc.go @@ -1,12 +1,12 @@ /* Package errors implements custom error interfaces for cosmos-sdk. -Error declarations should be generic and cover broad range of cases. Each +Error declarations should be generic and cover a broad range of cases. Each returned error instance can wrap a generic error declaration to provide more details. -This package provides a broad range of errors declared that fits all common -cases. If an error is very specific for an extension it can be registered outside +This package provides a broad range of errors declared that fit all common +cases. If an error is very specific to an extension it can be registered outside of the errors package. If it will be needed by many extensions, please consider registering it in the errors package. To create a new error instance use Register function. You must provide a unique, non zero error code and a short description, for example: diff --git a/errors/handle.go b/errors/handle.go index 33c3fbfdea..0ca1129883 100644 --- a/errors/handle.go +++ b/errors/handle.go @@ -3,7 +3,7 @@ package errors import "fmt" // AssertNil panics on error -// Should be only used with interface methods, which require return error, but the +// Should only be used with interface methods, which require return error, but the // error is always nil func AssertNil(err error) { if err != nil { diff --git a/errors/stacktrace.go b/errors/stacktrace.go index d7021085db..4337ab5ade 100644 --- a/errors/stacktrace.go +++ b/errors/stacktrace.go @@ -51,7 +51,7 @@ func trimInternal(st errors.StackTrace) errors.StackTrace { "cosmossdk.io/errors.Wrap", "cosmossdk.io/errors.Wrapf", "cosmossdk.io/errors.WithType", - // runtime are added on panics + // runtime is added on panics "runtime.", // _test is defined in coverage tests, causing failure // "/_test/" diff --git a/errors/stacktrace_test.go b/errors/stacktrace_test.go index c0a8d6141c..132fe932d3 100644 --- a/errors/stacktrace_test.go +++ b/errors/stacktrace_test.go @@ -20,7 +20,7 @@ func (s *errorsTestSuite) TestStackTrace() { err: Wrap(fmt.Errorf("foo"), "standard"), wantError: "standard: foo", }, - "Wrapping pkg/errors gives us clean stacktrace": { + "Wrapping pkg/errors gives us a clean stacktrace": { err: Wrap(errors.New("bar"), "pkg"), wantError: "pkg: bar", }, diff --git a/internal/conv/string_test.go b/internal/conv/string_test.go index 70f51924cc..c57205099b 100644 --- a/internal/conv/string_test.go +++ b/internal/conv/string_test.go @@ -20,7 +20,7 @@ func unsafeConvertStr() []byte { } func (s *StringSuite) TestUnsafeStrToBytes() { - // we convert in other function to trigger GC. We want to check that + // we convert in another function to trigger GC. We want to check that // the underlying array in []bytes is accessible after GC will finish swapping. for range 5 { b := unsafeConvertStr() @@ -39,7 +39,7 @@ func unsafeConvertBytes() string { } func (s *StringSuite) TestUnsafeBytesToStr() { - // we convert in other function to trigger GC. We want to check that + // we convert in another function to trigger GC. We want to check that // the underlying array in []bytes is accessible after GC will finish swapping. for range 5 { str := unsafeConvertBytes() diff --git a/internal/testutil/cmd.go b/internal/testutil/cmd.go index 2d3c662cbe..ed9d14c271 100644 --- a/internal/testutil/cmd.go +++ b/internal/testutil/cmd.go @@ -15,7 +15,7 @@ import ( // **Warning**: this is only compatible with following flag types: // 1. the implementations of pflag.Value // 2. the built-in implementations of pflag.SliceValue -// 3. the custom implementations of pflag.SliceValue that are split by comma "," +// 3. the custom implementatons of pflag.SliceValue that are split by comma "," // // see https://github.com/spf13/cobra/issues/2079#issuecomment-1870115781 for more detail info func ResetArgs(t *testing.T, cmd *cobra.Command) { diff --git a/log/CHANGELOG.md b/log/CHANGELOG.md index 3a8e989b9d..cec01a15e2 100644 --- a/log/CHANGELOG.md +++ b/log/CHANGELOG.md @@ -28,7 +28,7 @@ Each entry must include the Github issue reference in the following format: ## [v1.5.1](https://github.com/cosmos/cosmos-sdk/releases/tag/log/v1.5.1) - 2025-03-07 -* [#23928](https://github.com/cosmos/cosmos-sdk/pull/23928) Bump sonic json library to [v1.3.1](https://github.com/bytedance/sonic/releases/tag/v1.13.1) for Go 1.24 compatibility. +* [#23928](https://github.com/cosmos/cosmos-sdk/pull/23928) Bump sonic json library to [v1.13.1](https://github.com/bytedance/sonic/releases/tag/v1.13.1) for Go 1.24 compatibility. ## [v1.5.0](https://github.com/cosmos/cosmos-sdk/releases/tag/log/v1.5.0) - 2024-11-07 diff --git a/log/bench_test.go b/log/bench_test.go index fdf5fca645..c5ba081233 100644 --- a/log/bench_test.go +++ b/log/bench_test.go @@ -34,7 +34,7 @@ func BenchmarkLoggers(b *testing.B) { keyVals: []any{"foo", 1}, }, { - // Small numbers may be optimized, so check if an unusual/larger number performs different. + // Small numbers may be optimized, so check if an unusual/larger number performs differently. name: "single largeish int", keyVals: []any{"foo", 123456789}, }, @@ -94,7 +94,7 @@ func BenchmarkLoggers(b *testing.B) { } }) - // The nop logger we use expose in the public API, + // The nop logger we expose in the public API, // also useful as a reference for how expensive zerolog is. b.Run("specialized nop logger", func(b *testing.B) { for _, bc := range nopCases { diff --git a/log/logger.go b/log/logger.go index ea7cb58201..b284968039 100644 --- a/log/logger.go +++ b/log/logger.go @@ -202,7 +202,7 @@ func (l zeroLogWrapper) WithContext(keyVals ...interface{}) any { } // Impl returns the underlying zerolog logger. -// It can be used to used zerolog structured API directly instead of the wrapper. +// It can be used to use zerolog structured API directly instead of the wrapper. func (l zeroLogWrapper) Impl() interface{} { return l.Logger } diff --git a/log/options.go b/log/options.go index 94a4ca4564..6da1254f75 100644 --- a/log/options.go +++ b/log/options.go @@ -70,7 +70,7 @@ func OutputJSONOption() Option { } } -// ColorOption add option to enable/disable coloring +// ColorOption adds an option to enable/disable coloring // of the logs when console writer is in use func ColorOption(val bool) Option { return func(cfg *Config) { @@ -79,8 +79,8 @@ func ColorOption(val bool) Option { } // TimeFormatOption configures timestamp format of the logger -// timestamps disabled if empty. -// it is responsibility of the caller to provider correct values +// Timestamps are disabled if empty. +// It is the responsibility of the caller to provide correct values // Supported formats: // - time.Layout // - time.ANSIC @@ -100,14 +100,14 @@ func TimeFormatOption(format string) Option { } } -// TraceOption add option to enable/disable print of stacktrace on error log +// TraceOption adds an option to enable/disable print of stacktrace on error log func TraceOption(val bool) Option { return func(cfg *Config) { cfg.StackTrace = val } } -// HooksOption append hooks to the Logger hooks +// HooksOption appends hooks to the Logger hooks func HooksOption(hooks ...zerolog.Hook) Option { return func(cfg *Config) { cfg.Hooks = append(cfg.Hooks, hooks...)