1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

/image - fix lint errors/warnings

Addresses #14756
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
This commit is contained in:
root 2015-07-21 05:49:27 +00:00 committed by Srini Brahmaroutu
parent 39999edcc9
commit b061572916
2 changed files with 28 additions and 14 deletions

View file

@ -17,6 +17,7 @@ packages=(
daemon/network daemon/network
docker docker
dockerinit dockerinit
image
integration-cli integration-cli
pkg/chrootarchive pkg/chrootarchive
pkg/directory pkg/directory

View file

@ -11,22 +11,35 @@ import (
var validHex = regexp.MustCompile(`^([a-f0-9]{64})$`) var validHex = regexp.MustCompile(`^([a-f0-9]{64})$`)
// Image stores the image configuration.
type Image struct { type Image struct {
ID string `json:"id"` // ID a unique 64 character identifier of the image
Parent string `json:"parent,omitempty"` ID string `json:"id"`
Comment string `json:"comment,omitempty"` // Parent id of the image
Created time.Time `json:"created"` Parent string `json:"parent,omitempty"`
Container string `json:"container,omitempty"` // Comment user added comment
ContainerConfig runconfig.Config `json:"container_config,omitempty"` Comment string `json:"comment,omitempty"`
DockerVersion string `json:"docker_version,omitempty"` // Created timestamp when image was created
Author string `json:"author,omitempty"` Created time.Time `json:"created"`
Config *runconfig.Config `json:"config,omitempty"` // Container is the id of the container used to commit
Architecture string `json:"architecture,omitempty"` Container string `json:"container,omitempty"`
OS string `json:"os,omitempty"` // ContainerConfig is the configuration of the container that is committed into the image
Size int64 ContainerConfig runconfig.Config `json:"container_config,omitempty"`
// DockerVersion specifies version on which image is built
DockerVersion string `json:"docker_version,omitempty"`
// Author of the image
Author string `json:"author,omitempty"`
// Config is the configuration of the container received from the client
Config *runconfig.Config `json:"config,omitempty"`
// Architecture is the hardware that the image is build and runs on
Architecture string `json:"architecture,omitempty"`
// OS is the operating system used to build and run the image
OS string `json:"os,omitempty"`
// Size is the total size of the image including all layers it is composed of
Size int64
} }
// Build an Image object from raw json data // NewImgJSON creates an Image configuration from json.
func NewImgJSON(src []byte) (*Image, error) { func NewImgJSON(src []byte) (*Image, error) {
ret := &Image{} ret := &Image{}
@ -37,7 +50,7 @@ func NewImgJSON(src []byte) (*Image, error) {
return ret, nil return ret, nil
} }
// Check wheather id is a valid image ID or not // ValidateID checks whether an ID string is a valid image ID.
func ValidateID(id string) error { func ValidateID(id string) error {
if ok := validHex.MatchString(id); !ok { if ok := validHex.MatchString(id); !ok {
return fmt.Errorf("image ID '%s' is invalid", id) return fmt.Errorf("image ID '%s' is invalid", id)