We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8314b7a commit e8e5b37Copy full SHA for e8e5b37
internal/lsp/cache/graph.go
@@ -32,6 +32,10 @@ type metadataGraph struct {
32
// Clone creates a new metadataGraph, applying the given updates to the
33
// receiver.
34
func (g *metadataGraph) Clone(updates map[PackageID]*KnownMetadata) *metadataGraph {
35
+ if len(updates) == 0 {
36
+ // Optimization: since the graph is immutable, we can return the receiver.
37
+ return g
38
+ }
39
result := &metadataGraph{metadata: make(map[PackageID]*KnownMetadata, len(g.metadata))}
40
// Copy metadata.
41
for id, m := range g.metadata {
0 commit comments