rlp/rlpgen: update

This commit is contained in:
Felix Lange 2025-06-19 17:06:02 +02:00
parent 39c1dd1f61
commit 00a5387995

View file

@ -139,16 +139,16 @@ func (ctx *genContext) addImport(pkg *types.Package) string {
if p, exists := ctx.imports[pkg.Path()]; exists {
return p.alias
}
baseName := pkg.Name()
alias := baseName
counter := 1
// If the base name conflicts with any existing import, add a numeric suffix
var (
baseName = pkg.Name()
alias = baseName
counter = 1
)
// If the base name conflicts with an existing import, add a numeric suffix.
for ctx.hasAlias(alias) {
alias = fmt.Sprintf("%s%d", baseName, counter)
counter++
}
ctx.imports[pkg.Path()] = genImportPackage{alias, pkg}
return alias
}