From 9965604d4b4c28c29164e43946a2d2c56dbec05e Mon Sep 17 00:00:00 2001 From: Eric Paris Date: Fri, 20 Feb 2015 10:31:06 -0500 Subject: [PATCH 1/2] check gofmt with golang 1.4 --- hack/verify-gofmt.sh | 2 +- pkg/proxy/config/config.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/verify-gofmt.sh b/hack/verify-gofmt.sh index d73c0cc4426..82416baec42 100755 --- a/hack/verify-gofmt.sh +++ b/hack/verify-gofmt.sh @@ -24,7 +24,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. GO_VERSION=($(go version)) -if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.2|go1.3') ]]; then +if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.2|go1.3|go1.4') ]]; then echo "Unknown go version '${GO_VERSION}', skipping gofmt." exit 0 fi diff --git a/pkg/proxy/config/config.go b/pkg/proxy/config/config.go index fc275a08bc6..9653a82ae69 100644 --- a/pkg/proxy/config/config.go +++ b/pkg/proxy/config/config.go @@ -262,7 +262,7 @@ func (s *serviceStore) MergedState() interface{} { // watchForUpdates invokes bcaster.Notify() with the latest version of an object // when changes occur. func watchForUpdates(bcaster *config.Broadcaster, accessor config.Accessor, updates <-chan struct{}) { - for _ = range updates { + for range updates { bcaster.Notify(accessor.MergedState()) } } From e8acfe5f812df79787efdf1edf4199aa0acdb93b Mon Sep 17 00:00:00 2001 From: Eric Paris Date: Fri, 20 Feb 2015 12:30:33 -0500 Subject: [PATCH 2/2] change proxy to satisfy both gofmt 1.3 and 1.4 gofmt gofmt -s from 1.4 does not like for _ = range BLAH it wants for range BLAH But gofmt from 1.3 dies: ./pkg/proxy/config/config.go:265:6: expected operand, found 'range' ./pkg/proxy/config/config.go:268:3: expected '{', found 'EOF' So instead, rewrite the code to make them both happy --- pkg/proxy/config/config.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/proxy/config/config.go b/pkg/proxy/config/config.go index 9653a82ae69..792644bc4b0 100644 --- a/pkg/proxy/config/config.go +++ b/pkg/proxy/config/config.go @@ -262,7 +262,8 @@ func (s *serviceStore) MergedState() interface{} { // watchForUpdates invokes bcaster.Notify() with the latest version of an object // when changes occur. func watchForUpdates(bcaster *config.Broadcaster, accessor config.Accessor, updates <-chan struct{}) { - for range updates { + for true { + <-updates bcaster.Notify(accessor.MergedState()) } }