Skip to content

Commit

Permalink
gofmt -s pkg/ cmd/
Browse files Browse the repository at this point in the history
  • Loading branch information
proppy committed Jun 12, 2014
1 parent c0f41e2 commit 4f6bed0
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 69 deletions.
6 changes: 3 additions & 3 deletions cmd/localkube/localkube.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"flag"
"fmt"
"log"
"math/rand"
"math/rand"
"net/http"
"os"
"time"
Expand Down Expand Up @@ -91,8 +91,8 @@ func api_server() {
Client: http.DefaultClient,
Port: *kubelet_port,
}
random := rand.New(rand.NewSource(int64(time.Now().Nanosecond())))
random := rand.New(rand.NewSource(int64(time.Now().Nanosecond())))

storage := map[string]apiserver.RESTStorage{
"pods": registry.MakePodRegistryStorage(podRegistry, containerInfo, registry.MakeFirstFitScheduler(machineList, podRegistry, random)),
"replicationControllers": registry.MakeControllerRegistryStorage(controllerRegistry),
Expand Down
2 changes: 1 addition & 1 deletion pkg/apiserver/api_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func TestNonEmptyList(t *testing.T) {
storage := map[string]RESTStorage{}
simpleStorage := SimpleRESTStorage{
list: []Simple{
Simple{
{
Name: "foo",
},
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestListEmptyPods(t *testing.T) {
func TestListPods(t *testing.T) {
expectedPodList := api.PodList{
Items: []api.Pod{
api.Pod{
{
CurrentState: api.PodState{
Status: "Foobar",
},
Expand Down Expand Up @@ -97,7 +97,7 @@ func TestListPods(t *testing.T) {
func TestListPodsLabels(t *testing.T) {
expectedPodList := api.PodList{
Items: []api.Pod{
api.Pod{
{
CurrentState: api.PodState{
Status: "Foobar",
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/cloudcfg/cloudcfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func RunController(image, name string, replicas int, client client.ClientInterfa
DesiredState: api.PodState{
Manifest: api.ContainerManifest{
Containers: []api.Container{
api.Container{
{
Image: image,
Ports: makePorts(portSpec),
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/cloudcfg/cloudcfg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ func TestUpdateWithPods(t *testing.T) {
client := FakeKubeClient{
pods: PodList{
Items: []Pod{
Pod{JSONBase: JSONBase{ID: "pod-1"}},
Pod{JSONBase: JSONBase{ID: "pod-2"}},
{JSONBase: JSONBase{ID: "pod-1"}},
{JSONBase: JSONBase{ID: "pod-2"}},
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cloudcfg/resource_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (h *HumanReadablePrinter) printHeader(columnNames []string, w io.Writer) er
return err
}
var lines []string
for _, _ = range columnNames {
for _ = range columnNames {
lines = append(lines, "----------")
}
_, err := fmt.Fprintf(w, "%s\n", strings.Join(lines, "\t"))
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (kl *Kubelet) RunContainer(manifest *api.ContainerManifest, container *api.
dockerPort := docker.Port(strconv.Itoa(interiorPort) + "/tcp")
exposedPorts[dockerPort] = struct{}{}
portBindings[dockerPort] = []docker.PortBinding{
docker.PortBinding{
{
HostPort: strconv.Itoa(exteriorPort),
},
}
Expand Down
40 changes: 20 additions & 20 deletions pkg/kubelet/kubelet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ func TestContainerExists(t *testing.T) {
Name: "foo",
}
fakeDocker.containerList = []docker.APIContainers{
docker.APIContainers{
{
Names: []string{"foo--qux--1234"},
},
docker.APIContainers{
{
Names: []string{"bar--qux--1234"},
},
}
Expand All @@ -201,11 +201,11 @@ func TestGetContainerID(t *testing.T) {
DockerClient: &fakeDocker,
}
fakeDocker.containerList = []docker.APIContainers{
docker.APIContainers{
{
Names: []string{"foo"},
ID: "1234",
},
docker.APIContainers{
{
Names: []string{"bar"},
ID: "4567",
},
Expand Down Expand Up @@ -236,10 +236,10 @@ func TestGetContainerByName(t *testing.T) {
DockerClient: &fakeDocker,
}
fakeDocker.containerList = []docker.APIContainers{
docker.APIContainers{
{
Names: []string{"foo"},
},
docker.APIContainers{
{
Names: []string{"bar"},
},
}
Expand All @@ -264,10 +264,10 @@ func TestListContainers(t *testing.T) {
DockerClient: &fakeDocker,
}
fakeDocker.containerList = []docker.APIContainers{
docker.APIContainers{
{
Names: []string{"foo"},
},
docker.APIContainers{
{
Names: []string{"bar"},
},
}
Expand All @@ -282,10 +282,10 @@ func TestKillContainerWithError(t *testing.T) {
fakeDocker := FakeDockerClient{
err: fmt.Errorf("Sample Error"),
containerList: []docker.APIContainers{
docker.APIContainers{
{
Names: []string{"foo"},
},
docker.APIContainers{
{
Names: []string{"bar"},
},
},
Expand All @@ -306,10 +306,10 @@ func TestKillContainer(t *testing.T) {
DockerClient: &fakeDocker,
}
fakeDocker.containerList = []docker.APIContainers{
docker.APIContainers{
{
Names: []string{"foo"},
},
docker.APIContainers{
{
Names: []string{"bar"},
},
}
Expand All @@ -325,11 +325,11 @@ func TestKillContainer(t *testing.T) {
func TestSyncHTTP(t *testing.T) {
containers := api.ContainerManifest{
Containers: []api.Container{
api.Container{
{
Name: "foo",
Image: "dockerfile/foo",
},
api.Container{
{
Name: "bar",
Image: "dockerfile/bar",
},
Expand Down Expand Up @@ -374,8 +374,8 @@ func TestResponseToManifests(t *testing.T) {
list, err := kubelet.ResponseToManifests(&etcd.Response{
Node: &etcd.Node{
Value: util.MakeJSONString([]api.ContainerManifest{
api.ContainerManifest{Id: "foo"},
api.ContainerManifest{Id: "bar"},
{Id: "foo"},
{Id: "bar"},
}),
},
})
Expand Down Expand Up @@ -508,7 +508,7 @@ func TestSyncManifestsDoesNothing(t *testing.T) {
err: nil,
}
fakeDocker.containerList = []docker.APIContainers{
docker.APIContainers{
{
// format is <container-id>--<manifest-id>
Names: []string{"bar--foo"},
ID: "1234",
Expand All @@ -521,10 +521,10 @@ func TestSyncManifestsDoesNothing(t *testing.T) {
DockerClient: &fakeDocker,
}
err := kubelet.SyncManifests([]api.ContainerManifest{
api.ContainerManifest{
{
Id: "foo",
Containers: []api.Container{
api.Container{Name: "bar"},
{Name: "bar"},
},
},
})
Expand All @@ -543,7 +543,7 @@ func TestSyncManifestsDeletes(t *testing.T) {
err: nil,
}
fakeDocker.containerList = []docker.APIContainers{
docker.APIContainers{
{
Names: []string{"foo"},
ID: "1234",
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/proxy/config/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (impl ConfigSourceEtcd) ProcessChange(response *etcd.Response) {
parts := strings.Split(response.Node.Key[1:], "/")
if len(parts) == 4 {
log.Printf("Deleting service: %s", parts[3])
serviceUpdate := ServiceUpdate{Op: REMOVE, Services: []api.Service{api.Service{JSONBase: api.JSONBase{ID: parts[3]}}}}
serviceUpdate := ServiceUpdate{Op: REMOVE, Services: []api.Service{{JSONBase: api.JSONBase{ID: parts[3]}}}}
impl.serviceChannel <- serviceUpdate
return
} else {
Expand Down
8 changes: 4 additions & 4 deletions pkg/registry/controller_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ func TestListEmptyControllerList(t *testing.T) {
func TestListControllerList(t *testing.T) {
mockRegistry := MockControllerRegistry{
controllers: []ReplicationController{
ReplicationController{
{
JSONBase: JSONBase{
ID: "foo",
},
},
ReplicationController{
{
JSONBase: JSONBase{
ID: "bar",
},
Expand Down Expand Up @@ -145,10 +145,10 @@ func TestControllerParsing(t *testing.T) {
DesiredState: PodState{
Manifest: ContainerManifest{
Containers: []Container{
Container{
{
Image: "dockerfile/nginx",
Ports: []Port{
Port{
{
ContainerPort: 80,
HostPort: 8080,
},
Expand Down
10 changes: 5 additions & 5 deletions pkg/registry/endpoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestSyncEndpointsItems(t *testing.T) {
serviceRegistry := MockServiceRegistry{
list: ServiceList{
Items: []Service{
Service{
{
Labels: map[string]string{
"foo": "bar",
},
Expand All @@ -58,13 +58,13 @@ func TestSyncEndpointsItems(t *testing.T) {
}
podRegistry := MockPodRegistry{
pods: []Pod{
Pod{
{
DesiredState: PodState{
Manifest: ContainerManifest{
Containers: []Container{
Container{
{
Ports: []Port{
Port{
{
HostPort: 8080,
},
},
Expand All @@ -88,7 +88,7 @@ func TestSyncEndpointsPodError(t *testing.T) {
serviceRegistry := MockServiceRegistry{
list: ServiceList{
Items: []Service{
Service{
{
Labels: map[string]string{
"foo": "bar",
},
Expand Down
26 changes: 13 additions & 13 deletions pkg/registry/etcd_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestEtcdCreatePod(t *testing.T) {
DesiredState: PodState{
Manifest: ContainerManifest{
Containers: []Container{
Container{
{
Name: "foo",
},
},
Expand Down Expand Up @@ -171,7 +171,7 @@ func TestEtcdCreatePodWithContainersNotFound(t *testing.T) {
Manifest: ContainerManifest{
Id: "foo",
Containers: []Container{
Container{
{
Name: "foo",
},
},
Expand Down Expand Up @@ -205,7 +205,7 @@ func TestEtcdCreatePodWithExistingContainers(t *testing.T) {
E: &etcd.EtcdError{ErrorCode: 100},
}
fakeClient.Set("/registry/hosts/machine/kubelet", util.MakeJSONString([]ContainerManifest{
ContainerManifest{
{
Id: "bar",
},
}), 0)
Expand All @@ -218,7 +218,7 @@ func TestEtcdCreatePodWithExistingContainers(t *testing.T) {
Manifest: ContainerManifest{
Id: "foo",
Containers: []Container{
Container{
{
Name: "foo",
},
},
Expand Down Expand Up @@ -248,7 +248,7 @@ func TestEtcdDeletePod(t *testing.T) {
key := "/registry/hosts/machine/pods/foo"
fakeClient.Set(key, util.MakeJSONString(Pod{JSONBase: JSONBase{ID: "foo"}}), 0)
fakeClient.Set("/registry/hosts/machine/kubelet", util.MakeJSONString([]ContainerManifest{
ContainerManifest{
{
Id: "foo",
},
}), 0)
Expand All @@ -272,8 +272,8 @@ func TestEtcdDeletePodMultipleContainers(t *testing.T) {
key := "/registry/hosts/machine/pods/foo"
fakeClient.Set(key, util.MakeJSONString(Pod{JSONBase: JSONBase{ID: "foo"}}), 0)
fakeClient.Set("/registry/hosts/machine/kubelet", util.MakeJSONString([]ContainerManifest{
ContainerManifest{Id: "foo"},
ContainerManifest{Id: "bar"},
{Id: "foo"},
{Id: "bar"},
}), 0)
registry := MakeTestEtcdRegistry(fakeClient, []string{"machine"})
err := registry.DeletePod("foo")
Expand Down Expand Up @@ -336,10 +336,10 @@ func TestEtcdListPods(t *testing.T) {
R: &etcd.Response{
Node: &etcd.Node{
Nodes: []*etcd.Node{
&etcd.Node{
{
Value: util.MakeJSONString(Pod{JSONBase: JSONBase{ID: "foo"}}),
},
&etcd.Node{
{
Value: util.MakeJSONString(Pod{JSONBase: JSONBase{ID: "bar"}}),
},
},
Expand Down Expand Up @@ -392,10 +392,10 @@ func TestEtcdListControllers(t *testing.T) {
R: &etcd.Response{
Node: &etcd.Node{
Nodes: []*etcd.Node{
&etcd.Node{
{
Value: util.MakeJSONString(ReplicationController{JSONBase: JSONBase{ID: "foo"}}),
},
&etcd.Node{
{
Value: util.MakeJSONString(ReplicationController{JSONBase: JSONBase{ID: "bar"}}),
},
},
Expand Down Expand Up @@ -499,10 +499,10 @@ func TestEtcdListServices(t *testing.T) {
R: &etcd.Response{
Node: &etcd.Node{
Nodes: []*etcd.Node{
&etcd.Node{
{
Value: util.MakeJSONString(Service{JSONBase: JSONBase{ID: "foo"}}),
},
&etcd.Node{
{
Value: util.MakeJSONString(Service{JSONBase: JSONBase{ID: "bar"}}),
},
},
Expand Down
Loading

0 comments on commit 4f6bed0

Please sign in to comment.