From 071249446ac5e1906d7b0fbf37273734843befc8 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Mon, 22 Jul 2019 20:55:46 +0200 Subject: [PATCH] Code format (#2519) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Declare all test cases the same way Signed-off-by: David Gageot * Remove empty lines Signed-off-by: David Gageot * Don’t use var Signed-off-by: David Gageot * Fix comments Signed-off-by: David Gageot --- cmd/skaffold/app/cmd/build_test.go | 6 +++--- cmd/skaffold/app/cmd/config/config_test.go | 4 ++-- cmd/skaffold/app/flags/build_output_test.go | 2 +- cmd/skaffold/app/flags/image_test.go | 4 ++-- cmd/skaffold/app/flags/template.go | 2 +- examples/microservices/leeroy-web/web.go | 1 - hack/schemas/testdata/inline-anyof/input.go | 6 +++--- hack/schemas/testdata/inline-hybrid/input.go | 12 ++++++------ integration/dev_test.go | 2 +- integration/examples/microservices/leeroy-web/web.go | 1 - integration/rpc_test.go | 2 +- integration/sync_test.go | 2 +- .../testdata/init/microservices/leeroy-web/web.go | 1 - .../testdata/kaniko-microservices/leeroy-web/web.go | 1 - pkg/skaffold/build/bazel/dependencies_test.go | 2 +- pkg/skaffold/build/cluster/cluster_test.go | 1 - pkg/skaffold/build/custom/dependencies.go | 2 -- pkg/skaffold/build/gcb/jib_test.go | 4 ++-- pkg/skaffold/build/local/bazel.go | 4 ++-- pkg/skaffold/build/local/jib_gradle_test.go | 4 ++-- pkg/skaffold/build/local/jib_maven_test.go | 6 +++--- pkg/skaffold/build/local/local_test.go | 2 +- pkg/skaffold/build/parallel_test.go | 10 +++++----- pkg/skaffold/build/sequence_test.go | 4 ++-- pkg/skaffold/build/tag/date_time_test.go | 2 +- pkg/skaffold/config/options_test.go | 2 +- pkg/skaffold/debug/transform_python.go | 2 +- pkg/skaffold/deploy/helm_test.go | 10 +++++----- pkg/skaffold/deploy/kubectl/version_test.go | 2 +- pkg/skaffold/deploy/kubectl_test.go | 4 ++-- pkg/skaffold/deploy/kustomize_test.go | 4 ++-- pkg/skaffold/deploy/labeller_test.go | 2 +- pkg/skaffold/deploy/status_check.go | 2 -- pkg/skaffold/deploy/status_check_test.go | 9 ++++----- pkg/skaffold/docker/auth_test.go | 2 +- pkg/skaffold/docker/client_test.go | 4 ++-- pkg/skaffold/docker/dependencies_test.go | 2 +- pkg/skaffold/docker/docker_init_test.go | 6 +++--- pkg/skaffold/docker/image_test.go | 6 +++--- pkg/skaffold/docker/reference_test.go | 2 +- pkg/skaffold/docker/syncmap_test.go | 2 +- pkg/skaffold/filemon/changes_test.go | 4 ++-- pkg/skaffold/filemon/monitor_test.go | 2 +- pkg/skaffold/gcp/auth_test.go | 2 +- pkg/skaffold/gcp/projectid_test.go | 2 +- pkg/skaffold/initializer/kubectl/kubectl.go | 2 +- pkg/skaffold/jib/jib_gradle_test.go | 6 +++--- pkg/skaffold/jib/jib_maven_test.go | 6 +++--- pkg/skaffold/jib/jib_non_windows_test.go | 2 +- pkg/skaffold/jib/jib_test.go | 2 +- pkg/skaffold/jib/jib_windows_test.go | 2 +- pkg/skaffold/kubernetes/colorpicker_test.go | 2 +- pkg/skaffold/kubernetes/log_test.go | 4 ++-- pkg/skaffold/kubernetes/portforward/entry_manager.go | 4 ++-- .../kubernetes/portforward/pod_forwarder_test.go | 2 +- .../portforward/port_forward_integration.go | 4 ++-- pkg/skaffold/kubernetes/wait_test.go | 2 -- pkg/skaffold/runner/build_deploy_test.go | 2 +- pkg/skaffold/runner/deploy_test.go | 3 +-- pkg/skaffold/runner/dev_test.go | 6 +++--- pkg/skaffold/runner/diagnose_test.go | 2 +- pkg/skaffold/runner/kind_test.go | 2 +- pkg/skaffold/runner/runner_test.go | 3 ++- pkg/skaffold/runner/util/util_test.go | 2 +- pkg/skaffold/schema/v1alpha1/upgrade.go | 2 +- pkg/skaffold/schema/versions_test.go | 2 +- pkg/skaffold/sync/sync_test.go | 6 +++--- pkg/skaffold/trigger/triggers_test.go | 2 +- pkg/skaffold/util/cmd_test.go | 2 +- pkg/skaffold/util/util_test.go | 8 ++++---- pkg/skaffold/util/wrapper_unix_test.go | 2 +- pkg/skaffold/util/wrapper_windows_test.go | 2 +- pkg/skaffold/version/version_test.go | 2 +- pkg/webhook/labels/labels_test.go | 2 +- webhook/webhook.go | 2 +- 75 files changed, 118 insertions(+), 130 deletions(-) diff --git a/cmd/skaffold/app/cmd/build_test.go b/cmd/skaffold/app/cmd/build_test.go index d216b6783b3..b895b7dcb50 100644 --- a/cmd/skaffold/app/cmd/build_test.go +++ b/cmd/skaffold/app/cmd/build_test.go @@ -53,7 +53,7 @@ func TestQuietFlag(t *testing.T) { return &mockRunner{}, &latest.SkaffoldConfig{}, nil } - var tests = []struct { + tests := []struct { description string template string expectedOutput []byte @@ -99,7 +99,7 @@ func TestFileOutputFlag(t *testing.T) { return &mockRunner{}, &latest.SkaffoldConfig{}, nil } - var tests = []struct { + tests := []struct { description string filename string quietFlag bool @@ -163,7 +163,7 @@ func TestRunBuild(t *testing.T) { return &mockRunner{}, &latest.SkaffoldConfig{}, nil } - var tests = []struct { + tests := []struct { description string mock func(opts *config.SkaffoldOptions) (runner.Runner, *latest.SkaffoldConfig, error) shouldErr bool diff --git a/cmd/skaffold/app/cmd/config/config_test.go b/cmd/skaffold/app/cmd/config/config_test.go index 37f6abc8f4b..1408b055e94 100644 --- a/cmd/skaffold/app/cmd/config/config_test.go +++ b/cmd/skaffold/app/cmd/config/config_test.go @@ -39,7 +39,7 @@ var baseConfig = &Config{ var emptyConfig = &Config{} func TestReadConfig(t *testing.T) { - var tests = []struct { + tests := []struct { description string filename string expectedCfg *Config @@ -77,7 +77,7 @@ func TestReadConfig(t *testing.T) { func TestSetAndUnsetConfig(t *testing.T) { dummyContext := "dummy_context" - var tests = []struct { + tests := []struct { expectedSetCfg *Config expectedUnsetCfg *Config description string diff --git a/cmd/skaffold/app/flags/build_output_test.go b/cmd/skaffold/app/flags/build_output_test.go index a156b76abaf..69005d7d947 100644 --- a/cmd/skaffold/app/flags/build_output_test.go +++ b/cmd/skaffold/app/flags/build_output_test.go @@ -32,7 +32,7 @@ func TestNewBuildOutputFlag(t *testing.T) { } func TestBuildOutputSet(t *testing.T) { - var tests = []struct { + tests := []struct { description string files map[string]string shouldErr bool diff --git a/cmd/skaffold/app/flags/image_test.go b/cmd/skaffold/app/flags/image_test.go index b2df2da820c..cc04ec251ea 100644 --- a/cmd/skaffold/app/flags/image_test.go +++ b/cmd/skaffold/app/flags/image_test.go @@ -32,7 +32,7 @@ func TestNewEmptyImage(t *testing.T) { } func TestImagesFlagSet(t *testing.T) { - var tests = []struct { + tests := []struct { description string setValue string shouldErr bool @@ -117,7 +117,7 @@ func TestImagesType(t *testing.T) { } func TestConvertToArtifact(t *testing.T) { - var tests = []struct { + tests := []struct { description string image string expected *build.Artifact diff --git a/cmd/skaffold/app/flags/template.go b/cmd/skaffold/app/flags/template.go index 8555de96692..74380782f53 100644 --- a/cmd/skaffold/app/flags/template.go +++ b/cmd/skaffold/app/flags/template.go @@ -74,7 +74,7 @@ func NewTemplateFlag(value string, context interface{}) *TemplateFlag { } func parseTemplate(value string) (*template.Template, error) { - var funcs = template.FuncMap{ + funcs := template.FuncMap{ "json": func(v interface{}) string { buf := &bytes.Buffer{} enc := json.NewEncoder(buf) diff --git a/examples/microservices/leeroy-web/web.go b/examples/microservices/leeroy-web/web.go index 419fd62e067..69f92785651 100644 --- a/examples/microservices/leeroy-web/web.go +++ b/examples/microservices/leeroy-web/web.go @@ -16,7 +16,6 @@ func handler(w http.ResponseWriter, r *http.Request) { if _, err := io.Copy(w, resp.Body); err != nil { panic(err) } - } func main() { diff --git a/hack/schemas/testdata/inline-anyof/input.go b/hack/schemas/testdata/inline-anyof/input.go index a2f05d25694..e13aa5240c8 100644 --- a/hack/schemas/testdata/inline-anyof/input.go +++ b/hack/schemas/testdata/inline-anyof/input.go @@ -23,12 +23,12 @@ type TestStruct struct { InlineOneOfStruct `yaml:"inline"` } -//InlineOneOfStruct is embedded inline into TestStruct +// InlineOneOfStruct is embedded inline into TestStruct type InlineOneOfStruct struct { - //Field1 should be the first choice + // Field1 should be the first choice Field1 string `yaml:"field1" yamltags:"oneOf=fooBar"` - //Field2 should be the second choice + // Field2 should be the second choice Field2 string `yaml:"field2" yamltags:"oneOf=fooBar"` } diff --git a/hack/schemas/testdata/inline-hybrid/input.go b/hack/schemas/testdata/inline-hybrid/input.go index 9afaea56dd0..13c49ff237c 100644 --- a/hack/schemas/testdata/inline-hybrid/input.go +++ b/hack/schemas/testdata/inline-hybrid/input.go @@ -24,22 +24,22 @@ type TestStruct struct { InlineOneOfStructAnyOf `yaml:"inline"` } -//InlineOneOfStruct is embedded inline into TestStruct +// InlineOneOfStruct is embedded inline into TestStruct type InlineOneOfStruct struct { - //Field1 should be the first choice + // Field1 should be the first choice Field1 string `yaml:"f1"` - //Field2 should be the second choice + // Field2 should be the second choice Field2 string `yaml:"f2"` } -//InlineOneOfStructAnyOf is embedded inline into TestStruct +// InlineOneOfStructAnyOf is embedded inline into TestStruct type InlineOneOfStructAnyOf struct { - //Choice1 should be the first choice + // Choice1 should be the first choice Choice1 string `yaml:"choice1" yamltags:"oneOf=fooBar"` - //Choice2 should be the second choice + // Choice2 should be the second choice Choice2 string `yaml:"choice2" yamltags:"oneOf=fooBar"` } diff --git a/integration/dev_test.go b/integration/dev_test.go index 3ce57adea0f..9d1d40bbf93 100644 --- a/integration/dev_test.go +++ b/integration/dev_test.go @@ -28,7 +28,7 @@ import ( ) func TestDev(t *testing.T) { - var tests = []struct { + tests := []struct { description string trigger string }{ diff --git a/integration/examples/microservices/leeroy-web/web.go b/integration/examples/microservices/leeroy-web/web.go index 419fd62e067..69f92785651 100644 --- a/integration/examples/microservices/leeroy-web/web.go +++ b/integration/examples/microservices/leeroy-web/web.go @@ -16,7 +16,6 @@ func handler(w http.ResponseWriter, r *http.Request) { if _, err := io.Copy(w, resp.Body); err != nil { panic(err) } - } func main() { diff --git a/integration/rpc_test.go b/integration/rpc_test.go index 55c4b4d0d50..e63f2017bc0 100644 --- a/integration/rpc_test.go +++ b/integration/rpc_test.go @@ -133,7 +133,7 @@ func TestEventLogRPC(t *testing.T) { } func TestEventLogHTTP(t *testing.T) { - var tests = []struct { + tests := []struct { description string endpoint string }{ diff --git a/integration/sync_test.go b/integration/sync_test.go index b0e31fd6011..c3ffbebd6ba 100644 --- a/integration/sync_test.go +++ b/integration/sync_test.go @@ -29,7 +29,7 @@ import ( ) func TestDevSync(t *testing.T) { - var tests = []struct { + tests := []struct { description string trigger string }{ diff --git a/integration/testdata/init/microservices/leeroy-web/web.go b/integration/testdata/init/microservices/leeroy-web/web.go index 419fd62e067..69f92785651 100644 --- a/integration/testdata/init/microservices/leeroy-web/web.go +++ b/integration/testdata/init/microservices/leeroy-web/web.go @@ -16,7 +16,6 @@ func handler(w http.ResponseWriter, r *http.Request) { if _, err := io.Copy(w, resp.Body); err != nil { panic(err) } - } func main() { diff --git a/integration/testdata/kaniko-microservices/leeroy-web/web.go b/integration/testdata/kaniko-microservices/leeroy-web/web.go index 419fd62e067..69f92785651 100644 --- a/integration/testdata/kaniko-microservices/leeroy-web/web.go +++ b/integration/testdata/kaniko-microservices/leeroy-web/web.go @@ -16,7 +16,6 @@ func handler(w http.ResponseWriter, r *http.Request) { if _, err := io.Copy(w, resp.Body); err != nil { panic(err) } - } func main() { diff --git a/pkg/skaffold/build/bazel/dependencies_test.go b/pkg/skaffold/build/bazel/dependencies_test.go index f91fd4bc208..79ad916f5f2 100644 --- a/pkg/skaffold/build/bazel/dependencies_test.go +++ b/pkg/skaffold/build/bazel/dependencies_test.go @@ -98,7 +98,7 @@ func TestQuery(t *testing.T) { } func TestDepToPath(t *testing.T) { - var tests = []struct { + tests := []struct { description string dep string expected string diff --git a/pkg/skaffold/build/cluster/cluster_test.go b/pkg/skaffold/build/cluster/cluster_test.go index 4d905b4bb47..0ca4e94e842 100644 --- a/pkg/skaffold/build/cluster/cluster_test.go +++ b/pkg/skaffold/build/cluster/cluster_test.go @@ -42,7 +42,6 @@ func TestRetrieveEnv(t *testing.T) { }, }, }) - if err != nil { t.Fatalf("err retrieving builder: %v", err) } diff --git a/pkg/skaffold/build/custom/dependencies.go b/pkg/skaffold/build/custom/dependencies.go index 0c39a82ac0a..8b292f51966 100644 --- a/pkg/skaffold/build/custom/dependencies.go +++ b/pkg/skaffold/build/custom/dependencies.go @@ -31,7 +31,6 @@ import ( // GetDependencies returns dependencies listed for a custom artifact func GetDependencies(ctx context.Context, workspace string, a *latest.CustomArtifact, insecureRegistries map[string]bool) ([]string, error) { - switch { case a.Dependencies.Dockerfile != nil: dockerfile := a.Dependencies.Dockerfile @@ -62,5 +61,4 @@ func GetDependencies(ctx context.Context, workspace string, a *latest.CustomArti sort.Strings(dependencies) return dependencies, nil } - } diff --git a/pkg/skaffold/build/gcb/jib_test.go b/pkg/skaffold/build/gcb/jib_test.go index 4a9b08deb6e..f81d06fcb86 100644 --- a/pkg/skaffold/build/gcb/jib_test.go +++ b/pkg/skaffold/build/gcb/jib_test.go @@ -25,7 +25,7 @@ import ( ) func TestJibMavenBuildSteps(t *testing.T) { - var tests = []struct { + tests := []struct { skipTests bool args []string }{ @@ -59,7 +59,7 @@ func TestJibMavenBuildSteps(t *testing.T) { } func TestJibGradleBuildSteps(t *testing.T) { - var tests = []struct { + tests := []struct { skipTests bool args []string }{ diff --git a/pkg/skaffold/build/local/bazel.go b/pkg/skaffold/build/local/bazel.go index 524ebef7d21..09c396d37d4 100644 --- a/pkg/skaffold/build/local/bazel.go +++ b/pkg/skaffold/build/local/bazel.go @@ -98,7 +98,7 @@ func bazelBin(ctx context.Context, workspace string, a *latest.BazelArtifact) (s } func trimTarget(buildTarget string) string { - //TODO(r2d4): strip off leading //:, bad + // TODO(r2d4): strip off leading //:, bad trimmedTarget := strings.TrimPrefix(buildTarget, "//") // Useful if root target "//:target" trimmedTarget = strings.TrimPrefix(trimmedTarget, ":") @@ -117,7 +117,7 @@ func buildImageTag(buildTarget string) string { imageTag := trimTarget(buildTarget) imageTag = strings.TrimPrefix(imageTag, ":") - //TODO(r2d4): strip off trailing .tar, even worse + // TODO(r2d4): strip off trailing .tar, even worse imageTag = strings.TrimSuffix(imageTag, ".tar") if strings.Contains(imageTag, ":") { diff --git a/pkg/skaffold/build/local/jib_gradle_test.go b/pkg/skaffold/build/local/jib_gradle_test.go index f359bb887ea..636aec87b68 100644 --- a/pkg/skaffold/build/local/jib_gradle_test.go +++ b/pkg/skaffold/build/local/jib_gradle_test.go @@ -29,7 +29,7 @@ import ( ) func TestBuildJibGradleToDocker(t *testing.T) { - var tests = []struct { + tests := []struct { description string artifact *latest.JibGradleArtifact cmd util.Command @@ -85,7 +85,7 @@ func TestBuildJibGradleToDocker(t *testing.T) { } func TestBuildJibGradleToRegistry(t *testing.T) { - var tests = []struct { + tests := []struct { description string artifact *latest.JibGradleArtifact cmd util.Command diff --git a/pkg/skaffold/build/local/jib_maven_test.go b/pkg/skaffold/build/local/jib_maven_test.go index 4781a6da5c6..ffad0dd36cf 100644 --- a/pkg/skaffold/build/local/jib_maven_test.go +++ b/pkg/skaffold/build/local/jib_maven_test.go @@ -29,7 +29,7 @@ import ( ) func TestBuildJibMavenToDocker(t *testing.T) { - var tests = []struct { + tests := []struct { description string artifact *latest.JibMavenArtifact cmd util.Command @@ -101,7 +101,7 @@ func TestBuildJibMavenToDocker(t *testing.T) { } func TestBuildJibMavenToRegistry(t *testing.T) { - var tests = []struct { + tests := []struct { description string artifact *latest.JibMavenArtifact cmd util.Command @@ -175,7 +175,7 @@ func TestBuildJibMavenToRegistry(t *testing.T) { } func TestMavenVerifyJibPackageGoal(t *testing.T) { - var tests = []struct { + tests := []struct { description string requiredGoal string mavenOutput string diff --git a/pkg/skaffold/build/local/local_test.go b/pkg/skaffold/build/local/local_test.go index ea3df624036..6c6c32017b8 100644 --- a/pkg/skaffold/build/local/local_test.go +++ b/pkg/skaffold/build/local/local_test.go @@ -45,7 +45,7 @@ func (t testAuthHelper) GetAuthConfig(string) (types.AuthConfig, error) { func (t testAuthHelper) GetAllAuthConfigs() (map[string]types.AuthConfig, error) { return nil, nil } func TestLocalRun(t *testing.T) { - var tests = []struct { + tests := []struct { description string api testutil.FakeAPIClient tags tag.ImageTags diff --git a/pkg/skaffold/build/parallel_test.go b/pkg/skaffold/build/parallel_test.go index e97d8ac37b5..be6feca30b1 100644 --- a/pkg/skaffold/build/parallel_test.go +++ b/pkg/skaffold/build/parallel_test.go @@ -32,7 +32,7 @@ import ( ) func TestGetBuild(t *testing.T) { - var tests = []struct { + tests := []struct { description string buildArtifact artifactBuilder tags tag.ImageTags @@ -85,7 +85,7 @@ func TestGetBuild(t *testing.T) { } func TestCollectResults(t *testing.T) { - var tests = []struct { + tests := []struct { description string artifacts []*latest.Artifact expected []Artifact @@ -194,7 +194,7 @@ func TestCollectResults(t *testing.T) { } func TestInParallel(t *testing.T) { - var tests = []struct { + tests := []struct { description string buildFunc artifactBuilder expected string @@ -243,7 +243,7 @@ And new lines } func TestInParallelForArgs(t *testing.T) { - var tests = []struct { + tests := []struct { description string inSeqFunc func(context.Context, io.Writer, tag.ImageTags, []*latest.Artifact, artifactBuilder) ([]Artifact, error) buildArtifact artifactBuilder @@ -296,7 +296,7 @@ func TestInParallelForArgs(t *testing.T) { } func TestColoredOutput(t *testing.T) { - var tests = []struct { + tests := []struct { description string isTerminal func(w io.Writer) bool exceptedColor bool diff --git a/pkg/skaffold/build/sequence_test.go b/pkg/skaffold/build/sequence_test.go index ceaf70bd09f..b793fed8ddd 100644 --- a/pkg/skaffold/build/sequence_test.go +++ b/pkg/skaffold/build/sequence_test.go @@ -31,7 +31,7 @@ import ( ) func TestInSequence(t *testing.T) { - var tests = []struct { + tests := []struct { description string buildArtifact artifactBuilder tags tag.ImageTags @@ -89,7 +89,7 @@ func TestInSequence(t *testing.T) { } func TestInSequenceResultsOrder(t *testing.T) { - var tests = []struct { + tests := []struct { description string images []string expected []Artifact diff --git a/pkg/skaffold/build/tag/date_time_test.go b/pkg/skaffold/build/tag/date_time_test.go index c7ae1841d65..1c644949bc8 100644 --- a/pkg/skaffold/build/tag/date_time_test.go +++ b/pkg/skaffold/build/tag/date_time_test.go @@ -27,7 +27,7 @@ func TestDateTime_GenerateFullyQualifiedImageName(t *testing.T) { aLocalTimeStamp := time.Date(2015, 03, 07, 11, 06, 39, 123456789, time.Local) localZone, _ := aLocalTimeStamp.Zone() - var tests = []struct { + tests := []struct { description string format string buildTime time.Time diff --git a/pkg/skaffold/config/options_test.go b/pkg/skaffold/config/options_test.go index 9a2625f543e..42dd4e36e4d 100644 --- a/pkg/skaffold/config/options_test.go +++ b/pkg/skaffold/config/options_test.go @@ -119,7 +119,7 @@ func TestLabels(t *testing.T) { } func TestIsTargetImage(t *testing.T) { - var tests = []struct { + tests := []struct { description string targetImages []string expectedMatch bool diff --git a/pkg/skaffold/debug/transform_python.go b/pkg/skaffold/debug/transform_python.go index 6e6c125b101..1febf5fecc4 100644 --- a/pkg/skaffold/debug/transform_python.go +++ b/pkg/skaffold/debug/transform_python.go @@ -135,7 +135,7 @@ func extractPtvsdArg(args []string) *ptvsdSpec { return nil } port, err := strconv.ParseInt(args[i+1], 10, 32) - //spec.port, err := strconv.Atoi(args[i+1]) + // spec.port, err := strconv.Atoi(args[i+1]) if err != nil { logrus.Errorf("Invalid python ptvsd port %q: %s\n", args[i+1], err) return nil diff --git a/pkg/skaffold/deploy/helm_test.go b/pkg/skaffold/deploy/helm_test.go index 96431477890..4536a984c5f 100644 --- a/pkg/skaffold/deploy/helm_test.go +++ b/pkg/skaffold/deploy/helm_test.go @@ -277,7 +277,7 @@ func TestMain(m *testing.M) { } func TestHelmDeploy(t *testing.T) { - var tests = []struct { + tests := []struct { description string cmd util.Command runContext *runcontext.RunContext @@ -536,7 +536,7 @@ func (m *MockHelm) RunCmd(c *exec.Cmd) error { } func TestParseHelmRelease(t *testing.T) { - var tests = []struct { + tests := []struct { description string yaml []byte shouldErr bool @@ -574,7 +574,7 @@ func TestExtractChartFilename(t *testing.T) { } func TestHelmDependencies(t *testing.T) { - var tests = []struct { + tests := []struct { description string files []string valuesFiles []string @@ -648,10 +648,10 @@ func TestHelmDependencies(t *testing.T) { func TestExpandPaths(t *testing.T) { homedir.DisableCache = true // for testing only - var tests = []struct { + tests := []struct { description string paths []string - unixExpanded []string //unix expands path with forward slashes, windows with backward slashes + unixExpanded []string // unix expands path with forward slashes, windows with backward slashes winExpanded []string env map[string]string }{ diff --git a/pkg/skaffold/deploy/kubectl/version_test.go b/pkg/skaffold/deploy/kubectl/version_test.go index 3720696431f..69aa24bf34c 100644 --- a/pkg/skaffold/deploy/kubectl/version_test.go +++ b/pkg/skaffold/deploy/kubectl/version_test.go @@ -27,7 +27,7 @@ import ( ) func TestCheckVersion(t *testing.T) { - var tests = []struct { + tests := []struct { description string command util.Command shouldErr bool diff --git a/pkg/skaffold/deploy/kubectl_test.go b/pkg/skaffold/deploy/kubectl_test.go index a2a06c1e250..0d1a933aee9 100644 --- a/pkg/skaffold/deploy/kubectl_test.go +++ b/pkg/skaffold/deploy/kubectl_test.go @@ -55,7 +55,7 @@ spec: image: leeroy-app` func TestKubectlDeploy(t *testing.T) { - var tests = []struct { + tests := []struct { description string cfg *latest.KubectlDeploy builds []build.Artifact @@ -203,7 +203,7 @@ func TestKubectlDeploy(t *testing.T) { } func TestKubectlCleanup(t *testing.T) { - var tests = []struct { + tests := []struct { description string cfg *latest.KubectlDeploy command util.Command diff --git a/pkg/skaffold/deploy/kustomize_test.go b/pkg/skaffold/deploy/kustomize_test.go index 12578fd99f4..0bd0e703fc3 100644 --- a/pkg/skaffold/deploy/kustomize_test.go +++ b/pkg/skaffold/deploy/kustomize_test.go @@ -31,7 +31,7 @@ import ( ) func TestKustomizeDeploy(t *testing.T) { - var tests = []struct { + tests := []struct { description string cfg *latest.KustomizeDeploy builds []build.Artifact @@ -96,7 +96,7 @@ func TestKustomizeCleanup(t *testing.T) { tmpDir, cleanup := testutil.NewTempDir(t) defer cleanup() - var tests = []struct { + tests := []struct { description string cfg *latest.KustomizeDeploy command util.Command diff --git a/pkg/skaffold/deploy/labeller_test.go b/pkg/skaffold/deploy/labeller_test.go index 9f1b4bb6a54..b24a2405d0d 100644 --- a/pkg/skaffold/deploy/labeller_test.go +++ b/pkg/skaffold/deploy/labeller_test.go @@ -23,7 +23,7 @@ import ( ) func TestDefaultLabeller(t *testing.T) { - var tests = []struct { + tests := []struct { description string version string expected string diff --git a/pkg/skaffold/deploy/status_check.go b/pkg/skaffold/deploy/status_check.go index 96b101e8490..77e6a512c89 100644 --- a/pkg/skaffold/deploy/status_check.go +++ b/pkg/skaffold/deploy/status_check.go @@ -45,7 +45,6 @@ var ( ) func StatusCheck(ctx context.Context, defaultLabeller *DefaultLabeller, runCtx *runcontext.RunContext) error { - client, err := kubernetesutil.GetClientset() if err != nil { return err @@ -78,7 +77,6 @@ func StatusCheck(ctx context.Context, defaultLabeller *DefaultLabeller, runCtx * } func getDeployments(client kubernetes.Interface, ns string, l *DefaultLabeller) (map[string]int32, error) { - deps, err := client.AppsV1().Deployments(ns).List(metav1.ListOptions{ LabelSelector: l.K8sManagedByLabelKeyValueString(), }) diff --git a/pkg/skaffold/deploy/status_check_test.go b/pkg/skaffold/deploy/status_check_test.go index 150c1706cdb..e0d194ab122 100644 --- a/pkg/skaffold/deploy/status_check_test.go +++ b/pkg/skaffold/deploy/status_check_test.go @@ -35,7 +35,7 @@ import ( func TestGetDeployments(t *testing.T) { labeller := NewLabeller("") - var tests = []struct { + tests := []struct { description string deps []*appsv1.Deployment deadline map[string]int32 @@ -196,8 +196,7 @@ func (m *MockRolloutStatus) Executefunc(context.Context, *kubectl.CLI, string) ( } func TestPollDeploymentRolloutStatus(t *testing.T) { - - var tests = []struct { + tests := []struct { description string mock *MockRolloutStatus duration int @@ -275,7 +274,7 @@ func TestPollDeploymentRolloutStatus(t *testing.T) { } func TestGetDeployStatus(t *testing.T) { - var tests = []struct { + tests := []struct { description string deps map[string]interface{} expectedErrMsg []string @@ -327,7 +326,7 @@ func TestGetDeployStatus(t *testing.T) { func TestGetRollOutStatus(t *testing.T) { rolloutCmd := "kubectl --context kubecontext --namespace test rollout status deployment dep --watch=false" - var tests = []struct { + tests := []struct { description string command util.Command expected string diff --git a/pkg/skaffold/docker/auth_test.go b/pkg/skaffold/docker/auth_test.go index 228f4195345..58d1637349b 100644 --- a/pkg/skaffold/docker/auth_test.go +++ b/pkg/skaffold/docker/auth_test.go @@ -49,7 +49,7 @@ func (t testAuthHelper) GetAllAuthConfigs() (map[string]types.AuthConfig, error) } func TestGetEncodedRegistryAuth(t *testing.T) { - var tests = []struct { + tests := []struct { description string image string authType AuthConfigHelper diff --git a/pkg/skaffold/docker/client_test.go b/pkg/skaffold/docker/client_test.go index 0dc1576c2e0..c8c8f2fd359 100644 --- a/pkg/skaffold/docker/client_test.go +++ b/pkg/skaffold/docker/client_test.go @@ -25,7 +25,7 @@ import ( ) func TestNewEnvClient(t *testing.T) { - var tests = []struct { + tests := []struct { description string envs map[string]string shouldErr bool @@ -57,7 +57,7 @@ func TestNewEnvClient(t *testing.T) { } func TestNewMinikubeImageAPIClient(t *testing.T) { - var tests = []struct { + tests := []struct { description string env string expected client.CommonAPIClient diff --git a/pkg/skaffold/docker/dependencies_test.go b/pkg/skaffold/docker/dependencies_test.go index 1346b72988f..3b38830f21d 100644 --- a/pkg/skaffold/docker/dependencies_test.go +++ b/pkg/skaffold/docker/dependencies_test.go @@ -223,7 +223,7 @@ func (f *fakeImageFetcher) fetch(image string, _ map[string]bool) (*v1.ConfigFil } func TestGetDependencies(t *testing.T) { - var tests = []struct { + tests := []struct { description string dockerfile string workspace string diff --git a/pkg/skaffold/docker/docker_init_test.go b/pkg/skaffold/docker/docker_init_test.go index fa6a4c6ccd1..72c755c62af 100644 --- a/pkg/skaffold/docker/docker_init_test.go +++ b/pkg/skaffold/docker/docker_init_test.go @@ -25,7 +25,7 @@ import ( ) func TestValidateDockerfile(t *testing.T) { - var tests = []struct { + tests := []struct { description string content string fileToValidate string @@ -68,7 +68,7 @@ func TestValidateDockerfile(t *testing.T) { } func TestDescribe(t *testing.T) { - var tests = []struct { + tests := []struct { description string dockerfile Docker expectedPrompt string @@ -87,7 +87,7 @@ func TestDescribe(t *testing.T) { } func TestCreateArtifact(t *testing.T) { - var tests = []struct { + tests := []struct { description string dockerfile Docker manifestImage string diff --git a/pkg/skaffold/docker/image_test.go b/pkg/skaffold/docker/image_test.go index 8869b7758df..a85c83a1998 100644 --- a/pkg/skaffold/docker/image_test.go +++ b/pkg/skaffold/docker/image_test.go @@ -34,7 +34,7 @@ import ( ) func TestPush(t *testing.T) { - var tests = []struct { + tests := []struct { description string imageName string api testutil.FakeAPIClient @@ -84,7 +84,7 @@ func TestPush(t *testing.T) { } func TestBuild(t *testing.T) { - var tests = []struct { + tests := []struct { description string env map[string]string api *testutil.FakeAPIClient @@ -190,7 +190,7 @@ func TestBuild(t *testing.T) { } func TestImageID(t *testing.T) { - var tests = []struct { + tests := []struct { description string ref string api testutil.FakeAPIClient diff --git a/pkg/skaffold/docker/reference_test.go b/pkg/skaffold/docker/reference_test.go index 88e2df1c7da..fc868f55c82 100644 --- a/pkg/skaffold/docker/reference_test.go +++ b/pkg/skaffold/docker/reference_test.go @@ -23,7 +23,7 @@ import ( ) func TestParseReference(t *testing.T) { - var tests = []struct { + tests := []struct { description string image string expectedName string diff --git a/pkg/skaffold/docker/syncmap_test.go b/pkg/skaffold/docker/syncmap_test.go index ed4b9e70a1d..dec2a2df3f9 100644 --- a/pkg/skaffold/docker/syncmap_test.go +++ b/pkg/skaffold/docker/syncmap_test.go @@ -74,7 +74,7 @@ COPY server.go . ` func TestSyncMap(t *testing.T) { - var tests = []struct { + tests := []struct { description string dockerfile string workspace string diff --git a/pkg/skaffold/filemon/changes_test.go b/pkg/skaffold/filemon/changes_test.go index aeccc78c76b..4442ed9e1a7 100644 --- a/pkg/skaffold/filemon/changes_test.go +++ b/pkg/skaffold/filemon/changes_test.go @@ -33,7 +33,7 @@ var ( ) func TestEvents(t *testing.T) { - var tests = []struct { + tests := []struct { description string prev, current FileMap expected Events @@ -112,7 +112,7 @@ func TestStat(t *testing.T) { } func TestStatNotExist(t *testing.T) { - var tests = []struct { + tests := []struct { description string deps []string depsErr error diff --git a/pkg/skaffold/filemon/monitor_test.go b/pkg/skaffold/filemon/monitor_test.go index fa5dc49d90d..009ec6e6811 100644 --- a/pkg/skaffold/filemon/monitor_test.go +++ b/pkg/skaffold/filemon/monitor_test.go @@ -24,7 +24,7 @@ import ( ) func TestFileMonitor(t *testing.T) { - var tests = []struct { + tests := []struct { description string makeChanges func(folder *testutil.TempDir) }{ diff --git a/pkg/skaffold/gcp/auth_test.go b/pkg/skaffold/gcp/auth_test.go index e601c799174..4b416d63193 100644 --- a/pkg/skaffold/gcp/auth_test.go +++ b/pkg/skaffold/gcp/auth_test.go @@ -26,7 +26,7 @@ import ( ) func TestAutoConfigureGCRCredentialHelper(t *testing.T) { - var tests = []struct { + tests := []struct { description string registry string helperInPath bool diff --git a/pkg/skaffold/gcp/projectid_test.go b/pkg/skaffold/gcp/projectid_test.go index 350ac1696c2..02e4f83828c 100644 --- a/pkg/skaffold/gcp/projectid_test.go +++ b/pkg/skaffold/gcp/projectid_test.go @@ -23,7 +23,7 @@ import ( ) func TestExtractProjectID(t *testing.T) { - var tests = []struct { + tests := []struct { description string imageName string expected string diff --git a/pkg/skaffold/initializer/kubectl/kubectl.go b/pkg/skaffold/initializer/kubectl/kubectl.go index 6006c38d0fc..9784cf2be00 100644 --- a/pkg/skaffold/initializer/kubectl/kubectl.go +++ b/pkg/skaffold/initializer/kubectl/kubectl.go @@ -39,7 +39,7 @@ type Kubectl struct { images []string } -//New returns a Kubectl skaffold generator. +// New returns a Kubectl skaffold generator. func New(potentialConfigs []string) (*Kubectl, error) { var k8sConfigs, images []string for _, file := range potentialConfigs { diff --git a/pkg/skaffold/jib/jib_gradle_test.go b/pkg/skaffold/jib/jib_gradle_test.go index d6d4cc98949..40e977c2303 100644 --- a/pkg/skaffold/jib/jib_gradle_test.go +++ b/pkg/skaffold/jib/jib_gradle_test.go @@ -47,7 +47,7 @@ func TestGetDependenciesGradle(t *testing.T) { ctx := context.Background() - var tests = []struct { + tests := []struct { description string stdout string modTime time.Time @@ -104,7 +104,7 @@ func TestGetDependenciesGradle(t *testing.T) { func TestGetCommandGradle(t *testing.T) { ctx := context.Background() - var tests = []struct { + tests := []struct { description string jibGradleArtifact latest.JibGradleArtifact filesInWorkspace []string @@ -159,7 +159,7 @@ func TestGetCommandGradle(t *testing.T) { } func TestGenerateGradleArgs(t *testing.T) { - var tests = []struct { + tests := []struct { in latest.JibGradleArtifact skipTests bool out []string diff --git a/pkg/skaffold/jib/jib_maven_test.go b/pkg/skaffold/jib/jib_maven_test.go index f3475bb29f2..d1aed98f176 100644 --- a/pkg/skaffold/jib/jib_maven_test.go +++ b/pkg/skaffold/jib/jib_maven_test.go @@ -47,7 +47,7 @@ func TestGetDependenciesMaven(t *testing.T) { ctx := context.Background() - var tests = []struct { + tests := []struct { description string stdout string modTime time.Time @@ -103,7 +103,7 @@ func TestGetDependenciesMaven(t *testing.T) { func TestGetCommandMaven(t *testing.T) { ctx := context.Background() - var tests = []struct { + tests := []struct { description string jibMavenArtifact latest.JibMavenArtifact filesInWorkspace []string @@ -184,7 +184,7 @@ func TestGetCommandMaven(t *testing.T) { } func TestGenerateMavenArgs(t *testing.T) { - var tests = []struct { + tests := []struct { in latest.JibMavenArtifact skipTests bool out []string diff --git a/pkg/skaffold/jib/jib_non_windows_test.go b/pkg/skaffold/jib/jib_non_windows_test.go index 19498522170..c412119e564 100644 --- a/pkg/skaffold/jib/jib_non_windows_test.go +++ b/pkg/skaffold/jib/jib_non_windows_test.go @@ -25,7 +25,7 @@ import ( ) func TestRelativize(t *testing.T) { - var tests = []struct { + tests := []struct { description string path string roots []string diff --git a/pkg/skaffold/jib/jib_test.go b/pkg/skaffold/jib/jib_test.go index 11121454e1e..232b51c7229 100644 --- a/pkg/skaffold/jib/jib_test.go +++ b/pkg/skaffold/jib/jib_test.go @@ -35,7 +35,7 @@ func TestGetDependencies(t *testing.T) { dep2 := tmpDir.Path("dep2") dep3 := tmpDir.Path("dep3") - var tests = []struct { + tests := []struct { stdout string expectedDeps []string shouldErr bool diff --git a/pkg/skaffold/jib/jib_windows_test.go b/pkg/skaffold/jib/jib_windows_test.go index d75e1648a37..4513dd1f2c5 100644 --- a/pkg/skaffold/jib/jib_windows_test.go +++ b/pkg/skaffold/jib/jib_windows_test.go @@ -25,7 +25,7 @@ import ( ) func TestRelativize(t *testing.T) { - var tests = []struct { + tests := []struct { description string path string roots []string diff --git a/pkg/skaffold/kubernetes/colorpicker_test.go b/pkg/skaffold/kubernetes/colorpicker_test.go index 99169925ea9..b423025f6fb 100644 --- a/pkg/skaffold/kubernetes/colorpicker_test.go +++ b/pkg/skaffold/kubernetes/colorpicker_test.go @@ -25,7 +25,7 @@ import ( ) func TestColorPicker(t *testing.T) { - var tests = []struct { + tests := []struct { description string pod *v1.Pod expectedColor color.Color diff --git a/pkg/skaffold/kubernetes/log_test.go b/pkg/skaffold/kubernetes/log_test.go index 8ecae0e6c12..206f317195f 100644 --- a/pkg/skaffold/kubernetes/log_test.go +++ b/pkg/skaffold/kubernetes/log_test.go @@ -25,7 +25,7 @@ import ( ) func TestSinceSeconds(t *testing.T) { - var tests = []struct { + tests := []struct { description string duration time.Duration expected int64 @@ -52,7 +52,7 @@ func TestSinceSeconds(t *testing.T) { } func TestSelect(t *testing.T) { - var tests = []struct { + tests := []struct { description string images []string podSpec v1.PodSpec diff --git a/pkg/skaffold/kubernetes/portforward/entry_manager.go b/pkg/skaffold/kubernetes/portforward/entry_manager.go index 8f432749e9e..3951ff2ce14 100644 --- a/pkg/skaffold/kubernetes/portforward/entry_manager.go +++ b/pkg/skaffold/kubernetes/portforward/entry_manager.go @@ -57,7 +57,7 @@ func (f forwardedPorts) Store(key, _ interface{}) { if !ok { panic("only store keys of type int in forwardedPorts") } - //this map is only used as a set of keys, we don't care about the values + // this map is only used as a set of keys, we don't care about the values f.ports[val] = dummy() } @@ -68,7 +68,7 @@ func (f forwardedPorts) LoadOrStore(key, _ interface{}) (interface{}, bool) { if !ok { return nil, false } - //this map is only used as a set of keys, we don't care about the values + // this map is only used as a set of keys, we don't care about the values _, exists := f.ports[k] return dummy(), exists } diff --git a/pkg/skaffold/kubernetes/portforward/pod_forwarder_test.go b/pkg/skaffold/kubernetes/portforward/pod_forwarder_test.go index 85b0f53eb5c..735ef214088 100644 --- a/pkg/skaffold/kubernetes/portforward/pod_forwarder_test.go +++ b/pkg/skaffold/kubernetes/portforward/pod_forwarder_test.go @@ -37,7 +37,7 @@ import ( ) func TestAutomaticPortForwardPod(t *testing.T) { - var tests = []struct { + tests := []struct { description string pods []*v1.Pod forwarder *testForwarder diff --git a/pkg/skaffold/kubernetes/portforward/port_forward_integration.go b/pkg/skaffold/kubernetes/portforward/port_forward_integration.go index 4c2260011c4..df900915ed4 100644 --- a/pkg/skaffold/kubernetes/portforward/port_forward_integration.go +++ b/pkg/skaffold/kubernetes/portforward/port_forward_integration.go @@ -29,8 +29,8 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" ) -//For WhiteBox testing only -//This is testing a port forward + stop + restart in a simulated dev cycle +// For WhiteBox testing only +// This is testing a port forward + stop + restart in a simulated dev cycle func WhiteBoxPortForwardCycle(namespace string, t *testing.T) { em := NewEntryManager(os.Stdout) portForwardEventHandler := portForwardEvent diff --git a/pkg/skaffold/kubernetes/wait_test.go b/pkg/skaffold/kubernetes/wait_test.go index 1dc3598f241..90a91243c85 100644 --- a/pkg/skaffold/kubernetes/wait_test.go +++ b/pkg/skaffold/kubernetes/wait_test.go @@ -78,11 +78,9 @@ func TestWaitForPodSucceeded(t *testing.T) { testutil.CheckError(t, test.shouldErr, err) }) } - } func TestIsPodSucceeded(t *testing.T) { - tests := []struct { description string podName string diff --git a/pkg/skaffold/runner/build_deploy_test.go b/pkg/skaffold/runner/build_deploy_test.go index cc43732a4c1..79383686a79 100644 --- a/pkg/skaffold/runner/build_deploy_test.go +++ b/pkg/skaffold/runner/build_deploy_test.go @@ -28,7 +28,7 @@ import ( ) func TestBuildTestDeploy(t *testing.T) { - var tests = []struct { + tests := []struct { description string testBench *TestBench shouldErr bool diff --git a/pkg/skaffold/runner/deploy_test.go b/pkg/skaffold/runner/deploy_test.go index 6b90b6bb717..9d289290c37 100644 --- a/pkg/skaffold/runner/deploy_test.go +++ b/pkg/skaffold/runner/deploy_test.go @@ -32,7 +32,7 @@ import ( func TestDeploy(t *testing.T) { expectedOutput := "Waiting for deployments to stabilize" - var tests = []struct { + tests := []struct { description string testBench *TestBench statusCheck bool @@ -63,7 +63,6 @@ func TestDeploy(t *testing.T) { originalStatusCheck := deploy.StatusCheck for _, test := range tests { testutil.Run(t, test.description, func(t *testutil.T) { - t.SetupFakeKubernetesContext(api.Config{CurrentContext: "cluster1"}) // Figure out why i can't use t.Override. // Using t.Override throws an error "reflect: call of reflect.Value.Elem on func Value" diff --git a/pkg/skaffold/runner/dev_test.go b/pkg/skaffold/runner/dev_test.go index d3f2f8eb1fe..6f0ec7fc4a3 100644 --- a/pkg/skaffold/runner/dev_test.go +++ b/pkg/skaffold/runner/dev_test.go @@ -84,7 +84,7 @@ func (t *TestMonitor) Run(bool) error { func (t *TestMonitor) Reset() {} func TestDevFailFirstCycle(t *testing.T) { - var tests = []struct { + tests := []struct { description string testBench *TestBench monitor filemon.Monitor @@ -142,7 +142,7 @@ func TestDevFailFirstCycle(t *testing.T) { } func TestDev(t *testing.T) { - var tests = []struct { + tests := []struct { description string testBench *TestBench watchEvents []filemon.Events @@ -276,7 +276,7 @@ func TestDev(t *testing.T) { } func TestDevSync(t *testing.T) { - var tests = []struct { + tests := []struct { description string testBench *TestBench watchEvents []filemon.Events diff --git a/pkg/skaffold/runner/diagnose_test.go b/pkg/skaffold/runner/diagnose_test.go index 8fe0f00bf9f..9d6681d7745 100644 --- a/pkg/skaffold/runner/diagnose_test.go +++ b/pkg/skaffold/runner/diagnose_test.go @@ -25,7 +25,7 @@ import ( ) func TestSizeOfDockerContext(t *testing.T) { - var tests = []struct { + tests := []struct { description string artifactName string DockerfileContents string diff --git a/pkg/skaffold/runner/kind_test.go b/pkg/skaffold/runner/kind_test.go index e2dcd8e19fc..55cea80221a 100644 --- a/pkg/skaffold/runner/kind_test.go +++ b/pkg/skaffold/runner/kind_test.go @@ -28,7 +28,7 @@ import ( ) func TestLoadImagesInKindNodes(t *testing.T) { - var tests = []struct { + tests := []struct { description string built []build.Artifact deployed []build.Artifact diff --git a/pkg/skaffold/runner/runner_test.go b/pkg/skaffold/runner/runner_test.go index 491830f8687..7874abb0813 100644 --- a/pkg/skaffold/runner/runner_test.go +++ b/pkg/skaffold/runner/runner_test.go @@ -91,6 +91,7 @@ func (t *TestBench) Prune(ctx context.Context, out io.Writer) error { return n func (t *TestBench) SyncMap(ctx context.Context, artifact *latest.Artifact) (map[string][]string, error) { return nil, nil } + func (t *TestBench) DependenciesForArtifact(ctx context.Context, artifact *latest.Artifact) ([]string, error) { return nil, nil } @@ -234,7 +235,7 @@ func createRunner(t *testutil.T, testBench *TestBench, monitor filemon.Monitor) } func TestNewForConfig(t *testing.T) { - var tests = []struct { + tests := []struct { description string config *latest.SkaffoldConfig shouldErr bool diff --git a/pkg/skaffold/runner/util/util_test.go b/pkg/skaffold/runner/util/util_test.go index 29a6c022de6..08b89075a9a 100644 --- a/pkg/skaffold/runner/util/util_test.go +++ b/pkg/skaffold/runner/util/util_test.go @@ -27,7 +27,7 @@ import ( ) func TestGetAllPodNamespaces(t *testing.T) { - var tests = []struct { + tests := []struct { description string argNamespace string currentContext string diff --git a/pkg/skaffold/schema/v1alpha1/upgrade.go b/pkg/skaffold/schema/v1alpha1/upgrade.go index e7445a6ac1b..f4d05a66bf2 100644 --- a/pkg/skaffold/schema/v1alpha1/upgrade.go +++ b/pkg/skaffold/schema/v1alpha1/upgrade.go @@ -98,7 +98,7 @@ func (config *SkaffoldConfig) Upgrade() (util.VersionedConfig, error) { newArtifacts = append(newArtifacts, newArtifact) } - var newBuildType = next.BuildType{} + newBuildType := next.BuildType{} if config.Build.GoogleCloudBuild != nil { newBuildType.GoogleCloudBuild = &next.GoogleCloudBuild{ ProjectID: config.Build.GoogleCloudBuild.ProjectID, diff --git a/pkg/skaffold/schema/versions_test.go b/pkg/skaffold/schema/versions_test.go index 41db674e1f5..2966a9f203c 100644 --- a/pkg/skaffold/schema/versions_test.go +++ b/pkg/skaffold/schema/versions_test.go @@ -104,7 +104,7 @@ build: ) func TestParseConfig(t *testing.T) { - var tests = []struct { + tests := []struct { apiVersion string description string config string diff --git a/pkg/skaffold/sync/sync_test.go b/pkg/skaffold/sync/sync_test.go index 3dda6aad647..9238326326b 100644 --- a/pkg/skaffold/sync/sync_test.go +++ b/pkg/skaffold/sync/sync_test.go @@ -36,7 +36,7 @@ import ( ) func TestNewSyncItem(t *testing.T) { - var tests = []struct { + tests := []struct { description string artifact *latest.Artifact evt filemon.Events @@ -398,7 +398,7 @@ func TestNewSyncItem(t *testing.T) { } func TestIntersect(t *testing.T) { - var tests = []struct { + tests := []struct { description string syncRules []*latest.SyncRule files []string @@ -532,7 +532,7 @@ var nonRunningPod = &v1.Pod{ } func TestPerform(t *testing.T) { - var tests = []struct { + tests := []struct { description string image string files syncMap diff --git a/pkg/skaffold/trigger/triggers_test.go b/pkg/skaffold/trigger/triggers_test.go index 9eb54119105..0ad3657f20b 100644 --- a/pkg/skaffold/trigger/triggers_test.go +++ b/pkg/skaffold/trigger/triggers_test.go @@ -27,7 +27,7 @@ import ( ) func TestNewTrigger(t *testing.T) { - var tests = []struct { + tests := []struct { description string opts *config.SkaffoldOptions expected Trigger diff --git a/pkg/skaffold/util/cmd_test.go b/pkg/skaffold/util/cmd_test.go index 49c49c77407..0d50d6931ce 100644 --- a/pkg/skaffold/util/cmd_test.go +++ b/pkg/skaffold/util/cmd_test.go @@ -37,7 +37,7 @@ func helperCommand(s ...string) *exec.Cmd { return helperCommandContext(s...) } -//adapted from https://npf.io/2015/06/testing-exec-command +// adapted from https://npf.io/2015/06/testing-exec-command func TestHelperProcess(*testing.T) { if os.Getenv("GO_WANT_HELPER_PROCESS") != "1" { return diff --git a/pkg/skaffold/util/util_test.go b/pkg/skaffold/util/util_test.go index 85b492addc4..f2d5f7767cf 100644 --- a/pkg/skaffold/util/util_test.go +++ b/pkg/skaffold/util/util_test.go @@ -25,7 +25,7 @@ import ( ) func TestSupportedKubernetesFormats(t *testing.T) { - var tests = []struct { + tests := []struct { description string in string out bool @@ -61,7 +61,7 @@ func TestSupportedKubernetesFormats(t *testing.T) { } func TestExpandPathsGlob(t *testing.T) { - var tests = []struct { + tests := []struct { description string in []string out []string @@ -102,7 +102,7 @@ func TestExpandPathsGlob(t *testing.T) { } func TestExpand(t *testing.T) { - var tests = []struct { + tests := []struct { description string text string key string @@ -180,7 +180,7 @@ func TestAbsFile(t *testing.T) { } func TestNonEmptyLines(t *testing.T) { - var tests = []struct { + tests := []struct { in string out []string }{ diff --git a/pkg/skaffold/util/wrapper_unix_test.go b/pkg/skaffold/util/wrapper_unix_test.go index 7d183f18970..e351ee923ec 100644 --- a/pkg/skaffold/util/wrapper_unix_test.go +++ b/pkg/skaffold/util/wrapper_unix_test.go @@ -27,7 +27,7 @@ import ( ) func TestGetCommand(t *testing.T) { - var tests = []struct { + tests := []struct { description string defaultExecutable string wrapperExecutable string diff --git a/pkg/skaffold/util/wrapper_windows_test.go b/pkg/skaffold/util/wrapper_windows_test.go index 650d02951c0..d6e8067c628 100644 --- a/pkg/skaffold/util/wrapper_windows_test.go +++ b/pkg/skaffold/util/wrapper_windows_test.go @@ -27,7 +27,7 @@ import ( ) func TestGetCommand(t *testing.T) { - var tests = []struct { + tests := []struct { description string defaultExecutable string wrapperExecutable string diff --git a/pkg/skaffold/version/version_test.go b/pkg/skaffold/version/version_test.go index f81d36d3c2c..7c07d7046ca 100644 --- a/pkg/skaffold/version/version_test.go +++ b/pkg/skaffold/version/version_test.go @@ -24,7 +24,7 @@ import ( ) func TestParseVersion(t *testing.T) { - var tests = []struct { + tests := []struct { description string in string out semver.Version diff --git a/pkg/webhook/labels/labels_test.go b/pkg/webhook/labels/labels_test.go index 9a25dac7e0c..af504240f86 100644 --- a/pkg/webhook/labels/labels_test.go +++ b/pkg/webhook/labels/labels_test.go @@ -50,7 +50,7 @@ func TestRetrieveLabel(t *testing.T) { } func TestDocsLabelExists(t *testing.T) { - var tests = []struct { + tests := []struct { description string labels []*github.Label expected bool diff --git a/webhook/webhook.go b/webhook/webhook.go index 7a8944537ba..e69d9546094 100644 --- a/webhook/webhook.go +++ b/webhook/webhook.go @@ -39,7 +39,7 @@ const ( ) func main() { - //Setup the serve route to receive github events + // Setup the serve route to receive github events http.HandleFunc("/receive", handleGithubEvent) flag.Parse() // Start the server