code: func MergeHeaders(src []*Header) (h *Header, reflinks [][]*Reference, err error) {
  	switch len(src) {
  	case 0:
  		return nil, nil, nil
  	case 1:
  		return src[0], nil, nil
  	}
  	reflinks = make([][]*Reference, len(src))
  	h = src[0].Clone()
  	h.SortOrder = UnknownOrder
  	h.GroupOrder = GroupUnspecified
  	for i, add := range src {
  		if i == 0 {
  			reflinks[i] = h.refs
  			continue
  		}
  		links := make([]*Reference, len(add.refs))
  		for id, r := range add.refs {
  			r = r.Clone()
  			err := h.AddReference(r)
  			if err != nil {
  				return nil, nil, err
  			}
  			if r.owner != h {
  				// r was not actually added, so use the ref
  				// that h owns.
  				for _, hr := range h.refs {
  					if equalRefs(r, hr) {
  						r = hr
  						break
  					}
  				}
  			}
  			links[id] = r
  		}
  		reflinks[i] = links
  	}
  
  	return h, reflinks, nil
  }
docs: // MergeHeaders returns a new Header resulting from the merge of the
  // source Headers, and a mapping between the references in the source
  // and the References in the returned Header. Sort order is set to
  // unknown and group order is set to none. If a single Header is passed
  // to MergeHeaders, the mapping between source and destination headers,
  // reflink, is returned as nil.
  // The returned Header contains the read groups and programs of the
  // first Header in src.