MCPcopy
hub / github.com/golang/tools / Package

Method Package

gopls/internal/cache/typerefs/pkggraph_test.go:103–121  ·  view source on GitHub ↗

Package gets the result of analyzing references for a single package.

(ctx context.Context, id metadata.PackageID)

Source from the content-addressed store, hash-verified

101
102// Package gets the result of analyzing references for a single package.
103func (g *PackageGraph) Package(ctx context.Context, id metadata.PackageID) (*Package, error) {
104 g.mu.Lock()
105 fut, ok := g.packages[id]
106 if ok {
107 g.mu.Unlock()
108 select {
109 case <-fut.done:
110 case <-ctx.Done():
111 return nil, ctx.Err()
112 }
113 } else {
114 fut = &futurePackage{done: make(chan struct{})}
115 g.packages[id] = fut
116 g.mu.Unlock()
117 fut.pkg, fut.err = g.buildPackage(ctx, id)
118 close(fut.done)
119 }
120 return fut.pkg, fut.err
121}
122
123// buildPackage parses a package and extracts its reference graph. It should
124// only be called from Package.

Callers 3

BuildPackageGraphFunction · 0.95
buildPackageMethod · 0.95
reachesByDepsMethod · 0.95

Calls 6

buildPackageMethod · 0.95
DoneMethod · 0.65
ErrMethod · 0.65
closeFunction · 0.50
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected