mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
rlp/rlpgen: update
This commit is contained in:
parent
39c1dd1f61
commit
00a5387995
1 changed files with 6 additions and 6 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue