Merge pull request #7737 from gyuho/aaa

*: clean up for Go 1.8+
This commit is contained in:
Xiang Li
2017-04-18 03:37:43 -07:00
committed by GitHub
4 changed files with 3 additions and 33 deletions

View File

@@ -4,7 +4,7 @@ go_import_path: github.com/coreos/etcd
sudo: false
go:
- 1.8
- 1.8.1
- tip
notifications:

View File

@@ -32,7 +32,6 @@ import (
"github.com/coreos/etcd/etcdserver/api/v3rpc"
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
"github.com/coreos/etcd/pkg/debugutil"
"github.com/coreos/etcd/pkg/transport"
"github.com/cockroachdb/cmux"
gw "github.com/grpc-ecosystem/grpc-gateway/runtime"
@@ -117,7 +116,7 @@ func (sctx *serveCtx) serve(s *etcdserver.EtcdServer, tlscfg *tls.Config, handle
}
handler = grpcHandlerFunc(gs, handler)
dtls := transport.ShallowCopyTLSConfig(tlscfg)
dtls := tlscfg.Clone()
// trust local server
dtls.InsecureSkipVerify = true
creds := credentials.NewTLS(dtls)

View File

@@ -484,7 +484,7 @@ func TestV3LeaseFailover(t *testing.T) {
clus.waitLeader(t, clus.Members)
// lease should not expire at the last received expire deadline.
time.Sleep(expectedExp.Sub(time.Now()) - 500*time.Millisecond)
time.Sleep(time.Until(expectedExp) - 500*time.Millisecond)
if !leaseExist(t, clus, lresp.ID) {
t.Error("unexpected lease not exists")

View File

@@ -242,35 +242,6 @@ func (info TLSInfo) ClientConfig() (*tls.Config, error) {
return cfg, nil
}
// ShallowCopyTLSConfig copies *tls.Config. This is only
// work-around for go-vet tests, which complains
//
// assignment copies lock value to p: crypto/tls.Config contains sync.Once contains sync.Mutex
//
// Keep up-to-date with 'go/src/crypto/tls/common.go'
func ShallowCopyTLSConfig(cfg *tls.Config) *tls.Config {
ncfg := tls.Config{
Time: cfg.Time,
Certificates: cfg.Certificates,
NameToCertificate: cfg.NameToCertificate,
GetCertificate: cfg.GetCertificate,
RootCAs: cfg.RootCAs,
NextProtos: cfg.NextProtos,
ServerName: cfg.ServerName,
ClientAuth: cfg.ClientAuth,
ClientCAs: cfg.ClientCAs,
InsecureSkipVerify: cfg.InsecureSkipVerify,
CipherSuites: cfg.CipherSuites,
PreferServerCipherSuites: cfg.PreferServerCipherSuites,
SessionTicketKey: cfg.SessionTicketKey,
ClientSessionCache: cfg.ClientSessionCache,
MinVersion: cfg.MinVersion,
MaxVersion: cfg.MaxVersion,
CurvePreferences: cfg.CurvePreferences,
}
return &ncfg
}
// IsClosedConnError returns true if the error is from closing listener, cmux.
// copied from golang.org/x/net/http2/http2.go
func IsClosedConnError(err error) bool {