فهرست منبع

Merge pull request #4807 from gyuho/go1.4-build

Drop go1.4 support for development
Gyu-Ho Lee 9 سال پیش
والد
کامیت
dc9af8e3f3

+ 1 - 1
README.md

@@ -37,7 +37,7 @@ Or feel free to just use `curl`, as in the examples below.
 The easiest way to get etcd is to use one of the pre-built release binaries which are available for OSX, Linux, Windows, AppC (ACI), and Docker. Instructions for using these binaries are on the [GitHub releases page][github-release].
 
 For those wanting to try the very latest version, you can build the latest version of etcd from the `master` branch.
-You will first need [*Go*](https://golang.org/) installed on your machine (version 1.4+ is required).
+You will first need [*Go*](https://golang.org/) installed on your machine (version 1.5+ is required).
 All development occurs on `master`, including new features and bug fixes.
 Bug fixes are first targeted at `master` and subsequently ported to release branches, as described in the [branch management][branch-management] guide.
 

+ 0 - 2
client/cancelreq.go

@@ -4,8 +4,6 @@
 
 // borrowed from golang/net/context/ctxhttp/cancelreq.go
 
-// +build go1.5
-
 package client
 
 import "net/http"

+ 0 - 17
client/cancelreq_go14.go

@@ -1,17 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// borrowed from golang/net/context/ctxhttp/cancelreq_go14.go
-
-// +build !go1.5
-
-package client
-
-import "net/http"
-
-func requestCanceler(tr CancelableTransport, req *http.Request) func() {
-	return func() {
-		tr.CancelRequest(req)
-	}
-}

+ 0 - 41
client/fake_transport_go14_test.go

@@ -1,41 +0,0 @@
-// Copyright 2015 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !go1.5
-
-package client
-
-import (
-	"errors"
-	"net/http"
-)
-
-func (t *fakeTransport) RoundTrip(req *http.Request) (*http.Response, error) {
-	select {
-	case resp := <-t.respchan:
-		return resp, nil
-	case err := <-t.errchan:
-		return nil, err
-	case <-t.startCancel:
-		select {
-		// this simulates that the request is finished before cancel effects
-		case resp := <-t.respchan:
-			return resp, nil
-		// wait on finishCancel to simulate taking some amount of
-		// time while calling CancelRequest
-		case <-t.finishCancel:
-			return nil, errors.New("cancelled")
-		}
-	}
-}

+ 0 - 2
client/fake_transport_test.go

@@ -12,8 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-// +build go1.5
-
 package client
 
 import (

+ 0 - 2
pkg/httputil/cancelreq.go

@@ -4,8 +4,6 @@
 
 // borrowed from golang/net/context/ctxhttp/cancelreq.go
 
-// +build go1.5
-
 // Package httputil provides HTTP utility functions.
 package httputil
 

+ 0 - 25
pkg/httputil/cancelreq_go14.go

@@ -1,25 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// borrowed from golang/net/context/ctxhttp/cancelreq_go14.go
-
-// +build !go1.5
-
-package httputil
-
-import "net/http"
-
-type requestCanceler interface {
-	CancelRequest(req *http.Request)
-}
-
-func RequestCanceler(rt http.RoundTripper, req *http.Request) func() {
-	c, ok := rt.(requestCanceler)
-	if !ok {
-		return func() {}
-	}
-	return func() {
-		c.CancelRequest(req)
-	}
-}

+ 1 - 14
pkg/testutil/leak.go

@@ -74,12 +74,7 @@ func AfterTest(t *testing.T) {
 		"timeoutHandler":                               "a TimeoutHandler",
 		"net.(*netFD).connect(":                        "a timing out dial",
 		").noteClientGone(":                            "a closenotifier sender",
-	}
-
-	// readLoop was buggy before go1.5:
-	// https://github.com/golang/go/issues/10457
-	if getAtLeastGo15() {
-		badSubstring[").readLoop("] = "a Transport"
+		").readLoop(":                                  "a Transport",
 	}
 
 	var stacks string
@@ -126,11 +121,3 @@ func interestingGoroutines() (gs []string) {
 	sort.Strings(gs)
 	return
 }
-
-// getAtLeastGo15 returns true if the runtime has go1.5+.
-func getAtLeastGo15() bool {
-	var major, minor int
-	var discard string
-	i, err := fmt.Sscanf(runtime.Version(), "go%d.%d%s", &major, &minor, &discard)
-	return (err == nil && i == 3 && (major > 1 || major == 1 && minor >= 5))
-}

+ 0 - 40
pkg/types/urlsmap_go15_test.go

@@ -1,40 +0,0 @@
-// Copyright 2015 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build go1.5
-
-package types
-
-import (
-	"reflect"
-	"testing"
-
-	"github.com/coreos/etcd/pkg/testutil"
-)
-
-// This is only tested in Go1.5+ because Go1.4 doesn't support literal IPv6 address with zone in
-// URI (https://github.com/golang/go/issues/6530).
-func TestNewURLsMapIPV6(t *testing.T) {
-	c, err := NewURLsMap("mem1=http://[2001:db8::1]:2380,mem1=http://[fe80::6e40:8ff:feb1:58e4%25en0]:2380,mem2=http://[fe80::92e2:baff:fe7c:3224%25ext0]:2380")
-	if err != nil {
-		t.Fatalf("unexpected parse error: %v", err)
-	}
-	wc := URLsMap(map[string]URLs{
-		"mem1": testutil.MustNewURLs(t, []string{"http://[2001:db8::1]:2380", "http://[fe80::6e40:8ff:feb1:58e4%25en0]:2380"}),
-		"mem2": testutil.MustNewURLs(t, []string{"http://[fe80::92e2:baff:fe7c:3224%25ext0]:2380"}),
-	})
-	if !reflect.DeepEqual(c, wc) {
-		t.Errorf("cluster = %#v, want %#v", c, wc)
-	}
-}

+ 16 - 0
pkg/types/urlsmap_test.go

@@ -97,3 +97,19 @@ func TestParse(t *testing.T) {
 		}
 	}
 }
+
+// This is only tested in Go1.5+ because Go1.4 doesn't support literal IPv6 address with zone in
+// URI (https://github.com/golang/go/issues/6530).
+func TestNewURLsMapIPV6(t *testing.T) {
+	c, err := NewURLsMap("mem1=http://[2001:db8::1]:2380,mem1=http://[fe80::6e40:8ff:feb1:58e4%25en0]:2380,mem2=http://[fe80::92e2:baff:fe7c:3224%25ext0]:2380")
+	if err != nil {
+		t.Fatalf("unexpected parse error: %v", err)
+	}
+	wc := URLsMap(map[string]URLs{
+		"mem1": testutil.MustNewURLs(t, []string{"http://[2001:db8::1]:2380", "http://[fe80::6e40:8ff:feb1:58e4%25en0]:2380"}),
+		"mem2": testutil.MustNewURLs(t, []string{"http://[fe80::92e2:baff:fe7c:3224%25ext0]:2380"}),
+	})
+	if !reflect.DeepEqual(c, wc) {
+		t.Errorf("cluster = %#v, want %#v", c, wc)
+	}
+}

+ 0 - 35
rafthttp/fake_roundtripper_go14_test.go

@@ -1,35 +0,0 @@
-// Copyright 2015 CoreOS, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !go1.5
-
-package rafthttp
-
-import (
-	"errors"
-	"net/http"
-)
-
-func (t *roundTripperBlocker) RoundTrip(req *http.Request) (*http.Response, error) {
-	c := make(chan struct{}, 1)
-	t.mu.Lock()
-	t.cancel[req] = c
-	t.mu.Unlock()
-	select {
-	case <-t.unblockc:
-		return &http.Response{StatusCode: http.StatusNoContent, Body: &nopReadCloser{}}, nil
-	case <-c:
-		return nil, errors.New("request canceled")
-	}
-}

+ 0 - 2
rafthttp/fake_roundtripper_test.go

@@ -12,8 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-// +build go1.5
-
 package rafthttp
 
 import (