2018-11-12 12:15:47 -07:00
|
|
|
// Copyright 2018 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package source
|
|
|
|
|
|
|
|
import (
|
2019-10-21 13:10:19 -06:00
|
|
|
"bytes"
|
2018-11-12 12:15:47 -07:00
|
|
|
"context"
|
2018-12-18 13:46:14 -07:00
|
|
|
"fmt"
|
2019-02-07 15:27:10 -07:00
|
|
|
|
2019-02-06 16:47:00 -07:00
|
|
|
"golang.org/x/tools/go/analysis"
|
2018-11-12 12:15:47 -07:00
|
|
|
"golang.org/x/tools/go/packages"
|
2019-08-14 18:12:18 -06:00
|
|
|
"golang.org/x/tools/internal/lsp/protocol"
|
2019-07-14 21:08:10 -06:00
|
|
|
"golang.org/x/tools/internal/lsp/telemetry"
|
2019-02-19 19:11:15 -07:00
|
|
|
"golang.org/x/tools/internal/span"
|
2019-08-13 13:07:39 -06:00
|
|
|
"golang.org/x/tools/internal/telemetry/log"
|
|
|
|
"golang.org/x/tools/internal/telemetry/trace"
|
2018-11-12 12:15:47 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
type Diagnostic struct {
|
2019-08-14 18:12:18 -06:00
|
|
|
URI span.URI
|
|
|
|
Range protocol.Range
|
2019-02-27 16:08:04 -07:00
|
|
|
Message string
|
|
|
|
Source string
|
2019-09-24 22:46:57 -06:00
|
|
|
Severity protocol.DiagnosticSeverity
|
2019-09-24 14:28:59 -06:00
|
|
|
Tags []protocol.DiagnosticTag
|
2019-06-20 14:57:45 -06:00
|
|
|
|
2019-09-06 12:55:14 -06:00
|
|
|
SuggestedFixes []SuggestedFix
|
2019-10-11 03:39:09 -06:00
|
|
|
Related []RelatedInformation
|
|
|
|
}
|
|
|
|
|
|
|
|
type RelatedInformation struct {
|
|
|
|
URI span.URI
|
|
|
|
Range protocol.Range
|
|
|
|
Message string
|
2019-06-20 14:57:45 -06:00
|
|
|
}
|
|
|
|
|
2019-02-27 16:08:04 -07:00
|
|
|
type DiagnosticSeverity int
|
|
|
|
|
|
|
|
const (
|
|
|
|
SeverityWarning DiagnosticSeverity = iota
|
|
|
|
SeverityError
|
|
|
|
)
|
|
|
|
|
2019-09-27 11:17:59 -06:00
|
|
|
func Diagnostics(ctx context.Context, view View, f File, disabledAnalyses map[string]struct{}) (map[span.URI][]Diagnostic, string, error) {
|
2019-07-09 18:16:21 -06:00
|
|
|
ctx, done := trace.StartSpan(ctx, "source.Diagnostics", telemetry.File.Of(f.URI()))
|
|
|
|
defer done()
|
2019-07-09 15:52:23 -06:00
|
|
|
|
2019-10-04 15:18:43 -06:00
|
|
|
snapshot, cphs, err := view.CheckPackageHandles(ctx, f)
|
2019-07-09 15:52:23 -06:00
|
|
|
if err != nil {
|
2019-09-06 16:25:36 -06:00
|
|
|
return nil, "", err
|
2019-07-09 15:52:23 -06:00
|
|
|
}
|
2019-10-10 13:22:30 -06:00
|
|
|
cph, err := WidestCheckPackageHandle(cphs)
|
|
|
|
if err != nil {
|
|
|
|
return nil, "", err
|
|
|
|
}
|
2019-09-23 18:19:50 -06:00
|
|
|
|
|
|
|
// If we are missing dependencies, it may because the user's workspace is
|
|
|
|
// not correctly configured. Report errors, if possible.
|
|
|
|
var warningMsg string
|
|
|
|
if len(cph.MissingDependencies()) > 0 {
|
|
|
|
warningMsg, err = checkCommonErrors(ctx, view, f.URI())
|
|
|
|
if err != nil {
|
|
|
|
log.Error(ctx, "error checking common errors", err, telemetry.File.Of(f.URI))
|
|
|
|
}
|
|
|
|
}
|
2019-07-09 15:52:23 -06:00
|
|
|
pkg, err := cph.Check(ctx)
|
|
|
|
if err != nil {
|
|
|
|
log.Error(ctx, "no package for file", err)
|
2019-09-06 16:25:36 -06:00
|
|
|
return singleDiagnostic(f.URI(), "%s is not part of a package", f.URI()), "", nil
|
2019-03-13 17:31:41 -06:00
|
|
|
}
|
2019-09-06 16:25:36 -06:00
|
|
|
|
2019-05-29 12:59:35 -06:00
|
|
|
// Prepare the reports we will send for the files in this package.
|
2019-02-19 19:11:15 -07:00
|
|
|
reports := make(map[span.URI][]Diagnostic)
|
2019-09-09 17:26:26 -06:00
|
|
|
for _, fh := range pkg.Files() {
|
2019-08-06 16:51:17 -06:00
|
|
|
clearReports(view, reports, fh.File().Identity().URI)
|
2018-11-12 12:15:47 -07:00
|
|
|
}
|
2019-05-17 11:45:50 -06:00
|
|
|
|
2019-05-29 12:59:35 -06:00
|
|
|
// Prepare any additional reports for the errors in this package.
|
2019-06-14 12:23:47 -06:00
|
|
|
for _, err := range pkg.GetErrors() {
|
|
|
|
if err.Kind != packages.ListError {
|
|
|
|
continue
|
|
|
|
}
|
2019-10-20 17:57:03 -06:00
|
|
|
clearReports(view, reports, err.URI)
|
2019-05-17 11:45:50 -06:00
|
|
|
}
|
|
|
|
|
2019-05-01 20:46:07 -06:00
|
|
|
// Run diagnostics for the package that this URI belongs to.
|
2019-06-21 15:00:02 -06:00
|
|
|
if !diagnostics(ctx, view, pkg, reports) {
|
2019-05-01 20:46:07 -06:00
|
|
|
// If we don't have any list, parse, or type errors, run analyses.
|
2019-10-04 15:18:43 -06:00
|
|
|
if err := analyses(ctx, snapshot, cph, disabledAnalyses, reports); err != nil {
|
2019-07-09 15:52:23 -06:00
|
|
|
log.Error(ctx, "failed to run analyses", err, telemetry.File.Of(f.URI()))
|
2019-05-01 20:46:07 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Updates to the diagnostics for this package may need to be propagated.
|
2019-09-27 11:17:59 -06:00
|
|
|
revDeps := view.GetActiveReverseDeps(ctx, f)
|
2019-09-23 18:06:15 -06:00
|
|
|
for _, cph := range revDeps {
|
2019-09-09 17:26:26 -06:00
|
|
|
pkg, err := cph.Check(ctx)
|
|
|
|
if err != nil {
|
2019-09-06 16:25:36 -06:00
|
|
|
return nil, warningMsg, err
|
2019-09-09 17:26:26 -06:00
|
|
|
}
|
|
|
|
for _, fh := range pkg.Files() {
|
2019-08-06 16:51:17 -06:00
|
|
|
clearReports(view, reports, fh.File().Identity().URI)
|
2019-05-01 20:46:07 -06:00
|
|
|
}
|
2019-06-21 15:00:02 -06:00
|
|
|
diagnostics(ctx, view, pkg, reports)
|
2019-05-01 20:46:07 -06:00
|
|
|
}
|
2019-09-06 16:25:36 -06:00
|
|
|
return reports, warningMsg, nil
|
2019-05-01 20:46:07 -06:00
|
|
|
}
|
|
|
|
|
2019-06-14 15:16:26 -06:00
|
|
|
type diagnosticSet struct {
|
2019-08-14 18:12:18 -06:00
|
|
|
listErrors, parseErrors, typeErrors []*Diagnostic
|
2019-06-14 15:16:26 -06:00
|
|
|
}
|
|
|
|
|
2019-08-02 17:45:56 -06:00
|
|
|
func diagnostics(ctx context.Context, view View, pkg Package, reports map[span.URI][]Diagnostic) bool {
|
2019-07-09 18:16:21 -06:00
|
|
|
ctx, done := trace.StartSpan(ctx, "source.diagnostics", telemetry.Package.Of(pkg.ID()))
|
|
|
|
defer done()
|
2019-08-02 17:45:56 -06:00
|
|
|
|
2019-06-14 15:16:26 -06:00
|
|
|
diagSets := make(map[span.URI]*diagnosticSet)
|
2019-03-06 14:33:47 -07:00
|
|
|
for _, err := range pkg.GetErrors() {
|
2019-08-14 18:12:18 -06:00
|
|
|
diag := &Diagnostic{
|
2019-10-20 17:57:03 -06:00
|
|
|
URI: err.URI,
|
2019-06-14 15:16:26 -06:00
|
|
|
Message: err.Msg,
|
2019-10-20 17:57:03 -06:00
|
|
|
Range: err.Range,
|
2019-09-24 22:46:57 -06:00
|
|
|
Severity: protocol.SeverityError,
|
2019-06-14 15:16:26 -06:00
|
|
|
}
|
2019-08-14 18:12:18 -06:00
|
|
|
set, ok := diagSets[diag.URI]
|
2019-06-14 15:16:26 -06:00
|
|
|
if !ok {
|
|
|
|
set = &diagnosticSet{}
|
2019-08-14 18:12:18 -06:00
|
|
|
diagSets[diag.URI] = set
|
2019-06-14 15:16:26 -06:00
|
|
|
}
|
2018-11-12 12:15:47 -07:00
|
|
|
switch err.Kind {
|
|
|
|
case packages.ParseError:
|
2019-06-14 15:16:26 -06:00
|
|
|
set.parseErrors = append(set.parseErrors, diag)
|
2019-10-20 17:57:03 -06:00
|
|
|
diag.Source = "syntax"
|
2018-11-12 12:15:47 -07:00
|
|
|
case packages.TypeError:
|
2019-06-14 15:16:26 -06:00
|
|
|
set.typeErrors = append(set.typeErrors, diag)
|
2019-10-20 17:57:03 -06:00
|
|
|
diag.Source = "compiler"
|
2018-11-12 12:15:47 -07:00
|
|
|
default:
|
2019-06-14 15:16:26 -06:00
|
|
|
set.listErrors = append(set.listErrors, diag)
|
2019-10-20 17:57:03 -06:00
|
|
|
diag.Source = "go list"
|
2018-11-12 12:15:47 -07:00
|
|
|
}
|
|
|
|
}
|
2019-06-14 15:16:26 -06:00
|
|
|
var nonEmptyDiagnostics bool // track if we actually send non-empty diagnostics
|
|
|
|
for uri, set := range diagSets {
|
|
|
|
// Don't report type errors if there are parse errors or list errors.
|
|
|
|
diags := set.typeErrors
|
|
|
|
if len(set.parseErrors) > 0 {
|
|
|
|
diags = set.parseErrors
|
|
|
|
} else if len(set.listErrors) > 0 {
|
|
|
|
diags = set.listErrors
|
2018-12-20 15:31:55 -07:00
|
|
|
}
|
2019-06-14 15:16:26 -06:00
|
|
|
if len(diags) > 0 {
|
|
|
|
nonEmptyDiagnostics = true
|
2018-11-12 12:15:47 -07:00
|
|
|
}
|
2019-06-14 15:16:26 -06:00
|
|
|
for _, diag := range diags {
|
|
|
|
if _, ok := reports[uri]; ok {
|
2019-08-14 18:12:18 -06:00
|
|
|
reports[uri] = append(reports[uri], *diag)
|
2019-06-14 15:16:26 -06:00
|
|
|
}
|
2018-11-12 12:15:47 -07:00
|
|
|
}
|
|
|
|
}
|
2019-06-14 15:16:26 -06:00
|
|
|
return nonEmptyDiagnostics
|
2019-05-01 20:46:07 -06:00
|
|
|
}
|
|
|
|
|
2019-10-04 15:18:43 -06:00
|
|
|
func analyses(ctx context.Context, snapshot Snapshot, cph CheckPackageHandle, disabledAnalyses map[string]struct{}, reports map[span.URI][]Diagnostic) error {
|
2019-02-06 09:24:10 -07:00
|
|
|
// Type checking and parsing succeeded. Run analyses.
|
2019-10-04 15:18:43 -06:00
|
|
|
if err := runAnalyses(ctx, snapshot, cph, disabledAnalyses, func(diags []*analysis.Diagnostic, a *analysis.Analyzer) error {
|
|
|
|
for _, diag := range diags {
|
|
|
|
diagnostic, err := toDiagnostic(ctx, snapshot.View(), diag, a.Name)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
addReport(snapshot.View(), reports, diagnostic.URI, diagnostic)
|
2019-03-15 11:19:43 -06:00
|
|
|
}
|
2019-04-22 15:05:43 -06:00
|
|
|
return nil
|
2019-04-25 13:50:50 -06:00
|
|
|
}); err != nil {
|
2019-05-01 20:46:07 -06:00
|
|
|
return err
|
2019-04-25 13:50:50 -06:00
|
|
|
}
|
2019-05-01 20:46:07 -06:00
|
|
|
return nil
|
2018-11-12 12:15:47 -07:00
|
|
|
}
|
|
|
|
|
2019-10-11 03:39:09 -06:00
|
|
|
func packageForSpan(ctx context.Context, view View, spn span.Span) (Package, error) {
|
2019-08-14 18:12:18 -06:00
|
|
|
f, err := view.GetFile(ctx, spn.URI())
|
|
|
|
if err != nil {
|
2019-10-11 03:39:09 -06:00
|
|
|
return nil, err
|
2019-08-14 18:12:18 -06:00
|
|
|
}
|
|
|
|
// If the package has changed since these diagnostics were computed,
|
|
|
|
// this may be incorrect. Should the package be associated with the diagnostic?
|
2019-09-27 11:17:59 -06:00
|
|
|
_, cphs, err := view.CheckPackageHandles(ctx, f)
|
2019-09-09 17:26:26 -06:00
|
|
|
if err != nil {
|
2019-10-11 03:39:09 -06:00
|
|
|
return nil, err
|
2019-09-09 17:26:26 -06:00
|
|
|
}
|
2019-10-10 13:22:30 -06:00
|
|
|
cph, err := NarrowestCheckPackageHandle(cphs)
|
2019-10-11 03:39:09 -06:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return cph.Cached(ctx)
|
|
|
|
}
|
|
|
|
|
|
|
|
func toDiagnostic(ctx context.Context, view View, diag *analysis.Diagnostic, category string) (Diagnostic, error) {
|
|
|
|
spn, err := span.NewRange(view.Session().Cache().FileSet(), diag.Pos, diag.End).Span()
|
2019-10-10 13:22:30 -06:00
|
|
|
if err != nil {
|
|
|
|
return Diagnostic{}, err
|
|
|
|
}
|
2019-10-11 03:39:09 -06:00
|
|
|
pkg, err := packageForSpan(ctx, view, spn)
|
2019-08-14 18:12:18 -06:00
|
|
|
if err != nil {
|
|
|
|
return Diagnostic{}, err
|
|
|
|
}
|
2019-10-20 17:57:03 -06:00
|
|
|
ph, err := pkg.File(spn.URI())
|
|
|
|
if err != nil {
|
|
|
|
return Diagnostic{}, err
|
|
|
|
}
|
|
|
|
_, m, _, err := ph.Cached(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return Diagnostic{}, err
|
|
|
|
}
|
|
|
|
rng, err := m.Range(spn)
|
2019-09-16 16:17:51 -06:00
|
|
|
if err != nil {
|
|
|
|
return Diagnostic{}, err
|
|
|
|
}
|
2019-09-24 14:28:59 -06:00
|
|
|
fixes, err := suggestedFixes(ctx, view, pkg, diag)
|
2019-06-20 14:57:45 -06:00
|
|
|
if err != nil {
|
|
|
|
return Diagnostic{}, err
|
|
|
|
}
|
2019-10-11 03:39:09 -06:00
|
|
|
|
|
|
|
related, err := relatedInformation(ctx, view, diag)
|
|
|
|
if err != nil {
|
|
|
|
return Diagnostic{}, err
|
|
|
|
}
|
|
|
|
|
2019-09-24 14:28:59 -06:00
|
|
|
// This is a bit of a hack, but clients > 3.15 will be able to grey out unnecessary code.
|
|
|
|
// If we are deleting code as part of all of our suggested fixes, assume that this is dead code.
|
|
|
|
// TODO(golang/go/#34508): Return these codes from the diagnostics themselves.
|
|
|
|
var tags []protocol.DiagnosticTag
|
|
|
|
if onlyDeletions(fixes) {
|
|
|
|
tags = append(tags, protocol.Unnecessary)
|
|
|
|
}
|
2019-10-04 15:18:43 -06:00
|
|
|
if diag.Category != "" {
|
|
|
|
category += "." + diag.Category
|
|
|
|
}
|
2019-06-20 14:57:45 -06:00
|
|
|
return Diagnostic{
|
2019-08-14 18:12:18 -06:00
|
|
|
URI: spn.URI(),
|
|
|
|
Range: rng,
|
2019-06-20 14:57:45 -06:00
|
|
|
Source: category,
|
|
|
|
Message: diag.Message,
|
2019-09-24 22:46:57 -06:00
|
|
|
Severity: protocol.SeverityWarning,
|
2019-09-24 14:28:59 -06:00
|
|
|
SuggestedFixes: fixes,
|
|
|
|
Tags: tags,
|
2019-10-11 03:39:09 -06:00
|
|
|
Related: related,
|
2019-06-20 14:57:45 -06:00
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2019-10-11 03:39:09 -06:00
|
|
|
func relatedInformation(ctx context.Context, view View, diag *analysis.Diagnostic) ([]RelatedInformation, error) {
|
|
|
|
var out []RelatedInformation
|
|
|
|
for _, related := range diag.Related {
|
|
|
|
r := span.NewRange(view.Session().Cache().FileSet(), related.Pos, related.End)
|
|
|
|
spn, err := r.Span()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
pkg, err := packageForSpan(ctx, view, spn)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
rng, err := spanToRange(ctx, view, pkg, spn, false)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
out = append(out, RelatedInformation{
|
|
|
|
URI: spn.URI(),
|
|
|
|
Range: rng,
|
|
|
|
Message: related.Message,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2019-10-21 13:10:19 -06:00
|
|
|
// spanToRange converts a span.Span to a protocol.Range,
|
|
|
|
// assuming that the span belongs to the package whose diagnostics are being computed.
|
|
|
|
func spanToRange(ctx context.Context, view View, pkg Package, spn span.Span, isTypeError bool) (protocol.Range, error) {
|
|
|
|
ph, err := pkg.File(spn.URI())
|
|
|
|
if err != nil {
|
|
|
|
return protocol.Range{}, err
|
|
|
|
}
|
|
|
|
_, m, _, err := ph.Cached(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return protocol.Range{}, err
|
|
|
|
}
|
|
|
|
data, _, err := ph.File().Read(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return protocol.Range{}, err
|
|
|
|
}
|
|
|
|
// Try to get a range for the diagnostic.
|
|
|
|
// TODO: Don't just limit ranges to type errors.
|
|
|
|
if spn.IsPoint() && isTypeError {
|
|
|
|
if s, err := spn.WithOffset(m.Converter); err == nil {
|
|
|
|
start := s.Start()
|
|
|
|
offset := start.Offset()
|
|
|
|
if width := bytes.IndexAny(data[offset:], " \n,():;[]"); width > 0 {
|
|
|
|
spn = span.New(spn.URI(), start, span.NewPoint(start.Line(), start.Column()+width, offset+width))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return m.Range(spn)
|
|
|
|
}
|
|
|
|
|
2019-06-20 14:57:45 -06:00
|
|
|
func clearReports(v View, reports map[span.URI][]Diagnostic, uri span.URI) {
|
2019-05-31 22:08:57 -06:00
|
|
|
if v.Ignore(uri) {
|
|
|
|
return
|
|
|
|
}
|
2019-06-20 14:57:45 -06:00
|
|
|
reports[uri] = []Diagnostic{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func addReport(v View, reports map[span.URI][]Diagnostic, uri span.URI, diagnostic Diagnostic) {
|
|
|
|
if v.Ignore(uri) {
|
|
|
|
return
|
2019-05-31 22:08:57 -06:00
|
|
|
}
|
2019-08-14 18:12:18 -06:00
|
|
|
if _, ok := reports[uri]; ok {
|
|
|
|
reports[uri] = append(reports[uri], diagnostic)
|
|
|
|
}
|
2019-05-31 22:08:57 -06:00
|
|
|
}
|
|
|
|
|
2019-03-29 14:14:24 -06:00
|
|
|
func singleDiagnostic(uri span.URI, format string, a ...interface{}) map[span.URI][]Diagnostic {
|
|
|
|
return map[span.URI][]Diagnostic{
|
|
|
|
uri: []Diagnostic{{
|
|
|
|
Source: "LSP",
|
2019-08-14 18:12:18 -06:00
|
|
|
URI: uri,
|
|
|
|
Range: protocol.Range{},
|
2019-03-29 14:14:24 -06:00
|
|
|
Message: fmt.Sprintf(format, a...),
|
2019-09-24 22:46:57 -06:00
|
|
|
Severity: protocol.SeverityError,
|
2019-03-29 14:14:24 -06:00
|
|
|
}},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-04 15:18:43 -06:00
|
|
|
func runAnalyses(ctx context.Context, snapshot Snapshot, cph CheckPackageHandle, disabledAnalyses map[string]struct{}, report func(diag []*analysis.Diagnostic, a *analysis.Analyzer) error) error {
|
2019-05-31 21:31:58 -06:00
|
|
|
var analyzers []*analysis.Analyzer
|
2019-10-04 15:18:43 -06:00
|
|
|
for _, a := range snapshot.View().Options().Analyzers {
|
2019-05-31 21:31:58 -06:00
|
|
|
if _, ok := disabledAnalyses[a.Name]; ok {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
analyzers = append(analyzers, a)
|
2019-02-06 09:24:10 -07:00
|
|
|
}
|
2019-02-07 15:27:10 -07:00
|
|
|
|
2019-10-04 15:18:43 -06:00
|
|
|
diagnostics, err := snapshot.Analyze(ctx, cph.ID(), analyzers)
|
2019-04-22 15:05:43 -06:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2019-02-07 15:27:10 -07:00
|
|
|
|
|
|
|
// Report diagnostics and errors from root analyzers.
|
2019-10-04 15:18:43 -06:00
|
|
|
var sdiags []Diagnostic
|
|
|
|
for a, diags := range diagnostics {
|
|
|
|
if err := report(diags, a); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
for _, diag := range diags {
|
|
|
|
sdiag, err := toDiagnostic(ctx, snapshot.View(), diag, a.Name)
|
2019-06-20 14:57:45 -06:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
sdiags = append(sdiags, sdiag)
|
2019-02-06 09:24:10 -07:00
|
|
|
}
|
2019-07-09 15:52:23 -06:00
|
|
|
pkg, err := cph.Check(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2019-10-04 15:18:43 -06:00
|
|
|
pkg.SetDiagnostics(a, sdiags)
|
2019-02-06 09:24:10 -07:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|