packages.go 788 B

1234567891011121314151617181920212223
  1. // Copyright 2020 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Package packagesinternal exposes internal-only fields from go/packages.
  5. package packagesinternal
  6. import "fmt"
  7. var GetDepsErrors = func(p any) []*PackageError { return nil }
  8. type PackageError struct {
  9. ImportStack []string // shortest path from package named on command line to this one
  10. Pos string // position of error (if present, file:line:col)
  11. Err string // the error itself
  12. }
  13. func (err PackageError) String() string {
  14. return fmt.Sprintf("%s: %s (import stack: %s)", err.Pos, err.Err, err.ImportStack)
  15. }
  16. var TypecheckCgo int
  17. var DepsErrors int // must be set as a LoadMode to call GetDepsErrors