CompatibilizeSampleTypes makes profiles compatible to be compared/merged. It keeps sample types that appear in all profiles only and drops/reorders the sample types as necessary. In the case of sample types order is not the same for given profiles the order is derived from the first profile. Profi
(ps []*Profile)
| 584 | // |
| 585 | // It returns an error if the sample type's intersection is empty. |
| 586 | func CompatibilizeSampleTypes(ps []*Profile) error { |
| 587 | sTypes := commonSampleTypes(ps) |
| 588 | if len(sTypes) == 0 { |
| 589 | return fmt.Errorf("profiles have empty common sample type list") |
| 590 | } |
| 591 | for _, p := range ps { |
| 592 | if err := compatibilizeSampleTypes(p, sTypes); err != nil { |
| 593 | return err |
| 594 | } |
| 595 | } |
| 596 | return nil |
| 597 | } |
| 598 | |
| 599 | // commonSampleTypes returns sample types that appear in all profiles in the |
| 600 | // order how they ordered in the first profile. |
searching dependent graphs…