code: func loadIndex(data []byte) (*IndexFile, error) {
  	i := &IndexFile{}
  	if err := yaml.Unmarshal(data, i); err != nil {
  		return i, err
  	}
  	i.SortEntries()
  	if i.APIVersion == "" {
  		// When we leave Beta, we should remove legacy support and just
  		// return this error:
  		//return i, ErrNoAPIVersion
  		return loadUnversionedIndex(data)
  	}
  	return i, nil
  }
docs: // loadIndex loads an index file and does minimal validity checking.
  //
  // This will fail if API Version is not set (ErrNoAPIVersion) or if the unmarshal fails.