Add detached source lookup to results and errors
This commit is contained in:
14
lifecycle.go
14
lifecycle.go
@@ -214,6 +214,20 @@ func (r *Result[T]) Sources() []SourceInfo {
|
||||
return result
|
||||
}
|
||||
|
||||
// Source returns a detached record for an acquired source in this load. IDs are
|
||||
// local to the load; the lookup does not reacquire the source or access the
|
||||
// filesystem. Empty or unknown IDs return false.
|
||||
func (r *Result[T]) Source(id string) (SourceInfo, bool) {
|
||||
if r == nil || r.inspection == nil {
|
||||
return SourceInfo{}, false
|
||||
}
|
||||
value, ok := r.inspection.Source(id)
|
||||
if !ok {
|
||||
return SourceInfo{}, false
|
||||
}
|
||||
return fromEngineSourceInfo(value), true
|
||||
}
|
||||
|
||||
// Diagnostics returns detached nonfatal diagnostics from the load.
|
||||
func (r *Result[T]) Diagnostics() []Diagnostic {
|
||||
if r == nil || r.inspection == nil {
|
||||
|
||||
Reference in New Issue
Block a user