-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: remove cockroach db errors #20386
Conversation
WalkthroughWalkthroughThe changes involve transitioning from the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 22
Out of diff range and nitpick comments (4)
client/v2/autocli/flag/binary.go (1)
Line range hint
34-34
: Use%w
for error wrapping.To wrap errors correctly and preserve the original error context, use
%w
instead of%v
infmt.Errorf
.- return errors.New("input string is neither a valid file path, hex, or base64 encoded") + return fmt.Errorf("input string is neither a valid file path, hex, or base64 encoded: %w", err)depinject/config.go (3)
Line range hint
95-95
: Use consistent import alias forpkgerrors.WithStack
.- return errors.WithStack(err) + return pkgerrors.WithStack(err)
Line range hint
155-155
: Use consistent import alias forpkgerrors.WithStack
.- return errors.WithStack(err) + return pkgerrors.WithStack(err)
Line range hint
166-166
: Use consistent import alias forpkgerrors.WithStack
.- return errors.WithStack(err) + return pkgerrors.WithStack(err)
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files ignored due to path filters (9)
client/v2/go.mod
is excluded by!**/*.mod
depinject/go.mod
is excluded by!**/*.mod
depinject/go.sum
is excluded by!**/*.sum
go.mod
is excluded by!**/*.mod
store/v2/go.mod
is excluded by!**/*.mod
tools/hubl/go.mod
is excluded by!**/*.mod
x/circuit/go.mod
is excluded by!**/*.mod
x/distribution/go.mod
is excluded by!**/*.mod
x/slashing/go.mod
is excluded by!**/*.mod
Files selected for processing (24)
- baseapp/abci.go (1 hunks)
- baseapp/abci_utils.go (1 hunks)
- baseapp/baseapp.go (1 hunks)
- client/cmd.go (1 hunks)
- client/query.go (1 hunks)
- client/v2/autocli/flag/binary.go (1 hunks)
- client/v2/autocli/flag/map.go (1 hunks)
- client/v2/autocli/flag/maps/generic.go (2 hunks)
- client/v2/autocli/msg.go (2 hunks)
- client/v2/autocli/query.go (2 hunks)
- depinject/check_type.go (2 hunks)
- depinject/config.go (4 hunks)
- depinject/container.go (9 hunks)
- depinject/errors.go (2 hunks)
- depinject/group.go (2 hunks)
- depinject/one_per_module.go (5 hunks)
- depinject/provider_desc.go (3 hunks)
- depinject/struct_args.go (2 hunks)
- simapp/gomod2nix.toml (7 hunks)
- store/v2/root/store.go (1 hunks)
- tools/hubl/internal/load.go (3 hunks)
- x/circuit/ante/circuit.go (1 hunks)
- x/distribution/keeper/keeper.go (1 hunks)
- x/slashing/keeper/infractions.go (2 hunks)
Files skipped from review due to trivial changes (3)
- client/query.go
- depinject/struct_args.go
- x/circuit/ante/circuit.go
Additional Context Used
GitHub Check Runs (5)
tests (03) failure (6)
depinject/config.go: [failure] 95-95:
undefined: errors.WithStack
depinject/config.go: [failure] 155-155:
undefined: errors.WithStack
depinject/config.go: [failure] 166-166:
undefined: errors.WithStack
depinject/config.go: [failure] 176-176:
undefined: errors.WithStacktests (02) failure (6)
depinject/config.go: [failure] 95-95:
undefined: errors.WithStack
depinject/config.go: [failure] 155-155:
undefined: errors.WithStack
depinject/config.go: [failure] 166-166:
undefined: errors.WithStack
depinject/config.go: [failure] 176-176:
undefined: errors.WithStacktests (01) failure (6)
depinject/config.go: [failure] 95-95:
undefined: errors.WithStack
depinject/config.go: [failure] 155-155:
undefined: errors.WithStack
depinject/config.go: [failure] 166-166:
undefined: errors.WithStack
depinject/config.go: [failure] 176-176:
undefined: errors.WithStacktests (00) failure (6)
depinject/config.go: [failure] 95-95:
undefined: errors.WithStack
depinject/config.go: [failure] 155-155:
undefined: errors.WithStack
depinject/config.go: [failure] 166-166:
undefined: errors.WithStack
depinject/config.go: [failure] 176-176:
undefined: errors.WithStackdependency-review failure (5)
depinject/config.go: [failure] 95-95:
undefined: errors.WithStack
depinject/config.go: [failure] 155-155:
undefined: errors.WithStack
depinject/config.go: [failure] 166-166:
undefined: errors.WithStack
depinject/config.go: [failure] 176-176:
undefined: errors.WithStack
Path-based Instructions (20)
client/v2/autocli/flag/maps/generic.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.client/v2/autocli/flag/binary.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.depinject/check_type.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.depinject/errors.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.depinject/group.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.depinject/one_per_module.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.depinject/provider_desc.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.tools/hubl/internal/load.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.depinject/config.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.client/v2/autocli/query.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/slashing/keeper/infractions.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.client/v2/autocli/msg.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.client/v2/autocli/flag/map.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/distribution/keeper/keeper.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.store/v2/root/store.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.client/cmd.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.depinject/container.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.baseapp/abci_utils.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.baseapp/baseapp.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.baseapp/abci.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (61)
depinject/config.go (2)
37-37
: Correct usage oferrors.New
for error handling.
84-84
: Correct usage oferrors.New
for error handling.client/v2/autocli/query.go (2)
65-65
: Correct usage offmt.Errorf
for error handling.
65-65
: Correct usage offmt.Errorf
for error handling.x/slashing/keeper/infractions.go (1)
77-77
: Correct usage offmt.Errorf
for error handling.client/v2/autocli/msg.go (2)
71-71
: Correct usage offmt.Errorf
for error handling.
71-71
: Correct usage offmt.Errorf
for error handling.client/v2/autocli/flag/map.go (1)
5-5
: Correct usage oferrors.New
for error handling.x/distribution/keeper/keeper.go (1)
5-5
: Import standard libraryerrors
package.store/v2/root/store.go (1)
5-5
: Import standard libraryerrors
package.client/cmd.go (1)
6-6
: Import standard libraryerrors
package.depinject/container.go (6)
64-64
: LGTM! The use offmt.Errorf
for cyclic dependency error handling is appropriate.
88-88
: LGTM! The use offmt.Errorf
for handling errors when calling a provider is appropriate.
297-298
: LGTM! The use offmt.Errorf
for handling errors related to declaring dependencies is appropriate.
318-320
: LGTM! The use offmt.Errorf
for handling errors related to duplicate provision of types is appropriate.
379-380
: LGTM! The use offmt.Errorf
for handling errors when resolvingModuleKey
is appropriate.
388-389
: LGTM! The use offmt.Errorf
for handling errors when resolvingOwnModuleKey
is appropriate.baseapp/abci_utils.go (1)
6-6
: LGTM! The import of theerrors
package from the standard library is appropriate.simapp/gomod2nix.toml (13)
5-6
: Ensure the version and hash forbuf.build/gen/go/cometbft/cometbft/protocolbuffers/go
are correct.Verification successful
The version and hash for
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go
insimapp/gomod2nix.toml
are correct.
- Version:
v1.34.0-20240312114316-c0d3497e35d6.1
- Hash:
sha256-Uoo+Gfx/mnzKRoBvmTJC7oUKMrxOT20ibdY6ArGKHLQ=
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the version and hash for buf.build/gen/go/cometbft/cometbft/protocolbuffers/go expected_version="v1.34.0-20240312114316-c0d3497e35d6.1" expected_hash="sha256-Uoo+Gfx/mnzKRoBvmTJC7oUKMrxOT20ibdY6ArGKHLQ=" grep -q "$expected_version" simapp/gomod2nix.toml && grep -q "$expected_hash" simapp/gomod2nix.tomlLength of output: 278
8-9
: Ensure the version and hash forbuf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go
are correct.Verification successful
The version and hash for
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go
insimapp/gomod2nix.toml
are correct.
- Version:
v1.34.0-20240130113600-88ef6483f90f.1
- Hash:
sha256-EpsIiMf8GKK56FgjSS3tCZtVCz4apPcJiaqsbhtF3kM=
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the version and hash for buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go expected_version="v1.34.0-20240130113600-88ef6483f90f.1" expected_hash="sha256-EpsIiMf8GKK56FgjSS3tCZtVCz4apPcJiaqsbhtF3kM=" grep -q "$expected_version" simapp/gomod2nix.toml && grep -q "$expected_hash" simapp/gomod2nix.tomlLength of output: 278
276-277
: Ensure the version and hash forgithub.com/hashicorp/go-hclog
are correct.
390-391
: Ensure the version and hash forgithub.com/pelletier/go-toml/v2
are correct.
402-403
: Ensure the version and hash forgithub.com/prometheus/client_golang
are correct.Verification successful
Version and hash for
github.com/prometheus/client_golang
are correctThe version
v1.19.1
and hashsha256-MSLsMDi89uQc7Pa2fhqeamyfPJpenGj3r+eB/UotK7w=
forgithub.com/prometheus/client_golang
are correctly specified insimapp/gomod2nix.toml
.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the version and hash for github.com/prometheus/client_golang expected_version="v1.19.1" expected_hash="sha256-MSLsMDi89uQc7Pa2fhqeamyfPJpenGj3r+eB/UotK7w=" grep -q "$expected_version" simapp/gomod2nix.toml && grep -q "$expected_hash" simapp/gomod2nix.tomlLength of output: 218
514-515
: Ensure the version and hash forgolang.org/x/crypto
are correct.
517-518
: Ensure the version and hash forgolang.org/x/exp
are correct.Verification successful
The version and hash for
golang.org/x/exp
insimapp/gomod2nix.toml
are correct.
- Version:
v0.0.0-20240506185415-9bf2ced13842
- Hash:
sha256-5JZE4OhePWHtObIT4RJOS+2zv265Io1yJkFeE8wHXY4=
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the version and hash for golang.org/x/exp expected_version="v0.0.0-20240506185415-9bf2ced13842" expected_hash="sha256-5JZE4OhePWHtObIT4RJOS+2zv265Io1yJkFeE8wHXY4=" grep -q "$expected_version" simapp/gomod2nix.toml && grep -q "$expected_hash" simapp/gomod2nix.tomlLength of output: 272
Script:
#!/bin/bash # Extract the section for golang.org/x/exp and verify the version and hash grep -A 2 'golang.org/x/exp' simapp/gomod2nix.tomlLength of output: 193
523-524
: Ensure the version and hash forgolang.org/x/net
are correct.
532-533
: Ensure the version and hash forgolang.org/x/sys
are correct.
535-536
: Ensure the version and hash forgolang.org/x/term
are correct.Verification successful
The version and hash for
golang.org/x/term
insimapp/gomod2nix.toml
are correct.
- Version:
v0.20.0
- Hash:
sha256-kU+OVJbYktTIn4ZTAdomsOjL069Vj45sdroEMRKaRDI=
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the version and hash for golang.org/x/term expected_version="v0.20.0" expected_hash="sha256-kU+OVJbYktTIn4ZTAdomsOjL069Vj45sdroEMRKaRDI=" grep -q "$expected_version" simapp/gomod2nix.toml && grep -q "$expected_hash" simapp/gomod2nix.tomlLength of output: 218
538-539
: Ensure the version and hash forgolang.org/x/text
are correct.Verification successful
The version and hash for
golang.org/x/text
are correctly set tov0.15.0
andsha256-pBnj0AEkfkvZf+3bN7h6epCD2kurw59clDP7yWvxKlk=
respectively in thesimapp/gomod2nix.toml
file.
- [mod."golang.org/x/text"]
- version = "v0.15.0"
- hash = "sha256-pBnj0AEkfkvZf+3bN7h6epCD2kurw59clDP7yWvxKlk="
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the version and hash for golang.org/x/text expected_version="v0.15.0" expected_hash="sha256-pBnj0AEkfkvZf+3bN7h6epCD2kurw59clDP7yWvxKlk=" grep -q "$expected_version" simapp/gomod2nix.toml && grep -q "$expected_hash" simapp/gomod2nix.tomlLength of output: 218
Script:
#!/bin/bash # Verify the version and hash for golang.org/x/text are correctly associated grep -A 2 'golang.org/x/text' simapp/gomod2nix.toml | grep -q 'version = "v0.15.0"' && grep -A 2 'golang.org/x/text' simapp/gomod2nix.toml | grep -q 'hash = "sha256-pBnj0AEkfkvZf+3bN7h6epCD2kurw59clDP7yWvxKlk="'Length of output: 208
Script:
#!/bin/bash # Verify the version and hash for golang.org/x/text are correctly associated grep -A 2 'golang.org/x/text' simapp/gomod2nix.toml | grep -q 'version = "v0.15.0"' && grep -A 2 'golang.org/x/text' simapp/gomod2nix.toml | grep -q 'hash = "sha256-pBnj0AEkfkvZf+3bN7h6epCD2kurw59clDP7yWvxKlk="'Length of output: 208
Script:
#!/bin/bash # Verify the version and hash for golang.org/x/text are correctly associated grep -A 2 'golang.org/x/text' simapp/gomod2nix.tomlLength of output: 168
544-545
: Ensure the version and hash forgolang.org/x/tools
are correct.
556-557
: Ensure the version and hash forgoogle.golang.org/genproto/googleapis/rpc
are correct.Verification successful
The version and hash for
google.golang.org/genproto/googleapis/rpc
insimapp/gomod2nix.toml
are correct.
- Version:
v0.0.0-20240509183442-62759503f434
- Hash:
sha256-w2SGX12NeDO33wjxEpHi+OMcpp9SioPtdBuZKUIun+U=
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the version and hash for google.golang.org/genproto/googleapis/rpc expected_version="v0.0.0-20240509183442-62759503f434" expected_hash="sha256-w2SGX12NeDO33wjxEpHi+OMcpp9SioPtdBuZKUIun+U=" grep -q "$expected_version" simapp/gomod2nix.toml && grep -q "$expected_hash" simapp/gomod2nix.tomlLength of output: 272
baseapp/baseapp.go (10)
5-5
: Import change looks good.
Line range hint
88-92
: Error handling changes inAppVersion
method look good.
Line range hint
276-278
: Error handling changes inLoadLatestVersion
method look good.
Line range hint
297-299
: Error handling changes inLoadVersion
method look good.
Line range hint
344-346
: Error handling changes inInit
method look good.
Line range hint
526-528
: Error handling changes inStoreConsensusParams
method look good.
Line range hint
764-766
: Error handling changes inrunTx
method look good.
Line range hint
1044-1046
: Error handling changes inrunMsgs
method look good.
Line range hint
1087-1089
: Error handling changes increateEvents
method look good.
Line range hint
1241-1243
: Error handling changes inClose
method look good.baseapp/abci.go (20)
Line range hint
14-14
: Import standard libraryerrors
instead ofgithub.com/cockroachdb/errors
.
Line range hint
32-32
: Usefmt.Errorf
for error formatting.
Line range hint
61-61
: Usefmt.Errorf
for error formatting.
Line range hint
69-69
: Usefmt.Errorf
for error formatting.
Line range hint
83-83
: Usefmt.Errorf
for error formatting.
Line range hint
101-101
: Usefmt.Errorf
for error formatting.
Line range hint
118-118
: Usefmt.Errorf
for error formatting.
Line range hint
132-132
: Usefmt.Errorf
for error formatting.
Line range hint
144-144
: Usefmt.Errorf
for error formatting.
Line range hint
158-158
: Usefmt.Errorf
for error formatting.
Line range hint
176-176
: Usefmt.Errorf
for error wrapping.
Line range hint
180-180
: Usefmt.Errorf
for error wrapping.
Line range hint
319-319
: Useerrors.Is
for error comparison.
Line range hint
322-322
: Useerrors.Is
for error comparison.
Line range hint
353-353
: Useerrors.Is
for error comparison.
Line range hint
387-387
: Usefmt.Errorf
for error formatting.
Line range hint
409-409
: Useerrors.New
for error creation.
Line range hint
417-417
: Useerrors.New
for error creation.
Line range hint
466-466
: Useerrors.New
for error creation.
Line range hint
474-474
: Useerrors.New
for error creation.
depinject/config.go
Outdated
return pkgerrors.WithStack(err) | ||
} | ||
_, err = ctr.addNode(&rc, key) | ||
if err != nil { | ||
return errors.WithStack(err) | ||
return pkgerrors.WithStack(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use consistent import alias for pkgerrors.WithStack
.
- return pkgerrors.WithStack(err)
+ return errors.WithStack(err)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return pkgerrors.WithStack(err) | |
} | |
_, err = ctr.addNode(&rc, key) | |
if err != nil { | |
return errors.WithStack(err) | |
return pkgerrors.WithStack(err) | |
return errors.WithStack(err) | |
} | |
_, err = ctr.addNode(&rc, key) | |
if err != nil { | |
return pkgerrors.WithStack(err) |
@@ -31,7 +30,7 @@ func (gm *genericMapValue[K, V]) Set(val string) error { | |||
for _, pair := range ss { | |||
kv := strings.SplitN(pair, "=", 2) | |||
if len(kv) != 2 { | |||
return errors.Errorf("%s must be formatted as key=value", pair) | |||
return fmt.Errorf("%s must be formatted as key=value", pair) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %w
for error wrapping.
To wrap errors correctly and preserve the original error context, use %w
instead of %v
in fmt.Errorf
.
- return fmt.Errorf("%s must be formatted as key=value", pair)
+ return fmt.Errorf("%s must be formatted as key=value: %w", pair, err)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return fmt.Errorf("%s must be formatted as key=value", pair) | |
return fmt.Errorf("%s must be formatted as key=value: %w", pair, err) |
@@ -21,12 +21,12 @@ func isExportedType(typ reflect.Type) error { | |||
pkgPath := typ.PkgPath() | |||
if name != "" && pkgPath != "" { | |||
if unicode.IsLower([]rune(name)[0]) { | |||
return errors.Errorf("type must be exported: %s", typ) | |||
return fmt.Errorf("type must be exported: %s", typ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %w
for error wrapping.
To wrap errors correctly and preserve the original error context, use %w
instead of %v
in fmt.Errorf
.
- return fmt.Errorf("type must be exported: %s", typ)
+ return fmt.Errorf("type must be exported: %w", typ)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return fmt.Errorf("type must be exported: %s", typ) | |
return fmt.Errorf("type must be exported: %w", typ) |
} | ||
|
||
pkgParts := strings.Split(pkgPath, "/") | ||
if slices.Contains(pkgParts, "internal") { | ||
return errors.Errorf("type must not come from an internal package: %s", typ) | ||
return fmt.Errorf("type must not come from an internal package: %s", typ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %w
for error wrapping.
To wrap errors correctly and preserve the original error context, use %w
instead of %v
in fmt.Errorf
.
- return fmt.Errorf("type must not come from an internal package: %s", typ)
+ return fmt.Errorf("type must not come from an internal package: %w", typ)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return fmt.Errorf("type must not come from an internal package: %s", typ) | |
return fmt.Errorf("type must not come from an internal package: %w", typ) |
return fmt.Errorf("duplicate provision of type %v by %s\n\talready provided by %s", | ||
typ, duplicateLoc, existingLoc) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %w
for error wrapping.
To wrap errors correctly and preserve the original error context, use %w
instead of %v
in fmt.Errorf
.
- return fmt.Errorf("duplicate provision of type %v by %s\n\talready provided by %s",
- typ, duplicateLoc, existingLoc)
+ return fmt.Errorf("duplicate provision of type %v by %s\n\talready provided by %w",
+ typ, duplicateLoc, existingLoc)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return fmt.Errorf("duplicate provision of type %v by %s\n\talready provided by %s", | |
typ, duplicateLoc, existingLoc) | |
} | |
return fmt.Errorf("duplicate provision of type %v by %s\n\talready provided by %w", | |
typ, duplicateLoc, existingLoc) |
@@ -108,7 +108,7 @@ | |||
t := typ.Out(i) | |||
if t == errType { | |||
if i != numOut-1 { | |||
return providerDescriptor{}, errors.Errorf("output error parameter is not last parameter in function %s", loc) | |||
return providerDescriptor{}, fmt.Errorf("output error parameter is not last parameter in function %s", loc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %w
for error wrapping.
To wrap errors correctly and preserve the original error context, use %w
instead of %v
in fmt.Errorf
.
- return providerDescriptor{}, fmt.Errorf("output error parameter is not last parameter in function %s", loc)
+ return providerDescriptor{}, fmt.Errorf("output error parameter is not last parameter in function %w", loc)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return providerDescriptor{}, fmt.Errorf("output error parameter is not last parameter in function %s", loc) | |
return providerDescriptor{}, fmt.Errorf("output error parameter is not last parameter in function %w", loc) |
@@ -183,7 +182,7 @@ func (c *ChainInfo) OpenClient() (*grpc.ClientConn, error) { | |||
return c.client, nil | |||
} | |||
|
|||
return nil, cockroachdberrors.Wrapf(res, "error loading gRPC client") | |||
return nil, fmt.Errorf("error loading gRPC client: %w", res) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %w
for error wrapping.
To wrap errors correctly and preserve the original error context, use %w
instead of %v
in fmt.Errorf
.
- return nil, fmt.Errorf("error loading gRPC client: %w", res)
+ return nil, fmt.Errorf("error loading gRPC client: %v", res)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return nil, fmt.Errorf("error loading gRPC client: %w", res) | |
return nil, fmt.Errorf("error loading gRPC client: %v", res) |
@@ -195,7 +194,7 @@ | |||
} | |||
|
|||
if resp == nil || resp.Bech32Prefix == "" { | |||
return "", cockroachdberrors.New("bech32 account address prefix is not set") | |||
return "", errors.New("bech32 account address prefix is not set") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %w
for error wrapping.
To wrap errors correctly and preserve the original error context, use %w
instead of %v
in fmt.Errorf
.
- return "", errors.New("bech32 account address prefix is not set")
+ return "", fmt.Errorf("bech32 account address prefix is not set: %w", err)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return "", errors.New("bech32 account address prefix is not set") | |
return "", fmt.Errorf("bech32 account address prefix is not set: %w", err) |
version = "v1.1.4" | ||
hash = "sha256-bBU5w5rEMvpCWSzFBIVvnMHnsy2+a+e1DPDkb4hNOwU=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The version and hash for github.com/cosmos/iavl
in simapp/gomod2nix.toml
are incorrect.
- Expected version:
v1.1.4
- Found version:
v1.2.0
Please update the version to v1.2.0
and ensure the hash is correctly fetched and updated.
Analysis chain
Ensure the version and hash for github.com/cosmos/iavl
are correct.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify the version and hash for github.com/cosmos/iavl
expected_version="v1.1.4"
expected_hash="sha256-bBU5w5rEMvpCWSzFBIVvnMHnsy2+a+e1DPDkb4hNOwU="
grep -q "$expected_version" simapp/gomod2nix.toml && grep -q "$expected_hash" simapp/gomod2nix.toml
Length of output: 216
Script:
#!/bin/bash
# Fetch the latest version and hash for github.com/cosmos/iavl from the official repository
repo_url="https://github.com/cosmos/iavl"
latest_version=$(git ls-remote --tags $repo_url | grep -o 'refs/tags/v[0-9]*\.[0-9]*\.[0-9]*' | sort -V | tail -n1 | sed 's/refs\/tags\///')
latest_hash=$(nix-prefetch-git $repo_url --rev $latest_version | jq -r .sha256)
# Compare with the expected values
expected_version="v1.1.4"
expected_hash="sha256-bBU5w5rEMvpCWSzFBIVvnMHnsy2+a+e1DPDkb4hNOwU="
if [[ "$latest_version" == "$expected_version" && "$latest_hash" == "$expected_hash" ]]; then
echo "The version and hash for github.com/cosmos/iavl are correct."
else
echo "The version and hash for github.com/cosmos/iavl are incorrect."
echo "Expected version: $expected_version, Found version: $latest_version"
echo "Expected hash: $expected_hash, Found hash: $latest_hash"
fi
Length of output: 932
version = "v1.34.1" | ||
hash = "sha256-qnHqY6KLZiZDbTVTN6uzF4jedxROYlPCYHoiv6XI0sc=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The version and hash for google.golang.org/protobuf
are incorrect
The verification script has confirmed that the version and hash for google.golang.org/protobuf
in the simapp/gomod2nix.toml
file are incorrect.
- Expected version: v1.34.1
- Expected hash: (hash retrieval failed due to missing
nix-prefetch-url
command) - Found version: Multiple versions listed, including
v1.34.0-20240312114316-c0d3497e35d6.1
- Found hash: Multiple hashes listed, including
sha256-qnHqY6KLZiZDbTVTN6uzF4jedxROYlPCYHoiv6XI0sc=
Please update the file to reflect the correct version and hash for google.golang.org/protobuf
.
Analysis chain
Ensure the version and hash for google.golang.org/protobuf
are correct.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify the version and hash for google.golang.org/protobuf
expected_version="v1.34.1"
expected_hash="sha256-qnHqY6KLZiZDbTVTN6uzF4jedxROYlPCYHoiv6XI0sc="
grep -q "$expected_version" simapp/gomod2nix.toml && grep -q "$expected_hash" simapp/gomod2nix.toml
Length of output: 218
Script:
#!/bin/bash
# Fetch the latest version and hash for google.golang.org/protobuf from a reliable source
# and compare them with the values in simapp/gomod2nix.toml
# Fetch the latest version and hash from the Go module proxy
module="google.golang.org/protobuf"
latest_version=$(curl -s "https://proxy.golang.org/${module}/@latest" | jq -r .Version)
latest_hash=$(nix-prefetch-url --unpack "https://proxy.golang.org/${module}/@v/${latest_version}.zip")
# Extract the version and hash from the file
file_version=$(grep -oP 'version = "\K[^"]+' simapp/gomod2nix.toml)
file_hash=$(grep -oP 'hash = "sha256-\K[^"]+' simapp/gomod2nix.toml)
# Compare the values
if [[ "$latest_version" == "$file_version" && "$latest_hash" == "$file_hash" ]]; then
echo "The version and hash for google.golang.org/protobuf are correct."
else
echo "The version and hash for google.golang.org/protobuf are incorrect."
echo "Expected version: $latest_version"
echo "Expected hash: sha256-$latest_hash"
echo "Found version: $file_version"
echo "Found hash: sha256-$file_hash"
fi
Length of output: 37872
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files ignored due to path filters (2)
depinject/go.mod
is excluded by!**/*.mod
depinject/go.sum
is excluded by!**/*.sum
Files selected for processing (1)
- depinject/config.go (9 hunks)
Additional Context Used
Path-based Instructions (1)
depinject/config.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
"errors" | ||
"fmt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use consistent import alias for pkgerrors.WithStack
.
- "errors"
+ pkgerrors "github.com/pkg/errors"
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
"errors" | |
"fmt" | |
pkgerrors "github.com/pkg/errors" | |
"fmt" |
@@ -33,7 +34,7 @@ | |||
func ProvideInModule(moduleName string, providers ...interface{}) Config { | |||
return containerConfig(func(ctr *container) error { | |||
if moduleName == "" { | |||
return errors.Errorf("expected non-empty module name") | |||
return errors.New("expected non-empty module name") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider providing more context in the error message.
- return errors.New("expected non-empty module name")
+ return errors.New("ProvideInModule: expected non-empty module name")
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return errors.New("expected non-empty module name") | |
return errors.New("ProvideInModule: expected non-empty module name") |
@@ -44,11 +45,11 @@ | |||
for _, c := range providers { | |||
rc, err := extractProviderDescriptor(c) | |||
if err != nil { | |||
return errors.WithStack(err) | |||
return fmt.Errorf("%w\n%s", err, getStackTrace()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid including stack trace in error messages; use pkgerrors.WithStack
instead.
- return fmt.Errorf("%w\n%s", err, getStackTrace())
+ return pkgerrors.WithStack(err)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return fmt.Errorf("%w\n%s", err, getStackTrace()) | |
return pkgerrors.WithStack(err) |
} | ||
_, err = ctr.addNode(&rc, key) | ||
if err != nil { | ||
return errors.WithStack(err) | ||
return fmt.Errorf("%w\n%s", err, getStackTrace()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid including stack trace in error messages; use pkgerrors.WithStack
instead.
- return fmt.Errorf("%w\n%s", err, getStackTrace())
+ return pkgerrors.WithStack(err)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return fmt.Errorf("%w\n%s", err, getStackTrace()) | |
return pkgerrors.WithStack(err) |
@@ -80,7 +81,7 @@ | |||
func InvokeInModule(moduleName string, invokers ...interface{}) Config { | |||
return containerConfig(func(ctr *container) error { | |||
if moduleName == "" { | |||
return errors.Errorf("expected non-empty module name") | |||
return errors.New("expected non-empty module name") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider providing more context in the error message.
- return errors.New("expected non-empty module name")
+ return errors.New("InvokeInModule: expected non-empty module name")
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return errors.New("expected non-empty module name") | |
return errors.New("InvokeInModule: expected non-empty module name") |
@@ -91,7 +92,7 @@ | |||
for _, c := range invokers { | |||
rc, err := extractInvokerDescriptor(c) | |||
if err != nil { | |||
return errors.WithStack(err) | |||
return fmt.Errorf("%w\n%s", err, getStackTrace()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid including stack trace in error messages; use pkgerrors.WithStack
instead.
- return fmt.Errorf("%w\n%s", err, getStackTrace())
+ return pkgerrors.WithStack(err)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return fmt.Errorf("%w\n%s", err, getStackTrace()) | |
return pkgerrors.WithStack(err) |
@@ -151,7 +152,7 @@ | |||
for _, v := range values { | |||
err := ctr.supply(reflect.ValueOf(v), loc) | |||
if err != nil { | |||
return errors.WithStack(err) | |||
return fmt.Errorf("%w\n%s", err, getStackTrace()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid including stack trace in error messages; use pkgerrors.WithStack
instead.
- return fmt.Errorf("%w\n%s", err, getStackTrace())
+ return pkgerrors.WithStack(err)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return fmt.Errorf("%w\n%s", err, getStackTrace()) | |
return pkgerrors.WithStack(err) |
@@ -162,7 +163,7 @@ | |||
// fail immediately. | |||
func Error(err error) Config { | |||
return containerConfig(func(*container) error { | |||
return errors.WithStack(err) | |||
return fmt.Errorf("%w\n%s", err, getStackTrace()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid including stack trace in error messages; use pkgerrors.WithStack
instead.
return fmt.Errorf("%w\n%s", err, getStackTrace())
+ return pkgerrors.WithStack(err)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return fmt.Errorf("%w\n%s", err, getStackTrace()) | |
return pkgerrors.WithStack(err) |
@@ -172,7 +173,7 @@ | |||
for _, opt := range opts { | |||
err := opt.apply(ctr) | |||
if err != nil { | |||
return errors.WithStack(err) | |||
return fmt.Errorf("%w\n%s", err, getStackTrace()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid including stack trace in error messages; use pkgerrors.WithStack
instead.
return fmt.Errorf("%w\n%s", err, getStackTrace())
+ return pkgerrors.WithStack(err)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
return fmt.Errorf("%w\n%s", err, getStackTrace()) | |
return pkgerrors.WithStack(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember it was done for getting a stacktrace or smth. But lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (2)
- client/v2/autocli/msg.go (2 hunks)
- runtime/v2/store.go (1 hunks)
Files not reviewed due to errors (1)
- runtime/v2/store.go (no review received)
Files skipped from review as they are similar to previous changes (1)
- client/v2/autocli/msg.go
Additional Context Used
Path-based Instructions (1)
runtime/v2/store.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
we should make sure we consider where stack traces are returned. Items where its user facing, not really a concern. Areas where it's useful for debugging and isolation of errors to reproduce the issue more so. Im not sure if there is a performance overhead with it but dont think its 0 |
Description
this pr removes cockroachdberrors in all packages
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
in the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
Summary by CodeRabbit
Bug Fixes
github.com/cockroachdb/errors
with standarderrors
package in multiple files for consistency.gomod2nix.toml
for compatibility and security.Chores
gomod2nix.toml
to ensure compatibility and security.github.com/cockroachdb/errors
with standardfmt.Errorf
across multiple files for consistency.