// DiagnoseFile returns pull-based diagnostics for the given file. func DiagnoseFile(ctx context.Context, snapshot *cache.Snapshot, uri protocol.DocumentURI) ([]*cache.Diagnostic, error) { … } // Analyze reports go/analysis-framework diagnostics in the specified package. // // If the provided tracker is non-nil, it may be used to provide notifications // of the ongoing analysis pass. // // TODO(rfindley): merge this with snapshot.Analyze. func Analyze(ctx context.Context, snapshot *cache.Snapshot, pkgIDs map[PackageID]*metadata.Package, tracker *progress.Tracker) (map[protocol.DocumentURI][]*cache.Diagnostic, error) { … } // byURI is used for grouping diagnostics. func byURI(d *cache.Diagnostic) protocol.DocumentURI { … } // CombineDiagnostics combines and filters list/parse/type diagnostics from // tdiags with the analysis adiags, returning the resulting combined set. // // Type-error analyzers produce diagnostics that are redundant with type // checker diagnostics, but more detailed (e.g. fixes). Rather than report two // diagnostics for the same problem, we combine them by augmenting the // type-checker diagnostic and discarding the analyzer diagnostic. // // If an analysis diagnostic has the same range and message as a // list/parse/type diagnostic, the suggested fix information (et al) of the // latter is merged into a copy of the former. This handles the case where a // type-error analyzer suggests a fix to a type error, and avoids duplication. // // The arguments are not modified. func CombineDiagnostics(tdiags []*cache.Diagnostic, adiags []*cache.Diagnostic) []*cache.Diagnostic { … }