File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ func (v *View) applyContentChange(uri span.URI, content []byte) {
172
172
173
173
// Remove the package and all of its reverse dependencies from the cache.
174
174
if f .pkg != nil {
175
- v .remove (f .pkg .pkgPath )
175
+ v .remove (f .pkg .pkgPath , map [ string ] struct {}{} )
176
176
}
177
177
178
178
switch {
@@ -191,13 +191,17 @@ func (v *View) applyContentChange(uri span.URI, content []byte) {
191
191
// remove invalidates a package and its reverse dependencies in the view's
192
192
// package cache. It is assumed that the caller has locked both the mutexes
193
193
// of both the mcache and the pcache.
194
- func (v * View ) remove (pkgPath string ) {
194
+ func (v * View ) remove (pkgPath string , seen map [string ]struct {}) {
195
+ if _ , ok := seen [pkgPath ]; ok {
196
+ return
197
+ }
195
198
m , ok := v .mcache .packages [pkgPath ]
196
199
if ! ok {
197
200
return
198
201
}
202
+ seen [pkgPath ] = struct {}{}
199
203
for parentPkgPath := range m .parents {
200
- v .remove (parentPkgPath )
204
+ v .remove (parentPkgPath , seen )
201
205
}
202
206
// All of the files in the package may also be holding a pointer to the
203
207
// invalidated package.
You can’t perform that action at this time.
0 commit comments