// KnownPackagePaths returns a new list of package paths of all known // packages in the package graph that could potentially be imported by // the given file. The list is ordered lexicographically, except that // all dot-free paths (standard packages) appear before dotful ones. // // It is part of the gopls.list_known_packages command. func KnownPackagePaths(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle) ([]PackagePath, error) { … } // isDirectlyCyclical checks if imported directly imports pkg. // It does not (yet) offer a full cyclical check because showing a user // a list of importable packages already generates a very large list // and having a few false positives in there could be worth the // performance snappiness. // // TODO(adonovan): ensure that metadata graph is always cyclic! // Many algorithms will get confused or even stuck in the // presence of cycles. Then replace this function by 'false'. func isDirectlyCyclical(pkg, imported *metadata.Package) bool { … }