Skip to content

Commit

Permalink
Fix InterfaceImplementer ordering if interfaces have same name (#4188)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthchr authored Aug 12, 2024
1 parent 46bdfa0 commit f39b85e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions v2/tools/generator/internal/astmodel/interface_implementer.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ func (i InterfaceImplementer) AsDeclarations(
}

sort.Slice(interfaces, func(i int, j int) bool {
// If the names are the same, differentiate based on pkgname
if interfaces[i].Name().Name() == interfaces[j].Name().Name() {
return interfaces[i].Name().PackageReference().PackageName() < interfaces[j].Name().PackageReference().PackageName()
}

return interfaces[i].Name().Name() < interfaces[j].Name().Name()
})

Expand Down

0 comments on commit f39b85e

Please sign in to comment.