aboutsummaryrefslogtreecommitdiffhomepage
path: root/loader/errors.go
blob: 5aaf6cba6056d42ad51c5942ae8471a5260c216d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package loader

import "go/scanner"

// Errors contains a list of parser errors or a list of typechecker errors for
// the given package.
type Errors struct {
	Pkg  *Package
	Errs []error
}

func (e Errors) Error() string {
	return "could not compile: " + e.Errs[0].Error()
}

// Error is a regular error but with an added import stack. This is especially
// useful for debugging import cycle errors.
type Error struct {
	ImportStack []string
	Err         scanner.Error
}

func (e Error) Error() string {
	return e.Err.Error()
}

// Error returned when loading a *Program for a test binary but no test files
// are present.
type NoTestFilesError struct {
	ImportPath string
}

func (e NoTestFilesError) Error() string {
	return "no test files"
}