File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,12 +93,12 @@ func (p *GoParser) associateImplements() {
9393 for iface , iid := range p .interfaces {
9494 if types .Implements (typ , iface ) {
9595 tobj := p .getRepo ().GetType (tid )
96- tobj .Implements = append (tobj .Implements , iid )
96+ tobj .Implements = Append (tobj .Implements , iid )
9797 }
9898 // 另外检查 typ 的指针类型是否实现了 iface
9999 if types .Implements (types .NewPointer (typ ), iface ) {
100100 tobj := p .getRepo ().GetType (tid )
101- tobj .Implements = append (tobj .Implements , iid )
101+ tobj .Implements = Append (tobj .Implements , iid )
102102 }
103103 }
104104 }
Original file line number Diff line number Diff line change @@ -21,6 +21,15 @@ import (
2121 "os"
2222)
2323
24+ func Append [T comparable ](ids []T , id T ) []T {
25+ for _ , i := range ids {
26+ if i == id {
27+ return ids
28+ }
29+ }
30+ return append (ids , id )
31+ }
32+
2433func InsertDependency (ids []Dependency , id Dependency ) []Dependency {
2534 for _ , i := range ids {
2635 if i .Identity == id .Identity {
You can’t perform that action at this time.
0 commit comments