Skip to content

Commit

Permalink
Merge pull request #310 from mtrmac/golint
Browse files Browse the repository at this point in the history
Make docker/tarfile.manifestItem public
  • Loading branch information
runcom authored Jul 20, 2017
2 parents b8a585d + 2613127 commit f0bdd73
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docker/tarfile/dest.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (d *Destination) PutManifest(m []byte) error {
layerPaths = append(layerPaths, l.Digest.String())
}

items := []manifestItem{{
items := []ManifestItem{{
Config: man.Config.Digest.String(),
RepoTags: []string{d.repoTag},
Layers: layerPaths,
Expand Down
10 changes: 5 additions & 5 deletions docker/tarfile/src.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
type Source struct {
tarPath string
// The following data is only available after ensureCachedDataIsPresent() succeeds
tarManifest *manifestItem // nil if not available yet.
tarManifest *ManifestItem // nil if not available yet.
configBytes []byte
configDigest digest.Digest
orderedDiffIDList []diffID
Expand Down Expand Up @@ -175,25 +175,25 @@ func (s *Source) ensureCachedDataIsPresent() error {
}

// loadTarManifest loads and decodes the manifest.json.
func (s *Source) loadTarManifest() ([]manifestItem, error) {
func (s *Source) loadTarManifest() ([]ManifestItem, error) {
// FIXME? Do we need to deal with the legacy format?
bytes, err := s.readTarComponent(manifestFileName)
if err != nil {
return nil, err
}
var items []manifestItem
var items []ManifestItem
if err := json.Unmarshal(bytes, &items); err != nil {
return nil, errors.Wrap(err, "Error decoding tar manifest.json")
}
return items, nil
}

// LoadTarManifest loads and decodes the manifest.json
func (s *Source) LoadTarManifest() ([]manifestItem, error) {
func (s *Source) LoadTarManifest() ([]ManifestItem, error) {
return s.loadTarManifest()
}

func (s *Source) prepareLayerData(tarManifest *manifestItem, parsedConfig *image) (map[diffID]*layerInfo, error) {
func (s *Source) prepareLayerData(tarManifest *ManifestItem, parsedConfig *image) (map[diffID]*layerInfo, error) {
// Collect layer data available in manifest and config.
if len(tarManifest.Layers) != len(parsedConfig.RootFS.DiffIDs) {
return nil, errors.Errorf("Inconsistent layer count: %d in manifest, %d in config", len(tarManifest.Layers), len(parsedConfig.RootFS.DiffIDs))
Expand Down
3 changes: 2 additions & 1 deletion docker/tarfile/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const (
// legacyRepositoriesFileName = "repositories"
)

type manifestItem struct {
// ManifestItem is an element of the array stored in the top-level manifest.json file.
type ManifestItem struct {
Config string
RepoTags []string
Layers []string
Expand Down

0 comments on commit f0bdd73

Please sign in to comment.