diff --git a/pkg/assets/handlers_test.go b/pkg/assets/handlers_test.go index b05d7019cf21..2a1233543806 100644 --- a/pkg/assets/handlers_test.go +++ b/pkg/assets/handlers_test.go @@ -109,7 +109,7 @@ func TestWithGzipReal(t *testing.T) { defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if string(body) != raw { - t.Fatalf(`did not find expected "%s" but got "%s" instead`, raw, resp) + t.Fatalf(`did not find expected "%s" but got "%s" instead`, raw, string(body)) } vary := resp.Header["Vary"] if !reflect.DeepEqual(vary, []string{"Accept-Encoding"}) { @@ -132,7 +132,7 @@ func TestWithGzipRealAndMultipleVaryHeaders(t *testing.T) { defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if string(body) != raw { - t.Fatalf(`did not find expected "%s" but got "%s" instead`, raw, resp) + t.Fatalf(`did not find expected "%s" but got "%s" instead`, raw, string(body)) } vary := resp.Header["Vary"] if !reflect.DeepEqual(vary, []string{"Accept-Encoding", "Foo"}) { diff --git a/pkg/auth/authenticator/request/headerrequest/requestheader_test.go b/pkg/auth/authenticator/request/headerrequest/requestheader_test.go index 03217f67ce66..5273ffe60ce5 100644 --- a/pkg/auth/authenticator/request/headerrequest/requestheader_test.go +++ b/pkg/auth/authenticator/request/headerrequest/requestheader_test.go @@ -73,7 +73,7 @@ func TestRequestHeader(t *testing.T) { } if testcase.ExpectedUsername != "" { if err != nil { - t.Errorf("%s: Expected user, got error: ", k, err) + t.Errorf("%s: Expected user, got error: %v", k, err) continue } if !ok { diff --git a/pkg/auth/authenticator/request/x509request/x509_test.go b/pkg/auth/authenticator/request/x509request/x509_test.go index c311894ca188..fb4c12457f5c 100644 --- a/pkg/auth/authenticator/request/x509request/x509_test.go +++ b/pkg/auth/authenticator/request/x509request/x509_test.go @@ -634,7 +634,7 @@ func TestX509Verifier(t *testing.T) { if testCase.ExpectOK { if !authCall { - t.Errorf("%s: Expected inner auth called, wasn't") + t.Errorf("%s: Expected inner auth called, wasn't", k) continue } if "innerauth" != user.GetName() { @@ -643,7 +643,7 @@ func TestX509Verifier(t *testing.T) { } } else { if authCall { - t.Errorf("%s: Expected inner auth not to be called, was") + t.Errorf("%s: Expected inner auth not to be called, was", k) continue } } diff --git a/pkg/auth/oauth/handlers/authenticator_test.go b/pkg/auth/oauth/handlers/authenticator_test.go index 90cd14ba6fd4..521972837912 100644 --- a/pkg/auth/oauth/handlers/authenticator_test.go +++ b/pkg/auth/oauth/handlers/authenticator_test.go @@ -37,7 +37,7 @@ func TestAuthenticator(t *testing.T) { t.Fatalf("%s: Unexpected error: %s", requestType, err) } if req.Authorized != testCase.ExpectedAuthorized { - t.Fatalf("%s: Expected Authorized=%b, got Authorized=%b", requestType, testCase.ExpectedAuthorized, req.Authorized) + t.Fatalf("%s: Expected Authorized=%t, got Authorized=%t", requestType, testCase.ExpectedAuthorized, req.Authorized) } } } diff --git a/pkg/auth/oauth/registry/registry_test.go b/pkg/auth/oauth/registry/registry_test.go index 42c2610802da..2e27bfa85a99 100644 --- a/pkg/auth/oauth/registry/registry_test.go +++ b/pkg/auth/oauth/registry/registry_test.go @@ -258,7 +258,7 @@ func TestAuthenticateTokenNotFound(t *testing.T) { t.Error("Expected not found error") } if userInfo != nil { - t.Error("Unexpected user: %v", userInfo) + t.Errorf("Unexpected user: %v", userInfo) } } func TestAuthenticateTokenOtherGetError(t *testing.T) { @@ -273,10 +273,10 @@ func TestAuthenticateTokenOtherGetError(t *testing.T) { t.Error("Expected error is missing!") } if err.Error() != tokenRegistry.Err.Error() { - t.Error("Expected error %v, but got error %v", tokenRegistry.Err, err) + t.Errorf("Expected error %v, but got error %v", tokenRegistry.Err, err) } if userInfo != nil { - t.Error("Unexpected user: %v", userInfo) + t.Errorf("Unexpected user: %v", userInfo) } } func TestAuthenticateTokenExpired(t *testing.T) { @@ -294,10 +294,10 @@ func TestAuthenticateTokenExpired(t *testing.T) { t.Error("Found token, but it should be missing!") } if err != ErrExpired { - t.Error("Unexpected error: %v", err) + t.Errorf("Unexpected error: %v", err) } if userInfo != nil { - t.Error("Unexpected user: %v", userInfo) + t.Errorf("Unexpected user: %v", userInfo) } } func TestAuthenticateTokenValidated(t *testing.T) { @@ -315,7 +315,7 @@ func TestAuthenticateTokenValidated(t *testing.T) { t.Error("Did not find a token!") } if err != nil { - t.Error("Unexpected error: %v", err) + t.Errorf("Unexpected error: %v", err) } if userInfo == nil { t.Error("Did not get a user!") diff --git a/pkg/auth/server/csrf/cookie_test.go b/pkg/auth/server/csrf/cookie_test.go index c48b00b6744a..8eedb025ae71 100644 --- a/pkg/auth/server/csrf/cookie_test.go +++ b/pkg/auth/server/csrf/cookie_test.go @@ -75,7 +75,7 @@ func TestCookieGenerate(t *testing.T) { setCookie := w.Header().Get("Set-Cookie") if testCase.ExpectSetCookie { if len(setCookie) == 0 { - t.Errorf("%s: Expected set-cookie header") + t.Errorf("%s: Expected set-cookie header", k) continue } diff --git a/pkg/auth/server/login/implicit_test.go b/pkg/auth/server/login/implicit_test.go index 61195e9ddbdb..78b36b2bcc59 100644 --- a/pkg/auth/server/login/implicit_test.go +++ b/pkg/auth/server/login/implicit_test.go @@ -48,7 +48,7 @@ func TestImplicit(t *testing.T) { ExpectThen string }{ "display confirm form": { - CSRF: &csrf.FakeCSRF{"test", nil}, + CSRF: &csrf.FakeCSRF{Token: "test", Err: nil}, Implicit: &testImplicit{Success: true, User: &user.DefaultInfo{Name: "user"}}, Path: "/login", ExpectContains: []string{ @@ -57,35 +57,35 @@ func TestImplicit(t *testing.T) { }, }, "successful POST redirects": { - CSRF: &csrf.FakeCSRF{"test", nil}, + CSRF: &csrf.FakeCSRF{Token: "test", Err: nil}, Implicit: &testImplicit{Success: true, User: &user.DefaultInfo{Name: "user"}}, Path: "/login?then=%2Ffoo", PostValues: url.Values{"csrf": []string{"test"}}, ExpectThen: "/foo", }, "redirect when POST fails CSRF": { - CSRF: &csrf.FakeCSRF{"test", nil}, + CSRF: &csrf.FakeCSRF{Token: "test", Err: nil}, Implicit: &testImplicit{Success: true, User: &user.DefaultInfo{Name: "user"}}, Path: "/login", PostValues: url.Values{"csrf": []string{"wrong"}}, ExpectRedirect: "/login?reason=token+expired", }, "redirect when not authenticated": { - CSRF: &csrf.FakeCSRF{"test", nil}, + CSRF: &csrf.FakeCSRF{Token: "test", Err: nil}, Implicit: &testImplicit{Success: false}, Path: "/login", PostValues: url.Values{"csrf": []string{"test"}}, ExpectRedirect: "/login?reason=access+denied", }, "redirect on auth failure": { - CSRF: &csrf.FakeCSRF{"test", nil}, + CSRF: &csrf.FakeCSRF{Token: "test", Err: nil}, Implicit: &testImplicit{Err: errors.New("failed")}, Path: "/login", PostValues: url.Values{"csrf": []string{"test"}}, ExpectRedirect: "/login?reason=access+denied", }, "expect GET error": { - CSRF: &csrf.FakeCSRF{"test", nil}, + CSRF: &csrf.FakeCSRF{Token: "test", Err: nil}, Implicit: &testImplicit{Err: errors.New("failed")}, ExpectContains: []string{`"message">An unknown error has occurred. Contact your administrator`}, }, diff --git a/pkg/authorization/registry/etcd/etcd.go b/pkg/authorization/registry/etcd/etcd.go index bb7693954d56..7c3b7d770ef7 100644 --- a/pkg/authorization/registry/etcd/etcd.go +++ b/pkg/authorization/registry/etcd/etcd.go @@ -81,7 +81,7 @@ func (r *Etcd) GetPolicy(ctx kapi.Context, name string) (policy *authorizationap } func (r *Etcd) ListPolicies(ctx kapi.Context, label labels.Selector, field fields.Selector) (*authorizationapi.PolicyList, error) { - result, err := r.policyRegistry.ListPredicate(ctx, &generic.SelectionPredicate{label, field, getAttrs}) + result, err := r.policyRegistry.ListPredicate(ctx, &generic.SelectionPredicate{Label: label, Field: field, GetAttrs: getAttrs}) if err != nil { return nil, err } @@ -107,7 +107,7 @@ func (r *Etcd) DeletePolicy(ctx kapi.Context, name string) error { } func (r *Etcd) WatchPolicies(ctx kapi.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return r.policyRegistry.WatchPredicate(ctx, &generic.SelectionPredicate{label, field, getAttrs}, resourceVersion) + return r.policyRegistry.WatchPredicate(ctx, &generic.SelectionPredicate{Label: label, Field: field, GetAttrs: getAttrs}, resourceVersion) } func makePolicyBindingListKey(ctx kapi.Context) string { @@ -132,7 +132,7 @@ func (r *Etcd) GetPolicyBinding(ctx kapi.Context, name string) (policyBinding *a } func (r *Etcd) ListPolicyBindings(ctx kapi.Context, label labels.Selector, field fields.Selector) (*authorizationapi.PolicyBindingList, error) { - result, err := r.policyBindingRegistry.ListPredicate(ctx, &generic.SelectionPredicate{label, field, getAttrs}) + result, err := r.policyBindingRegistry.ListPredicate(ctx, &generic.SelectionPredicate{Label: label, Field: field, GetAttrs: getAttrs}) if err != nil { return nil, err } @@ -158,5 +158,5 @@ func (r *Etcd) DeletePolicyBinding(ctx kapi.Context, name string) error { } func (r *Etcd) WatchPolicyBindings(ctx kapi.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) { - return r.policyBindingRegistry.WatchPredicate(ctx, &generic.SelectionPredicate{label, field, getAttrs}, resourceVersion) + return r.policyBindingRegistry.WatchPredicate(ctx, &generic.SelectionPredicate{Label: label, Field: field, GetAttrs: getAttrs}, resourceVersion) } diff --git a/pkg/authorization/registry/policy/rest_test.go b/pkg/authorization/registry/policy/rest_test.go index eaf2bc96a494..d7fc2bebd25f 100644 --- a/pkg/authorization/registry/policy/rest_test.go +++ b/pkg/authorization/registry/policy/rest_test.go @@ -145,6 +145,6 @@ func TestDeleteValid(t *testing.T) { } if policy, _ := registry.GetPolicy(ctx, authorizationapi.PolicyName); policy != nil { - t.Error("Unexpected policy found: %v", policy) + t.Errorf("Unexpected policy found: %v", policy) } } diff --git a/pkg/authorization/registry/policybinding/rest_test.go b/pkg/authorization/registry/policybinding/rest_test.go index ba42c875c075..82d1d235bd24 100644 --- a/pkg/authorization/registry/policybinding/rest_test.go +++ b/pkg/authorization/registry/policybinding/rest_test.go @@ -212,6 +212,6 @@ func TestDeleteValid(t *testing.T) { } if binding, _ := registry.GetPolicyBinding(ctx, "foo"); binding != nil { - t.Error("Unexpected binding found: %v", binding) + t.Errorf("Unexpected binding found: %v", binding) } } diff --git a/pkg/build/api/v1beta1/conversion_test.go b/pkg/build/api/v1beta1/conversion_test.go index 7cfb418a095b..f1b345f10329 100644 --- a/pkg/build/api/v1beta1/conversion_test.go +++ b/pkg/build/api/v1beta1/conversion_test.go @@ -78,7 +78,7 @@ func TestImageChangeTriggerFromRename(t *testing.T) { t.Fatalf("unexpected error: %v", err) } if actual.From.Name != "bar" { - t.Error("expected %#v, actual %#v", old, actual) + t.Errorf("expected %#v, actual %#v", old, actual) } old = current.ImageChangeTrigger{ @@ -91,7 +91,7 @@ func TestImageChangeTriggerFromRename(t *testing.T) { t.Fatalf("unexpected error: %v", err) } if actual.From.Name != "foo" { - t.Error("expected %#v, actual %#v", old, actual) + t.Errorf("expected %#v, actual %#v", old, actual) } old = current.ImageChangeTrigger{ diff --git a/pkg/build/api/validation/validation_test.go b/pkg/build/api/validation/validation_test.go index 570de62eccab..8e8062ee6ed5 100644 --- a/pkg/build/api/validation/validation_test.go +++ b/pkg/build/api/validation/validation_test.go @@ -379,7 +379,7 @@ func TestValidateTrigger(t *testing.T) { errors := validateTrigger(&test.trigger) if len(test.expected) == 0 { if len(errors) != 0 { - t.Errorf("%s: Got unexpected validation errors: %#v", errors) + t.Errorf("%s: Got unexpected validation errors: %#v", desc, errors) } continue } diff --git a/pkg/build/builder/cmd/dockercfg/cfg.go b/pkg/build/builder/cmd/dockercfg/cfg.go index 5f70a9a7147b..029e202b51a8 100644 --- a/pkg/build/builder/cmd/dockercfg/cfg.go +++ b/pkg/build/builder/cmd/dockercfg/cfg.go @@ -77,8 +77,8 @@ func getDockercfgFile(path string) string { // authEntry is a single entry for a given server in a // .dockercfg file type authEntry struct { - Auth string `json:auth` - Email string `json:email` + Auth string `json:"auth"` + Email string `json:"email"` } // dockercfg represents the contents of a .dockercfg file diff --git a/pkg/build/controller/controller.go b/pkg/build/controller/controller.go index 4be78b80f88d..f3705d20288f 100644 --- a/pkg/build/controller/controller.go +++ b/pkg/build/controller/controller.go @@ -122,7 +122,7 @@ func (bc *BuildController) nextBuildStatus(build *buildapi.Build) error { glog.V(4).Infof("Build pod already existed: %#v", podSpec) return nil } - return fmt.Errorf("failed to create pod for build %s/%s: s", build.Namespace, build.Name, err) + return fmt.Errorf("failed to create pod for build %s/%s: %v", build.Namespace, build.Name, err) } glog.V(4).Infof("Created pod for build: %#v", podSpec) diff --git a/pkg/build/controller/controller_test.go b/pkg/build/controller/controller_test.go index b69a2b2b92a9..7323a66d09af 100644 --- a/pkg/build/controller/controller_test.go +++ b/pkg/build/controller/controller_test.go @@ -327,7 +327,7 @@ func TestHandleBuild(t *testing.T) { } if err != nil { - t.Errorf("(%d) Unexpected error %v", err) + t.Errorf("(%d) Unexpected error %v", i, err) } if build.Status != tc.outStatus { t.Errorf("(%d) Expected %s, got %s!", i, tc.outStatus, build.Status) diff --git a/pkg/build/controller/strategy/custom.go b/pkg/build/controller/strategy/custom.go index f9495818a60a..3501a3fdc4f7 100644 --- a/pkg/build/controller/strategy/custom.go +++ b/pkg/build/controller/strategy/custom.go @@ -41,7 +41,7 @@ func (bs *CustomBuildStrategy) CreateBuildPod(build *buildapi.Build) (*kapi.Pod, if strategy.ExposeDockerSocket { glog.V(2).Infof("ExposeDockerSocket is enabled for %s build", build.PodName) - containerEnv = append(containerEnv, kapi.EnvVar{"DOCKER_SOCKET", dockerSocketPath}) + containerEnv = append(containerEnv, kapi.EnvVar{Name: "DOCKER_SOCKET", Value: dockerSocketPath}) } pod := &kapi.Pod{ diff --git a/pkg/build/controller/strategy/util.go b/pkg/build/controller/strategy/util.go index 8ab8b0f9e575..2338c1eeb561 100644 --- a/pkg/build/controller/strategy/util.go +++ b/pkg/build/controller/strategy/util.go @@ -71,8 +71,8 @@ func setupBuildEnv(build *buildapi.Build, pod *kapi.Pod) error { switch build.Parameters.Source.Type { case buildapi.BuildSourceGit: - vars = append(vars, kapi.EnvVar{"SOURCE_URI", build.Parameters.Source.Git.URI}) - vars = append(vars, kapi.EnvVar{"SOURCE_REF", build.Parameters.Source.Git.Ref}) + vars = append(vars, kapi.EnvVar{Name: "SOURCE_URI", Value: build.Parameters.Source.Git.URI}) + vars = append(vars, kapi.EnvVar{Name: "SOURCE_REF", Value: build.Parameters.Source.Git.Ref}) default: // Do nothing for unknown source types } @@ -81,9 +81,9 @@ func setupBuildEnv(build *buildapi.Build, pod *kapi.Pod) error { if err != nil { return err } - vars = append(vars, kapi.EnvVar{"OUTPUT_REGISTRY", ref.Registry}) + vars = append(vars, kapi.EnvVar{Name: "OUTPUT_REGISTRY", Value: ref.Registry}) ref.Registry = "" - vars = append(vars, kapi.EnvVar{"OUTPUT_IMAGE", ref.String()}) + vars = append(vars, kapi.EnvVar{Name: "OUTPUT_IMAGE", Value: ref.String()}) if len(pod.Spec.Containers) > 0 { pod.Spec.Containers[0].Env = append(pod.Spec.Containers[0].Env, vars...) diff --git a/pkg/build/webhook/generic/generic_test.go b/pkg/build/webhook/generic/generic_test.go index e6644559da42..100a25d4b2c4 100644 --- a/pkg/build/webhook/generic/generic_test.go +++ b/pkg/build/webhook/generic/generic_test.go @@ -32,7 +32,7 @@ func TestVerifyRequestForMethod(t *testing.T) { req := GivenRequest("GET") err := verifyRequest(req) if err == nil || !strings.Contains(err.Error(), "method") { - t.Errorf("Expected anything but POST to be an invalid method %s") + t.Errorf("Expected anything but POST to be an invalid method %v", err) } } @@ -40,19 +40,19 @@ func TestVerifyRequestForUserAgent(t *testing.T) { req := GivenRequest("POST") err := verifyRequest(req) if err == nil || !strings.Contains(err.Error(), "User-Agent") { - t.Errorf("Exp. User-Agent to be required %s", err) + t.Errorf("Exp. User-Agent to be required %v", err) } req.Header.Add("User-Agent", "") err = verifyRequest(req) if err == nil || !strings.Contains(err.Error(), "User-Agent") { - t.Errorf("Exp. User-Agent to not empty %s", err) + t.Errorf("Exp. User-Agent to not empty %v", err) } req.Header.Set("User-Agent", "foobar") err = verifyRequest(req) if err != nil && strings.Contains(err.Error(), "User-Agent") { - t.Errorf("Exp. non-empty User-Agent to be valid %s", err) + t.Errorf("Exp. non-empty User-Agent to be valid %v", err) } } @@ -70,19 +70,19 @@ func TestVerifyRequestForContentType(t *testing.T) { req.Header.Add("Content-Length", "1") err = verifyRequest(req) if err == nil || !strings.Contains(err.Error(), "Content-Type") { - t.Errorf("Exp. ContentType to be required if a payload is posted %s", err) + t.Errorf("Exp. ContentType to be required if a payload is posted %v", err) } req.Header.Add("Content-Type", "X-Whatever") err = verifyRequest(req) if err == nil || !strings.Contains(err.Error(), "Unsupported Content-Type") { - t.Errorf("Exp. to only support json payloads %s", err) + t.Errorf("Exp. to only support json payloads %v", err) } req.Header.Set("Content-Type", "application/json") err = verifyRequest(req) if err != nil && !strings.Contains(err.Error(), "Unsupported Content-Type") { - t.Errorf("Exp. to allow json payloads %s", err) + t.Errorf("Exp. to allow json payloads %v", err) } } @@ -112,7 +112,7 @@ func TestExtractWithEmptyPayload(t *testing.T) { plugin := New() revision, proceed, err := plugin.Extract(buildConfig, "secret100", "", req) if err != nil { - t.Errorf("Expected to be able to trigger a build without a payload error: %s", err) + t.Errorf("Expected to be able to trigger a build without a payload error: %v", err) } if !proceed { t.Error("Expected 'proceed' return value to be 'true'") @@ -147,7 +147,7 @@ func TestExtractWithUnmatchedRefGitPayload(t *testing.T) { build, proceed, err := plugin.Extract(buildConfig, "secret100", "", req) if err != nil { - t.Errorf("Unexpected error when triggering build: %s", err) + t.Errorf("Unexpected error when triggering build: %v", err) } if proceed { t.Error("Expected 'proceed' return value to be 'false' for unmatched refs") @@ -183,7 +183,7 @@ func TestExtractWithGitPayload(t *testing.T) { revision, proceed, err := plugin.Extract(buildConfig, "secret100", "", req) if err != nil { - t.Errorf("Expected to be able to trigger a build without a payload error: %s", err) + t.Errorf("Expected to be able to trigger a build without a payload error: %v", err) } if !proceed { t.Error("Expected 'proceed' return value to be 'true'") @@ -217,7 +217,7 @@ func TestExtractWithUnmarshalError(t *testing.T) { plugin := New() revision, proceed, err := plugin.Extract(buildConfig, "secret100", "", req) if err != nil { - t.Errorf("Expected to be able to trigger a build without a payload error: %s", err) + t.Errorf("Expected to be able to trigger a build without a payload error: %v", err) } if !proceed { t.Error("Expected 'proceed' return value to be 'true'") diff --git a/pkg/build/webhook/github/github_test.go b/pkg/build/webhook/github/github_test.go index 11d7c8d72951..b77fcde0360d 100644 --- a/pkg/build/webhook/github/github_test.go +++ b/pkg/build/webhook/github/github_test.go @@ -236,7 +236,7 @@ func TestExtractForAPingEvent(t *testing.T) { t.Errorf("Error while extracting build info: %s", err) } if proceed { - t.Errorf("The 'proceed' return value should equal 'false' %s", proceed) + t.Errorf("The 'proceed' return value should equal 'false' %t", proceed) } } @@ -252,7 +252,7 @@ func TestExtractProvidesValidBuildForAPushEvent(t *testing.T) { t.Errorf("Error while extracting build info: %s", err) } if !proceed { - t.Errorf("The 'proceed' return value should equal 'true' %s", proceed) + t.Errorf("The 'proceed' return value should equal 'true' %t", proceed) } if revision == nil { t.Error("Expecting the revision to not be nil") @@ -276,7 +276,7 @@ func TestExtractProvidesValidBuildForAPushEventOtherThanMaster(t *testing.T) { t.Errorf("Error while extracting build info: %s", err) } if !proceed { - t.Errorf("The 'proceed' return value should equal 'true' %s", proceed) + t.Errorf("The 'proceed' return value should equal 'true' %t", proceed) } if revision == nil { t.Error("Expecting the revision to not be nil") diff --git a/pkg/cmd/experimental/router/router.go b/pkg/cmd/experimental/router/router.go index 7ef381021754..f9d84fe0f8a6 100644 --- a/pkg/cmd/experimental/router/router.go +++ b/pkg/cmd/experimental/router/router.go @@ -148,7 +148,7 @@ func NewCmdRouter(f *clientcmd.Factory, parentName, name string, out io.Writer) glog.Fatalf("You must specify a .kubeconfig file path containing credentials for connecting the router to the master with --credentials") } - clientConfigLoadingRules := &kclientcmd.ClientConfigLoadingRules{cfg.Credentials, []string{}} + clientConfigLoadingRules := &kclientcmd.ClientConfigLoadingRules{ExplicitPath: cfg.Credentials, Precedence: []string{}} credentials, err := clientConfigLoadingRules.Load() if err != nil { glog.Fatalf("The provided credentials %q could not be loaded: %v", cfg.Credentials, err) diff --git a/pkg/cmd/infra/router/router.go b/pkg/cmd/infra/router/router.go index 580a0bfc53a5..babdc64c47b2 100644 --- a/pkg/cmd/infra/router/router.go +++ b/pkg/cmd/infra/router/router.go @@ -85,7 +85,7 @@ func start(cfg *clientcmd.Config, plugin router.Plugin) error { proc.StartReaper() - factory := controllerfactory.RouterControllerFactory{kubeClient, osClient} + factory := controllerfactory.RouterControllerFactory{KClient: kubeClient, OSClient: osClient} controller := factory.Create(plugin) controller.Run() diff --git a/pkg/cmd/util/variable/imagetemplate.go b/pkg/cmd/util/variable/imagetemplate.go index 99ca9ac90eba..cc988ec07bfa 100644 --- a/pkg/cmd/util/variable/imagetemplate.go +++ b/pkg/cmd/util/variable/imagetemplate.go @@ -34,7 +34,7 @@ func NewDefaultImageTemplate() ImageTemplate { func (t *ImageTemplate) ExpandOrDie(component string) string { value, err := t.Expand(component) if err != nil { - glog.Fatalf("Unable to find an image for %q due to an error processing the format: %v", err) + glog.Fatalf("Unable to find an image for %q due to an error processing the format: %v", component, err) } return value } diff --git a/pkg/controller/controller_test.go b/pkg/controller/controller_test.go index a4d5817d6bab..4f4e7a237dc2 100644 --- a/pkg/controller/controller_test.go +++ b/pkg/controller/controller_test.go @@ -132,7 +132,7 @@ func TestRetryController_realFifoEventOrdering(t *testing.T) { RetryManager: NewQueueRetryManager(fifo, keyFunc, func(_ interface{}, _ error, _ int) bool { return true }), Handle: func(obj interface{}) error { if e, a := 1, obj.(testObj).value; e != a { - t.Fatalf("expected to handle test value %d, got %d") + t.Fatalf("expected to handle test value %d, got %d", e, a) } go func() { diff --git a/pkg/deploy/api/types.go b/pkg/deploy/api/types.go index b20e65fb76b1..fdcf1e4de3f2 100644 --- a/pkg/deploy/api/types.go +++ b/pkg/deploy/api/types.go @@ -226,11 +226,11 @@ type DeploymentConfigRollbackSpec struct { // From points to a ReplicationController which is a deployment. From kapi.ObjectReference `json:"from"` // IncludeTriggers specifies whether to include config Triggers. - IncludeTriggers bool `json:"includeTriggers` + IncludeTriggers bool `json:"includeTriggers"` // IncludeTemplate specifies whether to include the PodTemplateSpec. - IncludeTemplate bool `json:"includeTemplate` + IncludeTemplate bool `json:"includeTemplate"` // IncludeReplicationMeta specifies whether to include the replica count and selector. - IncludeReplicationMeta bool `json:"includeReplicationMeta` + IncludeReplicationMeta bool `json:"includeReplicationMeta"` // IncludeStrategy specifies whether to include the deployment Strategy. - IncludeStrategy bool `json:"includeStrategy` + IncludeStrategy bool `json:"includeStrategy"` } diff --git a/pkg/deploy/api/v1beta1/types.go b/pkg/deploy/api/v1beta1/types.go index 253144297d2c..a34db03a03db 100644 --- a/pkg/deploy/api/v1beta1/types.go +++ b/pkg/deploy/api/v1beta1/types.go @@ -227,11 +227,11 @@ type DeploymentConfigRollbackSpec struct { // From points to a ReplicationController which is a deployment. From kapi.ObjectReference `json:"from"` // IncludeTriggers specifies whether to include config Triggers. - IncludeTriggers bool `json:"includeTriggers` + IncludeTriggers bool `json:"includeTriggers"` // IncludeTemplate specifies whether to include the PodTemplateSpec. - IncludeTemplate bool `json:"includeTemplate` + IncludeTemplate bool `json:"includeTemplate"` // IncludeReplicationMeta specifies whether to include the replica count and selector. - IncludeReplicationMeta bool `json:"includeReplicationMeta` + IncludeReplicationMeta bool `json:"includeReplicationMeta"` // IncludeStrategy specifies whether to include the deployment Strategy. - IncludeStrategy bool `json:"includeStrategy` + IncludeStrategy bool `json:"includeStrategy"` } diff --git a/pkg/deploy/api/validation/validation_test.go b/pkg/deploy/api/validation/validation_test.go index ebbfa3b1cd6d..c5a090cc356b 100644 --- a/pkg/deploy/api/validation/validation_test.go +++ b/pkg/deploy/api/validation/validation_test.go @@ -260,7 +260,7 @@ func TestValidateDeploymentConfigRollbackOK(t *testing.T) { } if e, a := "ReplicationController", rollback.Spec.From.Kind; e != a { - t.Errorf("expected kind %s, got %s") + t.Errorf("expected kind %s, got %s", e, a) } } diff --git a/pkg/deploy/controller/configchange/controller.go b/pkg/deploy/controller/configchange/controller.go index c5a447783440..aa3d6689b3b6 100644 --- a/pkg/deploy/controller/configchange/controller.go +++ b/pkg/deploy/controller/configchange/controller.go @@ -48,7 +48,7 @@ func (c *DeploymentConfigChangeController) Handle(config *deployapi.DeploymentCo _, _, err := c.generateDeployment(config) if err != nil { if kerrors.IsConflict(err) { - return fatalError(fmt.Sprintf("config %s updated since retrieval; aborting trigger", labelFor(config), err)) + return fatalError(fmt.Sprintf("config %s updated since retrieval; aborting trigger: %v", labelFor(config), err)) } return fmt.Errorf("couldn't create initial deployment for config %s: %v", labelFor(config), err) } diff --git a/pkg/deploy/registry/deploy/rest_test.go b/pkg/deploy/registry/deploy/rest_test.go index fa74381d57cb..26d807e624ff 100644 --- a/pkg/deploy/registry/deploy/rest_test.go +++ b/pkg/deploy/registry/deploy/rest_test.go @@ -164,7 +164,7 @@ func TestGetDeploymentOk(t *testing.T) { t.Error("Unexpected nil deployment") } if err != nil { - t.Errorf("Unexpected non-nil error", err) + t.Errorf("Unexpected non-nil error: %v", err) } if deployment.(*api.Deployment).Name != "foo" { t.Errorf("Unexpected deployment: %#v", deployment) diff --git a/pkg/deploy/registry/deployconfig/rest_test.go b/pkg/deploy/registry/deployconfig/rest_test.go index 215ee7ac39fd..109f36f1b7ae 100644 --- a/pkg/deploy/registry/deployconfig/rest_test.go +++ b/pkg/deploy/registry/deployconfig/rest_test.go @@ -168,7 +168,7 @@ func TestGetDeploymentConfigOK(t *testing.T) { t.Error("Unexpected nil deploymentConfig") } if err != nil { - t.Errorf("Unexpected non-nil error", err) + t.Errorf("Unexpected non-nil error: %v", err) } if deploymentConfig.(*api.DeploymentConfig).Name != "foo" { t.Errorf("Unexpected deploymentConfig: %#v", deploymentConfig) diff --git a/pkg/deploy/registry/etcd/etcd_test.go b/pkg/deploy/registry/etcd/etcd_test.go index 54955aaf68c1..9a4fcc4b7d54 100644 --- a/pkg/deploy/registry/etcd/etcd_test.go +++ b/pkg/deploy/registry/etcd/etcd_test.go @@ -276,7 +276,7 @@ func TestEtcdUpdateOkDeployments(t *testing.T) { registry := NewTestEtcd(fakeClient) err := registry.UpdateDeployment(kapi.NewDefaultContext(), &api.Deployment{ObjectMeta: kapi.ObjectMeta{Name: "foo"}}) if err != nil { - t.Error("Unexpected error: %#v", err) + t.Errorf("Unexpected error: %#v", err) } } @@ -507,7 +507,7 @@ func TestEtcdUpdateOkDeploymentConfig(t *testing.T) { registry := NewTestEtcd(fakeClient) err := registry.UpdateDeploymentConfig(kapi.NewDefaultContext(), &api.DeploymentConfig{ObjectMeta: kapi.ObjectMeta{Name: "foo"}}) if err != nil { - t.Error("Unexpected error %#v", err) + t.Errorf("Unexpected error %#v", err) } } diff --git a/pkg/generate/app/app.go b/pkg/generate/app/app.go index 72a43aacdcea..17a766fe14c2 100644 --- a/pkg/generate/app/app.go +++ b/pkg/generate/app/app.go @@ -467,7 +467,7 @@ func LabelsFromSpec(spec []string) (map[string]string, []string, error) { } else if strings.HasSuffix(labelSpec, "-") { remove = append(remove, labelSpec[:len(labelSpec)-1]) } else { - return nil, nil, fmt.Errorf("unknown label spec: %v") + return nil, nil, fmt.Errorf("unknown label spec: %s", labelSpec) } } for _, removeLabel := range remove { diff --git a/pkg/image/controller/controller_test.go b/pkg/image/controller/controller_test.go index 47029c823813..2dd0f52988df 100644 --- a/pkg/image/controller/controller_test.go +++ b/pkg/image/controller/controller_test.go @@ -101,7 +101,7 @@ func TestControllerRepoHandled(t *testing.T) { t.Errorf("did not set annotation: %#v", repo) } if len(fake.Actions) != 1 { - t.Error("expected an update action: %#v", fake.Actions) + t.Errorf("expected an update action: %#v", fake.Actions) } } @@ -142,7 +142,7 @@ func TestControllerRepoTagsAlreadySet(t *testing.T) { t.Errorf("did not set annotation: %#v", repo) } if len(fake.Actions) != 1 { - t.Error("expected an update action: %#v", fake.Actions) + t.Errorf("expected an update action: %#v", fake.Actions) } } @@ -160,7 +160,7 @@ func TestControllerImageNotFoundError(t *testing.T) { t.Errorf("did not set annotation: %#v", repo) } if len(fake.Actions) != 1 { - t.Error("expected an update action: %#v", fake.Actions) + t.Errorf("expected an update action: %#v", fake.Actions) } } @@ -186,7 +186,7 @@ func TestControllerImageWithGenericError(t *testing.T) { t.Errorf("did not expect annotation: %#v", repo) } if len(fake.Actions) != 0 { - t.Error("expected no update action: %#v", fake.Actions) + t.Errorf("expected no update action: %#v", fake.Actions) } } @@ -215,7 +215,7 @@ func TestControllerWithImage(t *testing.T) { t.Fatalf("did not set annotation: %#v", repo) } if len(fake.Actions) != 2 { - t.Error("expected an update action: %#v", fake.Actions) + t.Errorf("expected an update action: %#v", fake.Actions) } } @@ -247,7 +247,7 @@ func TestControllerWithEmptyTag(t *testing.T) { t.Fatalf("did not set annotation: %#v", repo) } if len(fake.Actions) != 2 { - t.Error("expected an update action: %#v", fake.Actions) + t.Errorf("expected an update action: %#v", fake.Actions) } } diff --git a/pkg/oauth/registry/accesstoken/rest_test.go b/pkg/oauth/registry/accesstoken/rest_test.go index 55a6e2eaccce..a4d49e3a4259 100644 --- a/pkg/oauth/registry/accesstoken/rest_test.go +++ b/pkg/oauth/registry/accesstoken/rest_test.go @@ -228,6 +228,6 @@ func TestDeleteValid(t *testing.T) { } if registry.DeletedAccessTokenName != "foo" { - t.Error("Unexpected access token deleted: %s", registry.DeletedAccessTokenName) + t.Errorf("Unexpected access token deleted: %s", registry.DeletedAccessTokenName) } } diff --git a/pkg/oauth/registry/authorizetoken/rest_test.go b/pkg/oauth/registry/authorizetoken/rest_test.go index 9fa4d8f5ca40..fcc35ab55ce6 100644 --- a/pkg/oauth/registry/authorizetoken/rest_test.go +++ b/pkg/oauth/registry/authorizetoken/rest_test.go @@ -228,6 +228,6 @@ func TestDeleteValid(t *testing.T) { } if registry.DeletedAuthorizeTokenName != "foo" { - t.Error("Unexpected access token deleted: %s", registry.DeletedAuthorizeTokenName) + t.Errorf("Unexpected access token deleted: %s", registry.DeletedAuthorizeTokenName) } } diff --git a/pkg/oauth/registry/client/rest_test.go b/pkg/oauth/registry/client/rest_test.go index a3598d1a6193..fbd3f96bc33a 100644 --- a/pkg/oauth/registry/client/rest_test.go +++ b/pkg/oauth/registry/client/rest_test.go @@ -219,6 +219,6 @@ func TestDeleteValid(t *testing.T) { } if registry.DeletedClientName != "foo" { - t.Error("Unexpected client deleted: %s", registry.DeletedClientName) + t.Errorf("Unexpected client deleted: %s", registry.DeletedClientName) } } diff --git a/pkg/project/registry/project/rest_test.go b/pkg/project/registry/project/rest_test.go index 267b7bdec7a5..7d0792b42b6c 100644 --- a/pkg/project/registry/project/rest_test.go +++ b/pkg/project/registry/project/rest_test.go @@ -135,7 +135,7 @@ func TestGetProjectOK(t *testing.T) { t.Error("Unexpected nil project") } if err != nil { - t.Errorf("Unexpected non-nil error", err) + t.Errorf("Unexpected non-nil error: %v", err) } if project.(*api.Project).Name != "foo" { t.Errorf("Unexpected project: %#v", project) diff --git a/pkg/route/registry/route/rest_test.go b/pkg/route/registry/route/rest_test.go index af9e4c36eb68..4cf7f7cd72ab 100644 --- a/pkg/route/registry/route/rest_test.go +++ b/pkg/route/registry/route/rest_test.go @@ -151,7 +151,7 @@ func TestGetRouteOK(t *testing.T) { t.Error("Unexpected nil route") } if err != nil { - t.Errorf("Unexpected non-nil error", err) + t.Errorf("Unexpected non-nil error: %v", err) } if route.(*api.Route).Name != "foo" { t.Errorf("Unexpected route: %#v", route)