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:
Justin Traglia 2022-08-18 17:34:57 -05:00 committed by GitHub
parent 23ac8df153
commit cce7f08438
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,7 +106,7 @@ func (cfg *Config) process() (code []byte, err error) {
// Find the type and generate.
typ, err := lookupStructType(pkg.Scope(), cfg.Type)
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)
if err != nil {