code: func (dst *Set) Add(d digest.Digest) error {
  	if err := d.Validate(); err != nil {
  		return err
  	}
  	dst.mutex.Lock()
  	defer dst.mutex.Unlock()
  	entry := &digestEntry{alg: d.Algorithm(), val: d.Hex(), digest: d}
  	searchFunc := func(i int) bool {
  		if dst.entries[i].val == entry.val {
  			return dst.entries[i].alg >= entry.alg
  		}
  		return dst.entries[i].val >= entry.val
  	}
  	idx := sort.Search(len(dst.entries), searchFunc)
  	if idx == len(dst.entries) {
  		dst.entries = append(dst.entries, entry)
  		return nil
  	} else if dst.entries[idx].digest == d {
  		return nil
  	}
  
  	entries := append(dst.entries, nil)
  	copy(entries[idx+1:], entries[idx:len(entries)-1])
  	entries[idx] = entry
  	dst.entries = entries
  	return nil
  }
docs: // Add adds the given digest to the set. An error will be returned
  // if the given digest is invalid. If the digest already exists in the
  // set, this operation will be a no-op.