aboutsummaryrefslogtreecommitdiff
path: root/spec/spec.go
diff options
context:
space:
mode:
Diffstat (limited to 'spec/spec.go')
-rw-r--r--spec/spec.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/spec/spec.go b/spec/spec.go
index 3d46269..28d5abc 100644
--- a/spec/spec.go
+++ b/spec/spec.go
@@ -256,10 +256,12 @@ func findSpellingInconsistenciesErrors(ids []string, hook func(ids []string) err
var errs []error
for _, dup := range duplicated {
- err := hook(dup)
- if err != nil {
- errs = append(errs, err)
- continue
+ if hook != nil {
+ err := hook(dup)
+ if err != nil {
+ errs = append(errs, err)
+ continue
+ }
}
var b strings.Builder
@@ -267,7 +269,7 @@ func findSpellingInconsistenciesErrors(ids []string, hook func(ids []string) err
for _, id := range dup[1:] {
fmt.Fprintf(&b, ", %+v", id)
}
- err = fmt.Errorf("these identifiers are treated as the same. please use the same spelling: %v", b.String())
+ err := fmt.Errorf("these identifiers are treated as the same. please use the same spelling: %v", b.String())
errs = append(errs, err)
}