hcl: Add Diagnostics.Errs()

This commit is contained in:
Radek Simko 2018-07-02 14:15:58 +01:00
parent 36446359d2
commit 1b7f2717a3
No known key found for this signature in database
GPG Key ID: 1F1C84FE689A88D7

View File

@ -96,6 +96,17 @@ func (d Diagnostics) HasErrors() bool {
return false
}
func (d Diagnostics) Errs() []error {
var errs []error
for _, diag := range d {
if diag.Severity == DiagError {
errs = append(errs, diag)
}
}
return errs
}
// A DiagnosticWriter emits diagnostics somehow.
type DiagnosticWriter interface {
WriteDiagnostic(*Diagnostic) error