From 1980e3183081825978ec2a4dc25138390d0c2b77 Mon Sep 17 00:00:00 2001 From: Cornelius Weig <22861411+corneliusweig@users.noreply.github.com> Date: Mon, 23 Sep 2019 23:49:48 +0200 Subject: [PATCH] Bump golangci-lint to v0.19.0 Align receiver names as reported by stylecheck Signed-off-by: Cornelius Weig <22861411+corneliusweig@users.noreply.github.com> --- pkg/skaffold/schema/v1alpha2/upgrade.go | 20 ++++++++++---------- pkg/skaffold/schema/v1alpha3/upgrade.go | 14 +++++++------- pkg/skaffold/schema/v1alpha4/upgrade.go | 4 ++-- pkg/skaffold/schema/v1alpha5/upgrade.go | 8 ++++---- pkg/skaffold/schema/v1beta1/upgrade.go | 4 ++-- pkg/skaffold/schema/v1beta10/upgrade.go | 4 ++-- pkg/skaffold/schema/v1beta11/upgrade.go | 4 ++-- pkg/skaffold/schema/v1beta12/upgrade.go | 4 ++-- pkg/skaffold/schema/v1beta13/upgrade.go | 6 +++--- pkg/skaffold/schema/v1beta14/upgrade.go | 6 +++--- pkg/skaffold/schema/v1beta2/upgrade.go | 4 ++-- pkg/skaffold/schema/v1beta3/upgrade.go | 4 ++-- pkg/skaffold/schema/v1beta4/upgrade.go | 4 ++-- pkg/skaffold/schema/v1beta5/upgrade.go | 4 ++-- pkg/skaffold/schema/v1beta6/upgrade.go | 18 +++++++++--------- pkg/skaffold/schema/v1beta7/upgrade.go | 4 ++-- pkg/skaffold/schema/v1beta8/upgrade.go | 6 +++--- pkg/skaffold/schema/v1beta9/upgrade.go | 6 +++--- pkg/skaffold/sync/sync.go | 14 +++++++------- 19 files changed, 69 insertions(+), 69 deletions(-) diff --git a/pkg/skaffold/schema/v1alpha2/upgrade.go b/pkg/skaffold/schema/v1alpha2/upgrade.go index 06a9458cda9..8e530bc3f9c 100644 --- a/pkg/skaffold/schema/v1alpha2/upgrade.go +++ b/pkg/skaffold/schema/v1alpha2/upgrade.go @@ -29,13 +29,13 @@ import ( // 3. Updates // - KanikoBuildContext instead of GCSBucket // - HelmRelease.valuesFilePath -> valuesFiles in yaml -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { // convert Deploy (should be the same) var newDeploy next.DeployConfig - pkgutil.CloneThroughJSON(config.Deploy, &newDeploy) + pkgutil.CloneThroughJSON(c.Deploy, &newDeploy) // if the helm deploy config was set, then convert ValueFilePath to ValuesFiles - if oldHelmDeploy := config.Deploy.DeployType.HelmDeploy; oldHelmDeploy != nil { + if oldHelmDeploy := c.Deploy.DeployType.HelmDeploy; oldHelmDeploy != nil { for i, oldHelmRelease := range oldHelmDeploy.Releases { if oldHelmRelease.ValuesFilePath != "" { newDeploy.DeployType.HelmDeploy.Releases[i].ValuesFiles = []string{oldHelmRelease.ValuesFilePath} @@ -45,12 +45,12 @@ func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { // convert Profiles (should be the same) var newProfiles []next.Profile - if config.Profiles != nil { - pkgutil.CloneThroughJSON(config.Profiles, &newProfiles) + if c.Profiles != nil { + pkgutil.CloneThroughJSON(c.Profiles, &newProfiles) } // if the helm deploy config was set for a profile, then convert ValueFilePath to ValuesFiles - for p, oldProfile := range config.Profiles { + for p, oldProfile := range c.Profiles { if oldProfileHelmDeploy := oldProfile.Deploy.DeployType.HelmDeploy; oldProfileHelmDeploy != nil { for i, oldProfileHelmRelease := range oldProfileHelmDeploy.Releases { if oldProfileHelmRelease.ValuesFilePath != "" { @@ -61,12 +61,12 @@ func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { } // convert Build (different only for kaniko) - oldKanikoBuilder := config.Build.KanikoBuild - config.Build.KanikoBuild = nil + oldKanikoBuilder := c.Build.KanikoBuild + c.Build.KanikoBuild = nil // copy over old build config to new build config var newBuild next.BuildConfig - pkgutil.CloneThroughJSON(config.Build, &newBuild) + pkgutil.CloneThroughJSON(c.Build, &newBuild) // if the kaniko build was set, then convert it if oldKanikoBuilder != nil { @@ -83,7 +83,7 @@ func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { return &next.SkaffoldConfig{ APIVersion: next.Version, - Kind: config.Kind, + Kind: c.Kind, Deploy: newDeploy, Build: newBuild, Profiles: newProfiles, diff --git a/pkg/skaffold/schema/v1alpha3/upgrade.go b/pkg/skaffold/schema/v1alpha3/upgrade.go index 1a19078df00..6d29afdba21 100644 --- a/pkg/skaffold/schema/v1alpha3/upgrade.go +++ b/pkg/skaffold/schema/v1alpha3/upgrade.go @@ -39,30 +39,30 @@ import ( // - Artifact.imageName -> image, workspace -> context in yaml // - DockerArtifact.dockerfilePath -> dockerfile in yaml // - BazelArtifact.BuildTarget is optional in yaml -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { // convert Deploy (should be the same) var newDeploy next.DeployConfig - pkgutil.CloneThroughJSON(config.Deploy, &newDeploy) + pkgutil.CloneThroughJSON(c.Deploy, &newDeploy) // convert Profiles (should be the same) var newProfiles []next.Profile - if config.Profiles != nil { - pkgutil.CloneThroughJSON(config.Profiles, &newProfiles) + if c.Profiles != nil { + pkgutil.CloneThroughJSON(c.Profiles, &newProfiles) - for i, oldProfile := range config.Profiles { + for i, oldProfile := range c.Profiles { convertBuild(oldProfile.Build, newProfiles[i].Build) } } // convert Build (should be the same) var newBuild next.BuildConfig - oldBuild := config.Build + oldBuild := c.Build pkgutil.CloneThroughJSON(oldBuild, &newBuild) convertBuild(oldBuild, newBuild) return &next.SkaffoldConfig{ APIVersion: next.Version, - Kind: config.Kind, + Kind: c.Kind, Deploy: newDeploy, Build: newBuild, Profiles: newProfiles, diff --git a/pkg/skaffold/schema/v1alpha4/upgrade.go b/pkg/skaffold/schema/v1alpha4/upgrade.go index 1f3a4c6c5ee..dd23e1f2a66 100644 --- a/pkg/skaffold/schema/v1alpha4/upgrade.go +++ b/pkg/skaffold/schema/v1alpha4/upgrade.go @@ -29,10 +29,10 @@ import ( // 2. No removal // 3. Updates // - minor - []TestCase type aliased to TestConfig -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) + pkgutil.CloneThroughJSON(c, &newConfig) newConfig.APIVersion = next.Version return &newConfig, nil diff --git a/pkg/skaffold/schema/v1alpha5/upgrade.go b/pkg/skaffold/schema/v1alpha5/upgrade.go index 29c78d1c6d3..29c5b809686 100644 --- a/pkg/skaffold/schema/v1alpha5/upgrade.go +++ b/pkg/skaffold/schema/v1alpha5/upgrade.go @@ -31,12 +31,12 @@ import ( // 2. Removals: // - AzureContainerBuilder // 3. No updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { - if config.Build.AzureContainerBuild != nil { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { + if c.Build.AzureContainerBuild != nil { return nil, errors.Errorf("can't upgrade to %s, build.acr is not supported anymore, please remove it manually", next.Version) } - for _, profile := range config.Profiles { + for _, profile := range c.Profiles { if profile.Build.AzureContainerBuild != nil { return nil, errors.Errorf("can't upgrade to %s, profiles.build.acr is not supported anymore, please remove it from the %s profile manually", next.Version, profile.Name) } @@ -44,7 +44,7 @@ func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) + pkgutil.CloneThroughJSON(c, &newConfig) newConfig.APIVersion = next.Version return &newConfig, nil diff --git a/pkg/skaffold/schema/v1beta1/upgrade.go b/pkg/skaffold/schema/v1beta1/upgrade.go index c8a3d1b4f37..4e598d8a1d4 100644 --- a/pkg/skaffold/schema/v1beta1/upgrade.go +++ b/pkg/skaffold/schema/v1beta1/upgrade.go @@ -28,10 +28,10 @@ import ( // Kaniko AdditionalFlags // 2. No removals // 3. No updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) + pkgutil.CloneThroughJSON(c, &newConfig) newConfig.APIVersion = next.Version return &newConfig, nil diff --git a/pkg/skaffold/schema/v1beta10/upgrade.go b/pkg/skaffold/schema/v1beta10/upgrade.go index 62f893da957..4293a290ad2 100644 --- a/pkg/skaffold/schema/v1beta10/upgrade.go +++ b/pkg/skaffold/schema/v1beta10/upgrade.go @@ -28,10 +28,10 @@ import ( // - GitTagger variants `TreeSha` and `AbbrevTreeSha` // 2. No removals // 3. No Updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) + pkgutil.CloneThroughJSON(c, &newConfig) newConfig.APIVersion = next.Version return &newConfig, nil diff --git a/pkg/skaffold/schema/v1beta11/upgrade.go b/pkg/skaffold/schema/v1beta11/upgrade.go index f439470c8e9..f28ada6d4d9 100644 --- a/pkg/skaffold/schema/v1beta11/upgrade.go +++ b/pkg/skaffold/schema/v1beta11/upgrade.go @@ -27,10 +27,10 @@ import ( // 1. No Additions // 2. No removals // 3. No Updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) + pkgutil.CloneThroughJSON(c, &newConfig) newConfig.APIVersion = next.Version return &newConfig, nil diff --git a/pkg/skaffold/schema/v1beta12/upgrade.go b/pkg/skaffold/schema/v1beta12/upgrade.go index 457d94e9a33..b7b38ee4ba2 100755 --- a/pkg/skaffold/schema/v1beta12/upgrade.go +++ b/pkg/skaffold/schema/v1beta12/upgrade.go @@ -27,10 +27,10 @@ import ( // 1. No Additions // 2. No removals // 3. No Updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) + pkgutil.CloneThroughJSON(c, &newConfig) newConfig.APIVersion = next.Version return &newConfig, nil diff --git a/pkg/skaffold/schema/v1beta13/upgrade.go b/pkg/skaffold/schema/v1beta13/upgrade.go index 2da4eee3abe..e054b674b48 100755 --- a/pkg/skaffold/schema/v1beta13/upgrade.go +++ b/pkg/skaffold/schema/v1beta13/upgrade.go @@ -31,11 +31,11 @@ import ( // jibGradle builder // jibMaven profile removed // 3. No updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) - if err := util.UpgradePipelines(config, &newConfig, upgradeOnePipeline); err != nil { + pkgutil.CloneThroughJSON(c, &newConfig) + if err := util.UpgradePipelines(c, &newConfig, upgradeOnePipeline); err != nil { return nil, err } newConfig.APIVersion = next.Version diff --git a/pkg/skaffold/schema/v1beta14/upgrade.go b/pkg/skaffold/schema/v1beta14/upgrade.go index 67aa8867627..d0d875ce7b4 100755 --- a/pkg/skaffold/schema/v1beta14/upgrade.go +++ b/pkg/skaffold/schema/v1beta14/upgrade.go @@ -28,11 +28,11 @@ import ( // buildArgs for Kustomize deployer // 2. Removals: // 3. No updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) - if err := util.UpgradePipelines(config, &newConfig, upgradeOnePipeline); err != nil { + pkgutil.CloneThroughJSON(c, &newConfig) + if err := util.UpgradePipelines(c, &newConfig, upgradeOnePipeline); err != nil { return nil, err } newConfig.APIVersion = next.Version diff --git a/pkg/skaffold/schema/v1beta2/upgrade.go b/pkg/skaffold/schema/v1beta2/upgrade.go index 3e5dd00c3cc..437960d4ecd 100644 --- a/pkg/skaffold/schema/v1beta2/upgrade.go +++ b/pkg/skaffold/schema/v1beta2/upgrade.go @@ -30,10 +30,10 @@ import ( // kaniko docker config // 2. No removals // 3. No updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) + pkgutil.CloneThroughJSON(c, &newConfig) newConfig.APIVersion = next.Version return &newConfig, nil diff --git a/pkg/skaffold/schema/v1beta3/upgrade.go b/pkg/skaffold/schema/v1beta3/upgrade.go index 0ce7c115423..5e468e3cb39 100644 --- a/pkg/skaffold/schema/v1beta3/upgrade.go +++ b/pkg/skaffold/schema/v1beta3/upgrade.go @@ -30,10 +30,10 @@ import ( // profile activation // 2. No removals // 3. No updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) + pkgutil.CloneThroughJSON(c, &newConfig) newConfig.APIVersion = next.Version return &newConfig, nil diff --git a/pkg/skaffold/schema/v1beta4/upgrade.go b/pkg/skaffold/schema/v1beta4/upgrade.go index f06da68f9ed..89ecc1fd8f9 100644 --- a/pkg/skaffold/schema/v1beta4/upgrade.go +++ b/pkg/skaffold/schema/v1beta4/upgrade.go @@ -31,10 +31,10 @@ import ( // jibGradle flags // 2. No removals // 3. No updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) + pkgutil.CloneThroughJSON(c, &newConfig) newConfig.APIVersion = next.Version return &newConfig, nil diff --git a/pkg/skaffold/schema/v1beta5/upgrade.go b/pkg/skaffold/schema/v1beta5/upgrade.go index 8e0d2fa77a3..1c3dd95be8d 100644 --- a/pkg/skaffold/schema/v1beta5/upgrade.go +++ b/pkg/skaffold/schema/v1beta5/upgrade.go @@ -28,10 +28,10 @@ import ( // helm deployFlags // 2. No removals // 3. No updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) + pkgutil.CloneThroughJSON(c, &newConfig) newConfig.APIVersion = next.Version return &newConfig, nil diff --git a/pkg/skaffold/schema/v1beta6/upgrade.go b/pkg/skaffold/schema/v1beta6/upgrade.go index 5430103edf1..09295f501bf 100644 --- a/pkg/skaffold/schema/v1beta6/upgrade.go +++ b/pkg/skaffold/schema/v1beta6/upgrade.go @@ -30,34 +30,34 @@ import ( // 2. No removals // 3. Updates: // kaniko becomes cluster -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { // convert Deploy (should be the same) var newDeploy next.DeployConfig - pkgutil.CloneThroughJSON(config.Deploy, &newDeploy) + pkgutil.CloneThroughJSON(c.Deploy, &newDeploy) // convert Profiles (should be the same) var newProfiles []next.Profile - if config.Profiles != nil { - pkgutil.CloneThroughJSON(config.Profiles, &newProfiles) + if c.Profiles != nil { + pkgutil.CloneThroughJSON(c.Profiles, &newProfiles) } // Update profile if kaniko build exists - for i, p := range config.Profiles { + for i, p := range c.Profiles { upgradeKanikoBuild(p.Build, &newProfiles[i].Build) } // convert Kaniko if needed var newBuild next.BuildConfig - pkgutil.CloneThroughJSON(config.Build, &newBuild) - upgradeKanikoBuild(config.Build, &newBuild) + pkgutil.CloneThroughJSON(c.Build, &newBuild) + upgradeKanikoBuild(c.Build, &newBuild) // convert Test (should be the same) var newTest []*next.TestCase - pkgutil.CloneThroughJSON(config.Test, &newTest) + pkgutil.CloneThroughJSON(c.Test, &newTest) return &next.SkaffoldConfig{ APIVersion: next.Version, - Kind: config.Kind, + Kind: c.Kind, Build: newBuild, Test: newTest, Deploy: newDeploy, diff --git a/pkg/skaffold/schema/v1beta7/upgrade.go b/pkg/skaffold/schema/v1beta7/upgrade.go index 930f1ecb731..cc8ecbe8602 100644 --- a/pkg/skaffold/schema/v1beta7/upgrade.go +++ b/pkg/skaffold/schema/v1beta7/upgrade.go @@ -28,10 +28,10 @@ import ( // kaniko/resource requirements // 2. No removals // 3. No updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) + pkgutil.CloneThroughJSON(c, &newConfig) newConfig.APIVersion = next.Version return &newConfig, nil diff --git a/pkg/skaffold/schema/v1beta8/upgrade.go b/pkg/skaffold/schema/v1beta8/upgrade.go index 4c30e646c3c..416a735b623 100644 --- a/pkg/skaffold/schema/v1beta8/upgrade.go +++ b/pkg/skaffold/schema/v1beta8/upgrade.go @@ -28,13 +28,13 @@ import ( // gitTagger/variant // 2. Removed all schemas associated with builder plugins // 3. No updates -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) + pkgutil.CloneThroughJSON(c, &newConfig) newConfig.APIVersion = next.Version - if err := util.UpgradePipelines(config, &newConfig, upgradeOnePipeline); err != nil { + if err := util.UpgradePipelines(c, &newConfig, upgradeOnePipeline); err != nil { return nil, err } diff --git a/pkg/skaffold/schema/v1beta9/upgrade.go b/pkg/skaffold/schema/v1beta9/upgrade.go index 525560c3dfc..3e08e98168b 100644 --- a/pkg/skaffold/schema/v1beta9/upgrade.go +++ b/pkg/skaffold/schema/v1beta9/upgrade.go @@ -43,13 +43,13 @@ var ( // 2. No removals // 3. Updates: // - sync map becomes a list of sync rules -func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { +func (c *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { var newConfig next.SkaffoldConfig - pkgutil.CloneThroughJSON(config, &newConfig) + pkgutil.CloneThroughJSON(c, &newConfig) newConfig.APIVersion = next.Version - if err := util.UpgradePipelines(config, &newConfig, upgradeOnePipeline); err != nil { + if err := util.UpgradePipelines(c, &newConfig, upgradeOnePipeline); err != nil { return nil, err } diff --git a/pkg/skaffold/sync/sync.go b/pkg/skaffold/sync/sync.go index d92475f4c86..3139420c1ce 100644 --- a/pkg/skaffold/sync/sync.go +++ b/pkg/skaffold/sync/sync.go @@ -194,19 +194,19 @@ func matchSyncRules(syncRules []*latest.SyncRule, relPath, containerWd string) ( return dsts, nil } -func (k *podSyncer) Sync(ctx context.Context, s *Item) error { - if len(s.Copy) > 0 { - logrus.Infoln("Copying files:", s.Copy, "to", s.Image) +func (s *podSyncer) Sync(ctx context.Context, item *Item) error { + if len(item.Copy) > 0 { + logrus.Infoln("Copying files:", item.Copy, "to", item.Image) - if err := Perform(ctx, s.Image, s.Copy, k.copyFileFn, k.namespaces); err != nil { + if err := Perform(ctx, item.Image, item.Copy, s.copyFileFn, s.namespaces); err != nil { return errors.Wrap(err, "copying files") } } - if len(s.Delete) > 0 { - logrus.Infoln("Deleting files:", s.Delete, "from", s.Image) + if len(item.Delete) > 0 { + logrus.Infoln("Deleting files:", item.Delete, "from", item.Image) - if err := Perform(ctx, s.Image, s.Delete, k.deleteFileFn, k.namespaces); err != nil { + if err := Perform(ctx, item.Image, item.Delete, s.deleteFileFn, s.namespaces); err != nil { return errors.Wrap(err, "deleting files") } }