mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-22 11:31:02 +00:00
rlp/rlpgen: fix error handling when target type not found (#25547)
typ will be nil when lookupStructType returns an error. cfg.Type should be used instead.
This commit is contained in:
parent
23ac8df153
commit
cce7f08438
@ -106,7 +106,7 @@ func (cfg *Config) process() (code []byte, err error) {
|
|||||||
// Find the type and generate.
|
// Find the type and generate.
|
||||||
typ, err := lookupStructType(pkg.Scope(), cfg.Type)
|
typ, err := lookupStructType(pkg.Scope(), cfg.Type)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("can't find %s in %s: %v", typ, pkg, err)
|
return nil, fmt.Errorf("can't find %s in %s: %v", cfg.Type, pkg, err)
|
||||||
}
|
}
|
||||||
code, err = bctx.generate(typ, cfg.GenerateEncoder, cfg.GenerateDecoder)
|
code, err = bctx.generate(typ, cfg.GenerateEncoder, cfg.GenerateDecoder)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user