var ErrPartialResource … type Detector … // Detect returns a new [Resource] merged from all the Resources each of the // detectors produces. Each of the detectors are called sequentially, in the // order they are passed, merging the produced resource into the previous. // // This may return a partial Resource along with an error containing // [ErrPartialResource] if that error is returned from a detector. It may also // return a merge-conflicting Resource along with an error containing // [ErrSchemaURLConflict] if merging Resources from different detectors results // in a schema URL conflict. It is up to the caller to determine if this // returned Resource should be used or not. // // If one of the detectors returns an error that is not [ErrPartialResource], // the resource produced by the detector will not be merged and the returned // error will wrap that detector's error. func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) { … } // detect runs all detectors using ctx and merges the result into res. This // assumes res is allocated and not nil, it will panic otherwise. // // If the detectors or merging resources produces any errors (i.e. // [ErrPartialResource] [ErrSchemaURLConflict]), a single error wrapping all of // these errors will be returned. Otherwise, nil is returned. func detect(ctx context.Context, res *Resource, detectors []Detector) error { … } type detectErrs … func (e detectErrs) Error() string { … } func (e detectErrs) Unwrap() error { … } func (e detectErrs) Is(target error) bool { … }