From a0cc4093521d5510c1e1f292b01bb4af5d9659a3 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Tue, 28 Aug 2018 21:28:41 -0700 Subject: [PATCH 1/5] Makefile: bump up to Go 1.11 Signed-off-by: Gyuho Lee --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index eefab125d3f..a87aae3f086 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ docker-remove: -GO_VERSION ?= 1.10.3 +GO_VERSION ?= 1.11 ETCD_VERSION ?= $(shell git rev-parse --short HEAD || echo "GitNotFound") TEST_SUFFIX = $(shell date +%s | base64 | head -c 15) @@ -65,11 +65,11 @@ endif # Example: -# GO_VERSION=1.8.7 make build-docker-test +# GO_VERSION=1.10.3 make build-docker-test # make build-docker-test # # gcloud docker -- login -u _json_key -p "$(cat /etc/gcp-key-etcd-development.json)" https://gcr.io -# GO_VERSION=1.8.7 make push-docker-test +# GO_VERSION=1.10.3 make push-docker-test # make push-docker-test # # gsutil -m acl ch -u allUsers:R -r gs://artifacts.etcd-development.appspot.com From d24acedb5e9c5b53eaec907b8758705b5bfd8e64 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Tue, 28 Aug 2018 21:29:01 -0700 Subject: [PATCH 2/5] travis.yml: bump up to Go 1.11 Signed-off-by: Gyuho Lee --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 85138136e7e..48547aa3a4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ sudo: required services: docker go: -- 1.10.3 +- 1.11 - tip notifications: @@ -30,13 +30,13 @@ env: matrix: fast_finish: true allow_failures: - - go: 1.10.3 + - go: 1.11 env: TARGET=linux-amd64-grpcproxy - - go: 1.10.3 + - go: 1.11 env: TARGET=linux-amd64-coverage - go: tip env: TARGET=linux-amd64-fmt-unit-go-tip - - go: 1.10.3 + - go: 1.11 env: TARGET=linux-386-unit exclude: - go: tip @@ -57,7 +57,7 @@ matrix: env: TARGET=linux-amd64-grpcproxy - go: tip env: TARGET=linux-amd64-coverage - - go: 1.10.3 + - go: 1.11 env: TARGET=linux-amd64-fmt-unit-go-tip - go: tip env: TARGET=linux-386-unit From 8560221091b364252278da94b502a25810e574e3 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Tue, 28 Aug 2018 21:45:12 -0700 Subject: [PATCH 3/5] etcdserver: fix gofmt warnings with Go 1.11 Signed-off-by: Gyuho Lee --- etcdserver/api/v2http/client.go | 12 ++++++------ etcdserver/config_test.go | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/etcdserver/api/v2http/client.go b/etcdserver/api/v2http/client.go index b0e01c98af9..3eabfc68634 100644 --- a/etcdserver/api/v2http/client.go +++ b/etcdserver/api/v2http/client.go @@ -76,12 +76,12 @@ func handleV2(lg *zap.Logger, mux *http.ServeMux, server etcdserver.ServerV2, ti } mh := &membersHandler{ - lg: lg, - sec: sec, - server: server, - cluster: server.Cluster(), - timeout: timeout, - clock: clockwork.NewRealClock(), + lg: lg, + sec: sec, + server: server, + cluster: server.Cluster(), + timeout: timeout, + clock: clockwork.NewRealClock(), clientCertAuthEnabled: server.ClientCertAuthEnabled(), } diff --git a/etcdserver/config_test.go b/etcdserver/config_test.go index aa9582bc27a..1d4157dc4cb 100644 --- a/etcdserver/config_test.go +++ b/etcdserver/config_test.go @@ -196,8 +196,8 @@ func TestWALDir(t *testing.T) { func TestShouldDiscover(t *testing.T) { tests := map[string]bool{ - "": false, - "foo": true, + "": false, + "foo": true, "http://discovery.etcd.io/asdf": true, } for durl, w := range tests { From 07fcc2679909e2080f1d6432147784bb9318b346 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Tue, 28 Aug 2018 21:45:24 -0700 Subject: [PATCH 4/5] *: fix gofmt warnings with Go 1.11 Signed-off-by: Gyuho Lee --- clientv3/lease.go | 2 +- functional/agent/server.go | 8 ++++---- integration/cluster.go | 4 ++-- pkg/testutil/leak.go | 12 ++++++------ proxy/httpproxy/reverse_test.go | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/clientv3/lease.go b/clientv3/lease.go index 6e92fa3baca..68a8ae6b3de 100644 --- a/clientv3/lease.go +++ b/clientv3/lease.go @@ -199,7 +199,7 @@ func NewLeaseFromLeaseClient(remote pb.LeaseClient, c *Client, keepAliveTimeout keepAlives: make(map[LeaseID]*keepAlive), remote: remote, firstKeepAliveTimeout: keepAliveTimeout, - lg: c.lg, + lg: c.lg, } if l.firstKeepAliveTimeout == time.Second { l.firstKeepAliveTimeout = defaultTTL diff --git a/functional/agent/server.go b/functional/agent/server.go index 8bba6379253..a39f28e764c 100644 --- a/functional/agent/server.go +++ b/functional/agent/server.go @@ -64,10 +64,10 @@ func NewServer( address string, ) *Server { return &Server{ - lg: lg, - network: network, - address: address, - last: rpcpb.Operation_NOT_STARTED, + lg: lg, + network: network, + address: address, + last: rpcpb.Operation_NOT_STARTED, advertiseClientPortToProxy: make(map[int]proxy.Server), advertisePeerPortToProxy: make(map[int]proxy.Server), } diff --git a/integration/cluster.go b/integration/cluster.go index c1149de858c..bc6881126bf 100644 --- a/integration/cluster.go +++ b/integration/cluster.go @@ -291,8 +291,8 @@ func (c *cluster) mustNewMember(t *testing.T) *member { grpcKeepAliveTimeout: c.cfg.GRPCKeepAliveTimeout, clientMaxCallSendMsgSize: c.cfg.ClientMaxCallSendMsgSize, clientMaxCallRecvMsgSize: c.cfg.ClientMaxCallRecvMsgSize, - useIP: c.cfg.UseIP, - leaseCheckpointInterval: c.cfg.LeaseCheckpointInterval, + useIP: c.cfg.UseIP, + leaseCheckpointInterval: c.cfg.LeaseCheckpointInterval, }) m.DiscoveryURL = c.cfg.DiscoveryURL if c.cfg.UseGRPC { diff --git a/pkg/testutil/leak.go b/pkg/testutil/leak.go index 8a867b16357..27eaa36d232 100644 --- a/pkg/testutil/leak.go +++ b/pkg/testutil/leak.go @@ -70,13 +70,13 @@ func CheckAfterTest(d time.Duration) error { } var bad string badSubstring := map[string]string{ - ").writeLoop(": "a Transport", + ").writeLoop(": "a Transport", "created by net/http/httptest.(*Server).Start": "an httptest.Server", - "timeoutHandler": "a TimeoutHandler", - "net.(*netFD).connect(": "a timing out dial", - ").noteClientGone(": "a closenotifier sender", - ").readLoop(": "a Transport", - ".grpc": "a gRPC resource", + "timeoutHandler": "a TimeoutHandler", + "net.(*netFD).connect(": "a timing out dial", + ").noteClientGone(": "a closenotifier sender", + ").readLoop(": "a Transport", + ".grpc": "a gRPC resource", } var stacks string diff --git a/proxy/httpproxy/reverse_test.go b/proxy/httpproxy/reverse_test.go index 284b6811b17..47a3b4a5b6c 100644 --- a/proxy/httpproxy/reverse_test.go +++ b/proxy/httpproxy/reverse_test.go @@ -175,10 +175,10 @@ func TestRemoveSingleHopHeaders(t *testing.T) { "Keep-Alive": {"foo"}, "Proxy-Authenticate": {"Basic realm=example.com"}, "Proxy-Authorization": {"foo"}, - "Te": {"deflate,gzip"}, - "Trailers": {"ETag"}, - "Transfer-Encoding": {"chunked"}, - "Upgrade": {"WebSocket"}, + "Te": {"deflate,gzip"}, + "Trailers": {"ETag"}, + "Transfer-Encoding": {"chunked"}, + "Upgrade": {"WebSocket"}, // headers that should persist "Accept": {"application/json"}, From 839f202195ec2945fbe79a088c4667ecd15e0f48 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Tue, 28 Aug 2018 22:27:11 -0700 Subject: [PATCH 5/5] clientv3/integration: fix race condition from closing channel Go 1.11 now marks len(channel) over being-closed channel as racey operation, fix tests by receiving from channel first and then check the length of channel. ``` WARNING: DATA RACE Write at 0x00c000e872c0 by goroutine 198: runtime.closechan() /usr/local/go/src/runtime/chan.go:327 +0x0 go.etcd.io/etcd/clientv3.(*lessor).closeRequireLeader() /Users/leegyuho/go/src/go.etcd.io/etcd/clientv3/lease.go:379 +0x748 go.etcd.io/etcd/clientv3.(*lessor).recvKeepAliveLoop() /Users/leegyuho/go/src/go.etcd.io/etcd/clientv3/lease.go:455 +0x3a5 Previous read at 0x00c000e872c0 by goroutine 27: go.etcd.io/etcd/clientv3/integration.TestLeaseWithRequireLeader() /Users/leegyuho/go/src/go.etcd.io/etcd/clientv3/integration/lease_test.go:828 +0x810 testing.tRunner() /usr/local/go/src/testing/testing.go:827 +0x162 ``` Signed-off-by: Gyuho Lee --- clientv3/integration/lease_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clientv3/integration/lease_test.go b/clientv3/integration/lease_test.go index ff11f0f4730..699862baaa5 100644 --- a/clientv3/integration/lease_test.go +++ b/clientv3/integration/lease_test.go @@ -825,8 +825,11 @@ func TestLeaseWithRequireLeader(t *testing.T) { // kaReqLeader may issue multiple requests while waiting for the first // response from proxy server; drain any stray keepalive responses time.Sleep(100 * time.Millisecond) - for len(kaReqLeader) > 0 { + for { <-kaReqLeader + if len(kaReqLeader) == 0 { + break + } } select {