Add detached source lookup to results and errors
This commit is contained in:
@@ -50,6 +50,16 @@ func (e *LoadError) Sources() []SourceInfo {
|
||||
return cloneSourceInfos(e.sources)
|
||||
}
|
||||
|
||||
// Source returns a detached record from the source evidence retained before
|
||||
// loading failed. IDs are local to the failed load. Empty or unknown IDs return
|
||||
// false.
|
||||
func (e *LoadError) Source(id string) (SourceInfo, bool) {
|
||||
if e == nil {
|
||||
return SourceInfo{}, false
|
||||
}
|
||||
return lookupSourceInfo(e.sources, id)
|
||||
}
|
||||
|
||||
// WriteDiagnostics writes diagnostics in canonical order. It escapes terminal
|
||||
// control characters and propagates writer errors, including short writes.
|
||||
func WriteDiagnostics(output io.Writer, diagnostics []Diagnostic) error {
|
||||
|
||||
Reference in New Issue
Block a user