func (d Diagnostics) Error() string {
	count := len(d)
	switch {
	case count == 0:
		return "no diagnostics"
	case count == 1:
		return d[0].Error()
	default:
		return fmt.Sprintf("%s, and %d other diagnostic(s)", d[0].Error(), count-1)
	}
}
error implementation, so that sets of diagnostics can be returned via
APIs that normally deal in vanilla Go errors.
package hcl
import (
	"fmt"
)
type DiagnosticSeverity int
const (
	DiagInvalid DiagnosticSeverity = iota
	DiagError
	DiagWarning
)
type Diagnostic struct {
	Severity DiagnosticSeverity
	Summary string
	Detail  string
	Subject *Range
	Context *Range
	Expression  Expression
	EvalContext *EvalContext
}
type Diagnostics []*Diagnostic
func (d *Diagnostic) Error() string {
	return fmt.Sprintf("%s: %s; %s", d.Subject, d.Summary, d.Detail)
}