Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Avoid aliasing package names
Browse files Browse the repository at this point in the history
  • Loading branch information
tt committed Oct 3, 2018
1 parent fd2fe80 commit 100efed
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions registry/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"io/ioutil"
"net/http"

manifestV1 "github.com/docker/distribution/manifest/schema1"
manifestV2 "github.com/docker/distribution/manifest/schema2"
"github.com/docker/distribution/manifest/schema1"
"github.com/docker/distribution/manifest/schema2"
digest "github.com/opencontainers/go-digest"
)

func (registry *Registry) Manifest(repository, reference string) (*manifestV1.SignedManifest, error) {
func (registry *Registry) Manifest(repository, reference string) (*schema1.SignedManifest, error) {
url := registry.url("/v2/%s/manifests/%s", repository, reference)
registry.Logf("registry.manifest.get url=%s repository=%s reference=%s", url, repository, reference)

Expand All @@ -19,7 +19,7 @@ func (registry *Registry) Manifest(repository, reference string) (*manifestV1.Si
return nil, err
}

req.Header.Set("Accept", manifestV1.MediaTypeManifest)
req.Header.Set("Accept", schema1.MediaTypeManifest)
resp, err := registry.Client.Do(req)
if err != nil {
return nil, err
Expand All @@ -31,7 +31,7 @@ func (registry *Registry) Manifest(repository, reference string) (*manifestV1.Si
return nil, err
}

signedManifest := &manifestV1.SignedManifest{}
signedManifest := &schema1.SignedManifest{}
err = signedManifest.UnmarshalJSON(body)
if err != nil {
return nil, err
Expand All @@ -40,7 +40,7 @@ func (registry *Registry) Manifest(repository, reference string) (*manifestV1.Si
return signedManifest, nil
}

func (registry *Registry) ManifestV2(repository, reference string) (*manifestV2.DeserializedManifest, error) {
func (registry *Registry) ManifestV2(repository, reference string) (*schema2.DeserializedManifest, error) {
url := registry.url("/v2/%s/manifests/%s", repository, reference)
registry.Logf("registry.manifest.get url=%s repository=%s reference=%s", url, repository, reference)

Expand All @@ -49,7 +49,7 @@ func (registry *Registry) ManifestV2(repository, reference string) (*manifestV2.
return nil, err
}

req.Header.Set("Accept", manifestV2.MediaTypeManifest)
req.Header.Set("Accept", schema2.MediaTypeManifest)
resp, err := registry.Client.Do(req)
if err != nil {
return nil, err
Expand All @@ -61,7 +61,7 @@ func (registry *Registry) ManifestV2(repository, reference string) (*manifestV2.
return nil, err
}

deserialized := &manifestV2.DeserializedManifest{}
deserialized := &schema2.DeserializedManifest{}
err = deserialized.UnmarshalJSON(body)
if err != nil {
return nil, err
Expand Down Expand Up @@ -101,7 +101,7 @@ func (registry *Registry) DeleteManifest(repository string, digest digest.Digest
return nil
}

func (registry *Registry) PutManifest(repository, reference string, signedManifest *manifestV1.SignedManifest) error {
func (registry *Registry) PutManifest(repository, reference string, signedManifest *schema1.SignedManifest) error {
url := registry.url("/v2/%s/manifests/%s", repository, reference)
registry.Logf("registry.manifest.put url=%s repository=%s reference=%s", url, repository, reference)

Expand All @@ -116,7 +116,7 @@ func (registry *Registry) PutManifest(repository, reference string, signedManife
return err
}

req.Header.Set("Content-Type", manifestV1.MediaTypeManifest)
req.Header.Set("Content-Type", schema1.MediaTypeManifest)
resp, err := registry.Client.Do(req)
if resp != nil {
defer resp.Body.Close()
Expand Down

0 comments on commit 100efed

Please sign in to comment.