Skip to content

Commit 00a5387

Browse files
committed
rlp/rlpgen: update
1 parent 39c1dd1 commit 00a5387

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rlp/rlpgen/gen.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,16 @@ func (ctx *genContext) addImport(pkg *types.Package) string {
139139
if p, exists := ctx.imports[pkg.Path()]; exists {
140140
return p.alias
141141
}
142-
baseName := pkg.Name()
143-
alias := baseName
144-
counter := 1
145-
146-
// If the base name conflicts with any existing import, add a numeric suffix
142+
var (
143+
baseName = pkg.Name()
144+
alias = baseName
145+
counter = 1
146+
)
147+
// If the base name conflicts with an existing import, add a numeric suffix.
147148
for ctx.hasAlias(alias) {
148149
alias = fmt.Sprintf("%s%d", baseName, counter)
149150
counter++
150151
}
151-
152152
ctx.imports[pkg.Path()] = genImportPackage{alias, pkg}
153153
return alias
154154
}

0 commit comments

Comments
 (0)