Merge pull request #2156 from dmcgowan/helenxie-correct-variable-name
[carry #2153] Correct the variable name
This commit is contained in:
commit
c91563ff3a
1 changed files with 10 additions and 10 deletions
20
manifests.go
20
manifests.go
|
@ -22,8 +22,8 @@ type Manifest interface {
|
||||||
References() []Descriptor
|
References() []Descriptor
|
||||||
|
|
||||||
// Payload provides the serialized format of the manifest, in addition to
|
// Payload provides the serialized format of the manifest, in addition to
|
||||||
// the mediatype.
|
// the media type.
|
||||||
Payload() (mediatype string, payload []byte, err error)
|
Payload() (mediaType string, payload []byte, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ManifestBuilder creates a manifest allowing one to include dependencies.
|
// ManifestBuilder creates a manifest allowing one to include dependencies.
|
||||||
|
@ -94,20 +94,20 @@ var mappings = make(map[string]UnmarshalFunc, 0)
|
||||||
func UnmarshalManifest(ctHeader string, p []byte) (Manifest, Descriptor, error) {
|
func UnmarshalManifest(ctHeader string, p []byte) (Manifest, Descriptor, error) {
|
||||||
// Need to look up by the actual media type, not the raw contents of
|
// Need to look up by the actual media type, not the raw contents of
|
||||||
// the header. Strip semicolons and anything following them.
|
// the header. Strip semicolons and anything following them.
|
||||||
var mediatype string
|
var mediaType string
|
||||||
if ctHeader != "" {
|
if ctHeader != "" {
|
||||||
var err error
|
var err error
|
||||||
mediatype, _, err = mime.ParseMediaType(ctHeader)
|
mediaType, _, err = mime.ParseMediaType(ctHeader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, Descriptor{}, err
|
return nil, Descriptor{}, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unmarshalFunc, ok := mappings[mediatype]
|
unmarshalFunc, ok := mappings[mediaType]
|
||||||
if !ok {
|
if !ok {
|
||||||
unmarshalFunc, ok = mappings[""]
|
unmarshalFunc, ok = mappings[""]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, Descriptor{}, fmt.Errorf("unsupported manifest mediatype and no default available: %s", mediatype)
|
return nil, Descriptor{}, fmt.Errorf("unsupported manifest media type and no default available: %s", mediaType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,10 +116,10 @@ func UnmarshalManifest(ctHeader string, p []byte) (Manifest, Descriptor, error)
|
||||||
|
|
||||||
// RegisterManifestSchema registers an UnmarshalFunc for a given schema type. This
|
// RegisterManifestSchema registers an UnmarshalFunc for a given schema type. This
|
||||||
// should be called from specific
|
// should be called from specific
|
||||||
func RegisterManifestSchema(mediatype string, u UnmarshalFunc) error {
|
func RegisterManifestSchema(mediaType string, u UnmarshalFunc) error {
|
||||||
if _, ok := mappings[mediatype]; ok {
|
if _, ok := mappings[mediaType]; ok {
|
||||||
return fmt.Errorf("manifest mediatype registration would overwrite existing: %s", mediatype)
|
return fmt.Errorf("manifest media type registration would overwrite existing: %s", mediaType)
|
||||||
}
|
}
|
||||||
mappings[mediatype] = u
|
mappings[mediaType] = u
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue