From 482a360f9eefdb877f5db39b9bee1c33c6a51aab Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Fri, 13 Jun 2014 15:45:19 -0700 Subject: [PATCH] Make all error strings lower case, for readability. --- pkg/apiserver/api_server_test.go | 2 +- pkg/cloudcfg/resource_printer.go | 4 ++-- pkg/kubelet/kubelet.go | 2 +- pkg/kubelet/kubelet_test.go | 4 ++-- pkg/registry/controller_registry_test.go | 2 +- pkg/registry/endpoints_test.go | 2 +- pkg/registry/etcd_registry.go | 12 ++++++------ pkg/registry/fake_etcd_client.go | 2 +- pkg/registry/pod_registry.go | 2 +- pkg/registry/pod_registry_test.go | 2 +- pkg/registry/replication_controller.go | 2 +- pkg/registry/scheduler.go | 2 +- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/pkg/apiserver/api_server_test.go b/pkg/apiserver/api_server_test.go index 1e6a6f39fea..1b80d297f10 100644 --- a/pkg/apiserver/api_server_test.go +++ b/pkg/apiserver/api_server_test.go @@ -109,7 +109,7 @@ func TestSimpleList(t *testing.T) { func TestErrorList(t *testing.T) { storage := map[string]RESTStorage{} simpleStorage := SimpleRESTStorage{ - err: fmt.Errorf("Test Error"), + err: fmt.Errorf("test Error"), } storage["simple"] = &simpleStorage handler := New(storage, "/prefix/version") diff --git a/pkg/cloudcfg/resource_printer.go b/pkg/cloudcfg/resource_printer.go index fc111a034bd..30753d385ca 100644 --- a/pkg/cloudcfg/resource_printer.go +++ b/pkg/cloudcfg/resource_printer.go @@ -183,7 +183,7 @@ func (h *HumanReadablePrinter) extractObject(data, kind string) (interface{}, er } return list, nil default: - return nil, fmt.Errorf("Unknown kind: %s", kind) + return nil, fmt.Errorf("unknown kind: %s", kind) } } @@ -196,7 +196,7 @@ func (h *HumanReadablePrinter) Print(data string, output io.Writer) error { } if _, contains := obj.(map[string]interface{})["kind"]; !contains { - return fmt.Errorf("Unexpected object with no 'kind' field: %s", data) + return fmt.Errorf("unexpected object with no 'kind' field: %s", data) } kind := (obj.(map[string]interface{})["kind"]).(string) obj, err := h.extractObject(data, kind) diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 42202b28a40..9923f896335 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -504,7 +504,7 @@ func (kl *Kubelet) ExtractYAMLData(buf []byte, output interface{}) error { func (kl *Kubelet) extractFromEtcd(response *etcd.Response) ([]api.ContainerManifest, error) { var manifests []api.ContainerManifest if response.Node == nil || len(response.Node.Value) == 0 { - return manifests, fmt.Errorf("No nodes field: %#v", response) + return manifests, fmt.Errorf("no nodes field: %#v", response) } err := kl.ExtractYAMLData([]byte(response.Node.Value), &manifests) return manifests, err diff --git a/pkg/kubelet/kubelet_test.go b/pkg/kubelet/kubelet_test.go index fdc057606ed..06666c5ad5f 100644 --- a/pkg/kubelet/kubelet_test.go +++ b/pkg/kubelet/kubelet_test.go @@ -302,7 +302,7 @@ func TestListContainers(t *testing.T) { func TestKillContainerWithError(t *testing.T) { fakeDocker := FakeDockerClient{ - err: fmt.Errorf("Sample Error"), + err: fmt.Errorf("sample error"), containerList: []docker.APIContainers{ { Names: []string{"foo"}, @@ -585,7 +585,7 @@ func TestEventWritingError(t *testing.T) { kubelet := &Kubelet{ Client: fakeEtcd, } - fakeEtcd.Err = fmt.Errorf("Test error") + fakeEtcd.Err = fmt.Errorf("test error") err := kubelet.LogEvent(&api.Event{ Event: "test", Container: &api.Container{ diff --git a/pkg/registry/controller_registry_test.go b/pkg/registry/controller_registry_test.go index 638ef6b7d0d..b3d9d7ce5ec 100644 --- a/pkg/registry/controller_registry_test.go +++ b/pkg/registry/controller_registry_test.go @@ -51,7 +51,7 @@ func (registry *MockControllerRegistry) DeleteController(ID string) error { func TestListControllersError(t *testing.T) { mockRegistry := MockControllerRegistry{ - err: fmt.Errorf("Test Error"), + err: fmt.Errorf("test error"), } storage := ControllerRegistryStorage{ registry: &mockRegistry, diff --git a/pkg/registry/endpoints_test.go b/pkg/registry/endpoints_test.go index 9ed6d06d4a8..584e7d16576 100644 --- a/pkg/registry/endpoints_test.go +++ b/pkg/registry/endpoints_test.go @@ -33,7 +33,7 @@ func TestSyncEndpointsEmpty(t *testing.T) { func TestSyncEndpointsError(t *testing.T) { serviceRegistry := MockServiceRegistry{ - err: fmt.Errorf("Test Error"), + err: fmt.Errorf("test error"), } podRegistry := MockPodRegistry{} diff --git a/pkg/registry/etcd_registry.go b/pkg/registry/etcd_registry.go index 8a56b138ab0..b1c212c55d9 100644 --- a/pkg/registry/etcd_registry.go +++ b/pkg/registry/etcd_registry.go @@ -147,7 +147,7 @@ func (registry *EtcdRegistry) updateManifests(machine string, manifests []api.Co func (registry *EtcdRegistry) CreatePod(machineIn string, pod api.Pod) error { podOut, machine, err := registry.findPod(pod.ID) if err == nil { - return fmt.Errorf("A pod named %s already exists on %s (%#v)", pod.ID, machine, podOut) + return fmt.Errorf("a pod named %s already exists on %s (%#v)", pod.ID, machine, podOut) } return registry.runPod(pod, machineIn) } @@ -174,7 +174,7 @@ func (registry *EtcdRegistry) runPod(pod api.Pod, machine string) error { } func (registry *EtcdRegistry) UpdatePod(pod api.Pod) error { - return fmt.Errorf("Unimplemented!") + return fmt.Errorf("unimplemented!") } func (registry *EtcdRegistry) DeletePod(podID string) error { @@ -218,7 +218,7 @@ func (registry *EtcdRegistry) getPodForMachine(machine, podID string) (api.Pod, result, err := registry.etcdClient.Get(key, false, false) if err != nil { if isEtcdNotFound(err) { - return api.Pod{}, fmt.Errorf("Not found (%#v).", err) + return api.Pod{}, fmt.Errorf("not found (%#v).", err) } else { return api.Pod{}, err } @@ -239,7 +239,7 @@ func (registry *EtcdRegistry) findPod(podID string) (api.Pod, string, error) { return pod, machine, nil } } - return api.Pod{}, "", fmt.Errorf("Pod not found %s", podID) + return api.Pod{}, "", fmt.Errorf("pod not found %s", podID) } func isEtcdNotFound(err error) bool { @@ -284,7 +284,7 @@ func (registry *EtcdRegistry) GetController(controllerID string) (*api.Replicati result, err := registry.etcdClient.Get(key, false, false) if err != nil { if isEtcdNotFound(err) { - return nil, fmt.Errorf("Controller %s not found", controllerID) + return nil, fmt.Errorf("controller %s not found", controllerID) } else { return nil, err } @@ -354,7 +354,7 @@ func (registry *EtcdRegistry) GetService(name string) (*api.Service, error) { response, err := registry.etcdClient.Get(key, false, false) if err != nil { if isEtcdNotFound(err) { - return nil, fmt.Errorf("Service %s was not found.", name) + return nil, fmt.Errorf("service %s was not found.", name) } else { return nil, err } diff --git a/pkg/registry/fake_etcd_client.go b/pkg/registry/fake_etcd_client.go index 674d8d8db89..d5a54bda1bd 100644 --- a/pkg/registry/fake_etcd_client.go +++ b/pkg/registry/fake_etcd_client.go @@ -76,7 +76,7 @@ func (f *FakeEtcdClient) Delete(key string, recursive bool) (*etcd.Response, err } func (f *FakeEtcdClient) Watch(prefix string, waitIndex uint64, recursive bool, receiver chan *etcd.Response, stop chan bool) (*etcd.Response, error) { - return nil, fmt.Errorf("Unimplemented") + return nil, fmt.Errorf("unimplemented") } func MakeTestEtcdRegistry(client EtcdClient, machines []string) *EtcdRegistry { diff --git a/pkg/registry/pod_registry.go b/pkg/registry/pod_registry.go index 69cdc03caa8..95b150f99aa 100644 --- a/pkg/registry/pod_registry.go +++ b/pkg/registry/pod_registry.go @@ -122,7 +122,7 @@ func (storage *PodRegistryStorage) Extract(body string) (interface{}, error) { func (storage *PodRegistryStorage) Create(pod interface{}) error { podObj := pod.(api.Pod) if len(podObj.ID) == 0 { - return fmt.Errorf("ID is unspecified: %#v", pod) + return fmt.Errorf("id is unspecified: %#v", pod) } machine, err := storage.scheduler.Schedule(podObj) if err != nil { diff --git a/pkg/registry/pod_registry_test.go b/pkg/registry/pod_registry_test.go index d293051b945..217192e4fc9 100644 --- a/pkg/registry/pod_registry_test.go +++ b/pkg/registry/pod_registry_test.go @@ -56,7 +56,7 @@ func (registry *MockPodRegistry) DeletePod(podId string) error { func TestListPodsError(t *testing.T) { mockRegistry := MockPodRegistry{ - err: fmt.Errorf("Test Error"), + err: fmt.Errorf("test error"), } storage := PodRegistryStorage{ registry: &mockRegistry, diff --git a/pkg/registry/replication_controller.go b/pkg/registry/replication_controller.go index 709e44a4fe7..1428eb77593 100644 --- a/pkg/registry/replication_controller.go +++ b/pkg/registry/replication_controller.go @@ -112,7 +112,7 @@ func (rm *ReplicationManager) handleWatchResponse(response *etcd.Response) (*api } return &controllerSpec, nil } else { - return nil, fmt.Errorf("Response node is null %#v", response) + return nil, fmt.Errorf("response node is null %#v", response) } } return nil, nil diff --git a/pkg/registry/scheduler.go b/pkg/registry/scheduler.go index 925af7c135a..7d9a6f9db8a 100644 --- a/pkg/registry/scheduler.go +++ b/pkg/registry/scheduler.go @@ -115,7 +115,7 @@ func (s *FirstFitScheduler) Schedule(pod api.Pod) (string, error) { } } if len(machineOptions) == 0 { - return "", fmt.Errorf("Failed to find fit for %#v", pod) + return "", fmt.Errorf("failed to find fit for %#v", pod) } else { return machineOptions[s.random.Int()%len(machineOptions)], nil }