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 {
|
if p, exists := ctx.imports[pkg.Path()]; exists {
|
||||||
return p.alias
|
return p.alias
|
||||||
}
|
}
|
||||||
baseName := pkg.Name()
|
var (
|
||||||
alias := baseName
|
baseName = pkg.Name()
|
||||||
counter := 1
|
alias = baseName
|
||||||
|
counter = 1
|
||||||
// If the base name conflicts with any existing import, add a numeric suffix
|
)
|
||||||
|
// If the base name conflicts with an existing import, add a numeric suffix.
|
||||||
for ctx.hasAlias(alias) {
|
for ctx.hasAlias(alias) {
|
||||||
alias = fmt.Sprintf("%s%d", baseName, counter)
|
alias = fmt.Sprintf("%s%d", baseName, counter)
|
||||||
counter++
|
counter++
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.imports[pkg.Path()] = genImportPackage{alias, pkg}
|
ctx.imports[pkg.Path()] = genImportPackage{alias, pkg}
|
||||||
return alias
|
return alias
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue