From 871bc85774b611ba3bf1410e58b92dda29d755a8 Mon Sep 17 00:00:00 2001 From: Roman Khlystik Date: Wed, 10 Feb 2016 19:05:47 +0200 Subject: [PATCH] Make lint happy --- src/build/build.go | 2 +- src/build/client.go | 8 ++++---- src/build/commands.go | 2 +- src/imagename/imagename.go | 22 +++++++++++----------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/build/build.go b/src/build/build.go index 1c010050..d1bb56a8 100644 --- a/src/build/build.go +++ b/src/build/build.go @@ -270,7 +270,7 @@ func (b *Build) getExportsContainer() (c *docker.Container, err error) { // // See also TestBuild_LookupImage_* test cases in build_test.go func (b *Build) lookupImage(name string) (img *docker.Image, err error) { - if is_old, warning := imagename.WarnIfOldS3ImageName(name); is_old { + if isOld, warning := imagename.WarnIfOldS3ImageName(name); isOld { log.Warn(warning) } var ( diff --git a/src/build/client.go b/src/build/client.go index c5cc212a..8c80f4fa 100644 --- a/src/build/client.go +++ b/src/build/client.go @@ -120,7 +120,7 @@ func (c *DockerClient) PullImage(name string) error { // e.g. s3:bucket-name/image-name if image.Storage == imagename.StorageS3 { - if is_old, warning := imagename.WarnIfOldS3ImageName(name); is_old { + if isOld, warning := imagename.WarnIfOldS3ImageName(name); isOld { c.log.Warn(warning) } @@ -187,7 +187,7 @@ func (c *DockerClient) ListImages() (images []*imagename.ImageName, err error) { func (c *DockerClient) ListImageTags(name string) (images []*imagename.ImageName, err error) { img := imagename.NewFromString(name) if img.Storage == imagename.StorageS3 { - if is_old, warning := imagename.WarnIfOldS3ImageName(name); is_old { + if isOld, warning := imagename.WarnIfOldS3ImageName(name); isOld { c.log.Warn(warning) } return c.s3storage.ListTags(name) @@ -439,7 +439,7 @@ func (c *DockerClient) UploadToContainer(containerID string, stream io.Reader, p // TagImage adds tag to the image func (c *DockerClient) TagImage(imageID, imageName string) error { img := imagename.NewFromString(imageName) - if is_old, warning := imagename.WarnIfOldS3ImageName(imageName); is_old { + if isOld, warning := imagename.WarnIfOldS3ImageName(imageName); isOld { c.log.Warn(warning) } @@ -485,7 +485,7 @@ func (c *DockerClient) pushImageInner(imageName string) (digest string, err erro // Use direct S3 image pusher instead if img.Storage == imagename.StorageS3 { - if is_old, warning := imagename.WarnIfOldS3ImageName(imageName); is_old { + if isOld, warning := imagename.WarnIfOldS3ImageName(imageName); isOld { c.log.Warn(warning) } return c.s3storage.Push(imageName) diff --git a/src/build/commands.go b/src/build/commands.go index c7c88097..29b40436 100644 --- a/src/build/commands.go +++ b/src/build/commands.go @@ -997,7 +997,7 @@ func (c *CommandPush) Execute(b *Build) (State, error) { filePath := filepath.Join(b.cfg.ArtifactsPath, artifact.GetFileName()) artifacts := imagename.Artifacts{ - []imagename.Artifact{artifact}, + RockerArtifacts: []imagename.Artifact{artifact}, } content, err := yaml.Marshal(artifacts) if err != nil { diff --git a/src/imagename/imagename.go b/src/imagename/imagename.go index 12351caf..82b0e84e 100644 --- a/src/imagename/imagename.go +++ b/src/imagename/imagename.go @@ -46,8 +46,8 @@ const ( ) const ( - s3_prefix = "s3.amazonaws.com/" - s3_old_prefix = "s3:" + s3Prefix = "s3.amazonaws.com/" + s3OldPrefix = "s3:" ) var ( @@ -71,12 +71,12 @@ func NewFromString(image string) *ImageName { return New(name, tag) } -//Check whether an s3 image is referenced by old schema +// isOldS3ImageName Check whether an s3 image is referenced by old schema func isOldS3ImageName(imageName string) bool { - return strings.HasPrefix(imageName, s3_old_prefix) + return strings.HasPrefix(imageName, s3OldPrefix) } -//Check whether old image format is used. Also return warning message if yes +// WarnIfOldS3ImageName Check whether old image format is used. Also return warning message if yes func WarnIfOldS3ImageName(imageName string) (bool, string) { if !isOldS3ImageName(imageName) { return false, "" @@ -90,10 +90,10 @@ func WarnIfOldS3ImageName(imageName string) (bool, string) { return true, warning } -func (s *ImageName) makeOldS3Compatible(image string) string { +func (img *ImageName) makeOldS3Compatible(image string) string { if isOldS3ImageName(image) { - s.isOld = true - return strings.Replace(image, s3_old_prefix, s3_prefix, 1) + img.isOld = true + return strings.Replace(image, s3OldPrefix, s3Prefix, 1) } return image } @@ -116,10 +116,10 @@ func New(image string, tag string) *ImageName { firstIsHost := false - if strings.HasPrefix(image, s3_prefix) { + if strings.HasPrefix(image, s3Prefix) { dockerImage.Storage = StorageS3 firstIsHost = true - image = strings.TrimPrefix(image, s3_prefix) + image = strings.TrimPrefix(image, s3Prefix) } nameParts := strings.SplitN(image, "/", 2) @@ -277,7 +277,7 @@ func (img ImageName) NameWithRegistry() string { registryPrefix = img.Registry + "/" } if img.Storage == StorageS3 { - registryPrefix = s3_prefix + registryPrefix + registryPrefix = s3Prefix + registryPrefix } return registryPrefix + img.Name }