Skip to content

Commit

Permalink
Merge pull request kubernetes#1433 from lavalamp/fixVerifyFmt
Browse files Browse the repository at this point in the history
Fix verify gofmt
  • Loading branch information
brendandburns committed Sep 24, 2014
2 parents 65c14a1 + bb0cd95 commit a981ae5
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 153 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go:
- 1.3
- 1.2

install:
install:
- go get code.google.com/p/go.tools/cmd/cover
- ./hack/install-etcd.sh
- ./hack/verify-gofmt.sh
Expand Down
2 changes: 1 addition & 1 deletion cmd/apiserver/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ package main
import (
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider/aws"
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider/gce"
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider/vagrant"
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider/ovirt"
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider/vagrant"
)
5 changes: 2 additions & 3 deletions hack/verify-gofmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
# GoFmt apparently is changing @ head...

GO_VERSION=($(go version))
echo "Detected go version: $(go version)"

if [[ ${GO_VERSION[2]} != "go1.2" && ${GO_VERSION[2]} != "go1.3" ]]; then
echo "Unknown go version, skipping gofmt."
if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.2|go1.3') ]]; then
echo "Unknown go version '${GO_VERSION}', skipping gofmt."
exit 0
fi

Expand Down
2 changes: 1 addition & 1 deletion pkg/api/latest/latest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
func TestInternalRoundTrip(t *testing.T) {
latest := "v1beta2"

for k, _ := range internal.Scheme.KnownTypes("") {
for k := range internal.Scheme.KnownTypes("") {
obj, err := internal.Scheme.New("", k)
if err != nil {
t.Errorf("%s: unexpected error: %v", k, err)
Expand Down
10 changes: 5 additions & 5 deletions pkg/cloudprovider/aws/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,20 @@ func mockInstancesResp(instances []ec2.Instance) (aws *AWSCloud) {
func(instanceIds []string, filter *ec2.Filter) (resp *ec2.InstancesResp, err error) {
return &ec2.InstancesResp{"",
[]ec2.Reservation{
ec2.Reservation{"", "", "", nil, instances}}}, nil
{"", "", "", nil, instances}}}, nil
}},
nil}
}

func TestList(t *testing.T) {
instances := make([]ec2.Instance, 4)
instances[0].Tags = []ec2.Tag{ec2.Tag{"Name", "foo"}}
instances[0].Tags = []ec2.Tag{{"Name", "foo"}}
instances[0].PrivateDNSName = "instance1"
instances[1].Tags = []ec2.Tag{ec2.Tag{"Name", "bar"}}
instances[1].Tags = []ec2.Tag{{"Name", "bar"}}
instances[1].PrivateDNSName = "instance2"
instances[2].Tags = []ec2.Tag{ec2.Tag{"Name", "baz"}}
instances[2].Tags = []ec2.Tag{{"Name", "baz"}}
instances[2].PrivateDNSName = "instance3"
instances[3].Tags = []ec2.Tag{ec2.Tag{"Name", "quux"}}
instances[3].Tags = []ec2.Tag{{"Name", "quux"}}
instances[3].PrivateDNSName = "instance4"

aws := mockInstancesResp(instances)
Expand Down
24 changes: 12 additions & 12 deletions pkg/cloudprovider/ovirt/ovirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package ovirt_cloud

import (
"encoding/xml"
"fmt"
"io"
"io/ioutil"
"fmt"
"net"
"net/http"
"net/url"
Expand All @@ -32,8 +32,8 @@ import (
)

type OVirtCloud struct {
VmsRequest *url.URL
HostsRequest *url.URL
VmsRequest *url.URL
HostsRequest *url.URL
}

type OVirtApiConfig struct {
Expand All @@ -43,18 +43,18 @@ type OVirtApiConfig struct {
Password string `gcfg:"password"`
}
Filters struct {
VmsQuery string `gcfg:"vms"`
VmsQuery string `gcfg:"vms"`
}
}

type XmlVmInfo struct {
Hostname string `xml:"guest_info>fqdn"`
State string `xml:"status>state"`
Hostname string `xml:"guest_info>fqdn"`
State string `xml:"status>state"`
}

type XmlVmsList struct {
XMLName xml.Name `xml:"vms"`
Vm []XmlVmInfo `xml:"vm"`
XMLName xml.Name `xml:"vms"`
Vm []XmlVmInfo `xml:"vm"`
}

func init() {
Expand All @@ -74,7 +74,7 @@ func newOVirtCloud(config io.Reader) (*OVirtCloud, error) {
/* defaults */
oVirtConfig.Connection.Username = "admin@internal"

if err := gcfg.ReadInto(&oVirtConfig, config); err != nil {
if err := gcfg.ReadInto(&oVirtConfig, config); err != nil {
return nil, err
}

Expand All @@ -83,7 +83,7 @@ func newOVirtCloud(config io.Reader) (*OVirtCloud, error) {
}

request, err := url.Parse(oVirtConfig.Connection.ApiEntry)
if err != nil {
if err != nil {
return nil, err
}

Expand Down Expand Up @@ -121,7 +121,7 @@ func getInstancesFromXml(body io.Reader) ([]string, error) {
}

content, err := ioutil.ReadAll(body)
if err != nil {
if err != nil {
return nil, err
}

Expand All @@ -146,7 +146,7 @@ func getInstancesFromXml(body io.Reader) ([]string, error) {
// List enumerates the set of minions instances known by the cloud provider
func (v *OVirtCloud) List(filter string) ([]string, error) {
response, err := http.Get(v.VmsRequest.String())
if err != nil {
if err != nil {
return nil, err
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/kubelet/config/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestExtractInvalidManifest(t *testing.T) {
desc: "Unspecified container name",
manifests: []api.ContainerManifest{
{
Version: "v1beta1",
Version: "v1beta1",
Containers: []api.Container{{Name: ""}},
},
},
Expand All @@ -88,7 +88,7 @@ func TestExtractInvalidManifest(t *testing.T) {
desc: "Invalid container name",
manifests: []api.ContainerManifest{
{
Version: "v1beta1",
Version: "v1beta1",
Containers: []api.Container{{Name: "_INVALID_"}},
},
},
Expand Down
8 changes: 4 additions & 4 deletions pkg/kubelet/dockertools/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ func TestDockerConfigJSONDecode(t *testing.T) {
input := []byte(`{"http://foo.example.com":{"username": "foo", "password": "bar", "email": "foo@example.com"}, "http://bar.example.com":{"username": "bar", "password": "baz", "email": "bar@example.com"}}`)

expect := dockerConfig(map[string]dockerConfigEntry{
"http://foo.example.com": dockerConfigEntry{
"http://foo.example.com": {
Username: "foo",
Password: "bar",
Email: "foo@example.com",
},
"http://bar.example.com": dockerConfigEntry{
"http://bar.example.com": {
Username: "bar",
Password: "baz",
Email: "bar@example.com",
Expand Down Expand Up @@ -171,12 +171,12 @@ func TestDecodeDockerConfigFieldAuth(t *testing.T) {

func TestDockerKeyringFromConfig(t *testing.T) {
cfg := dockerConfig(map[string]dockerConfigEntry{
"http://foo.example.com": dockerConfigEntry{
"http://foo.example.com": {
Username: "foo",
Password: "bar",
Email: "foo@example.com",
},
"https://bar.example.com": dockerConfigEntry{
"https://bar.example.com": {
Username: "bar",
Password: "baz",
Email: "bar@example.com",
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubelet/dockertools/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import (
"errors"
"fmt"
"hash/adler32"
"io"
"math/rand"
"os/exec"
"sort"
"strconv"
"strings"
"io"

"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/fsouza/go-dockerclient"
Expand Down
6 changes: 3 additions & 3 deletions pkg/kubelet/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ package kubelet

import (
"fmt"
"io"
"net"
"strconv"
"net/http"
"io"
"strconv"

"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
Expand Down Expand Up @@ -101,7 +101,7 @@ func (h *httpActionHandler) Run(podFullName, uuid string, container *api.Contain
// FlushWriter provides wrapper for responseWriter with HTTP streaming capabilities
type FlushWriter struct {
flusher http.Flusher
writer io.Writer
writer io.Writer
}

// Write is a FlushWriter implementation of the io.Writer that sends any buffered data to the client.
Expand Down
4 changes: 2 additions & 2 deletions pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import (
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"path"
"strconv"
"strings"
"sync"
"time"
"io"

"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/validation"
Expand Down Expand Up @@ -758,7 +758,7 @@ func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName, tail stri
if !found {
return fmt.Errorf("container not found (%s)\n", containerName)
}
return dockertools.GetKubeletDockerContainerLogs(kl.dockerClient, dockerContainer.ID, tail , follow, stdout, stderr)
return dockertools.GetKubeletDockerContainerLogs(kl.dockerClient, dockerContainer.ID, tail, follow, stdout, stderr)
}

// GetPodInfo returns information from Docker about the containers in a pod
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubelet/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (s *Server) handleContainerLogs(w http.ResponseWriter, req *http.Request) {
http.Error(w, `{"message": "Missing container name."}`, http.StatusBadRequest)
return
}

uriValues := u.Query()
follow, _ := strconv.ParseBool(uriValues.Get("follow"))
tail := uriValues.Get("tail")
Expand Down
Loading

0 comments on commit a981ae5

Please sign in to comment.