Skip to content

Commit 569025b

Browse files
committed
review: simplify
1 parent 588df60 commit 569025b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/golinters/importas/importas.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ func New(settings *config.ImportAsSettings) *goanalysis.Linter {
5151
uniqPackages[a.Pkg] = a
5252
}
5353

54-
// skip the duplication check when the alias is a regular expression replacement pattern (ie. contains `$`).
54+
// Skips the duplication check when:
55+
// - the alias is empty.
56+
// - the alias is a regular expression replacement pattern (ie. contains `$`).
5557
v, ok := uniqAliases[a.Alias]
56-
if ok && !strings.Contains(a.Alias, "$") {
58+
if ok && a.Alias != "" && !strings.Contains(a.Alias, "$") {
5759
lintCtx.Log.Errorf("invalid configuration, multiple packages with the same alias: alias=%s packages=[%s,%s]", a.Alias, a.Pkg, v.Pkg)
58-
} else if a.Alias != "" { // Ignore duplication for empty aliases.
60+
} else {
5961
uniqAliases[a.Alias] = a
6062
}
6163

0 commit comments

Comments
 (0)