Skip to content

Commit 701dfb7

Browse files
committed
fix: one issue by line is enough.
1 parent 68a1b5b commit 701dfb7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

gomoddirectives.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,22 @@ func AnalyzeFile(file *modfile.File, opts Options) []Result {
7979
uniqReplace := map[string]struct{}{}
8080

8181
for _, r := range file.Replace {
82+
reason := check(opts, r)
83+
if reason != "" {
84+
results = append(results, NewResult(file, r.Syntax, reason))
85+
continue
86+
}
87+
8288
if r.Old.Path == r.New.Path && r.Old.Version == r.New.Version {
8389
results = append(results, NewResult(file, r.Syntax, reasonReplaceIdentical))
90+
continue
8491
}
8592

8693
if _, ok := uniqReplace[r.Old.Path+r.Old.Version]; ok {
8794
results = append(results, NewResult(file, r.Syntax, reasonReplaceDuplicate))
8895
}
8996

9097
uniqReplace[r.Old.Path+r.Old.Version] = struct{}{}
91-
92-
reason := check(opts, r)
93-
if reason == "" {
94-
continue
95-
}
96-
97-
results = append(results, NewResult(file, r.Syntax, reason))
9898
}
9999

100100
return results

0 commit comments

Comments
 (0)