mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
*: clean up unused vars, functions
With help from https://github.com/dominikh/go-unused. IsNetTimeoutError seems useful, so moved to pkg/netutil.
This commit is contained in:
parent
7408bc2504
commit
6e6d64fb9b
@ -41,10 +41,6 @@ type UserRoles struct {
|
|||||||
Roles []Role `json:"roles"`
|
Roles []Role `json:"roles"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type userName struct {
|
|
||||||
User string `json:"user"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func v2AuthURL(ep url.URL, action string, name string) *url.URL {
|
func v2AuthURL(ep url.URL, action string, name string) *url.URL {
|
||||||
if name != "" {
|
if name != "" {
|
||||||
ep.Path = path.Join(ep.Path, defaultV2AuthPrefix, action, name)
|
ep.Path = path.Join(ep.Path, defaultV2AuthPrefix, action, name)
|
||||||
|
@ -1246,7 +1246,6 @@ func TestHTTPKeysAPIGetResponse(t *testing.T) {
|
|||||||
func TestHTTPKeysAPIDeleteAction(t *testing.T) {
|
func TestHTTPKeysAPIDeleteAction(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
key string
|
key string
|
||||||
value string
|
|
||||||
opts *DeleteOptions
|
opts *DeleteOptions
|
||||||
wantAction httpAction
|
wantAction httpAction
|
||||||
}{
|
}{
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
package ctlv3
|
package ctlv3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"text/tabwriter"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/coreos/etcd/etcdctl/ctlv3/command"
|
"github.com/coreos/etcd/etcdctl/ctlv3/command"
|
||||||
@ -32,7 +31,6 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
tabOut *tabwriter.Writer
|
|
||||||
globalFlags = command.GlobalFlags{}
|
globalFlags = command.GlobalFlags{}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ func startProxy(cfg *config) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cfg.dir = path.Join(cfg.dir, "proxy")
|
cfg.dir = path.Join(cfg.dir, "proxy")
|
||||||
err = os.MkdirAll(cfg.dir, 0700)
|
err = os.MkdirAll(cfg.dir, privateDirMode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
package v2http
|
package v2http
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
@ -37,7 +36,6 @@ const (
|
|||||||
var (
|
var (
|
||||||
plog = capnslog.NewPackageLogger("github.com/coreos/etcd/etcdserver/api", "v2http")
|
plog = capnslog.NewPackageLogger("github.com/coreos/etcd/etcdserver/api", "v2http")
|
||||||
mlog = logutil.NewMergeLogger(plog)
|
mlog = logutil.NewMergeLogger(plog)
|
||||||
errClosed = errors.New("v2http: client closed connection")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// writeError logs and writes the given Error to the ResponseWriter
|
// writeError logs and writes the given Error to the ResponseWriter
|
||||||
|
@ -116,3 +116,8 @@ func URLStringsEqual(a []string, b []string) bool {
|
|||||||
|
|
||||||
return urlsEqual(urlsA, urlsB)
|
return urlsEqual(urlsA, urlsB)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsNetworkTimeoutError(err error) bool {
|
||||||
|
nerr, ok := err.(net.Error)
|
||||||
|
return ok && nerr.Timeout()
|
||||||
|
}
|
||||||
|
@ -70,7 +70,6 @@ type director struct {
|
|||||||
ep []*endpoint
|
ep []*endpoint
|
||||||
uf GetProxyURLs
|
uf GetProxyURLs
|
||||||
failureWait time.Duration
|
failureWait time.Duration
|
||||||
refreshInterval time.Duration
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *director) refresh() {
|
func (d *director) refresh() {
|
||||||
|
@ -29,8 +29,6 @@ import (
|
|||||||
const None uint64 = 0
|
const None uint64 = 0
|
||||||
const noLimit = math.MaxUint64
|
const noLimit = math.MaxUint64
|
||||||
|
|
||||||
var errNoLeader = errors.New("no leader")
|
|
||||||
|
|
||||||
var ErrSnapshotTemporarilyUnavailable = errors.New("snapshot is temporarily unavailable")
|
var ErrSnapshotTemporarilyUnavailable = errors.New("snapshot is temporarily unavailable")
|
||||||
|
|
||||||
// Possible values for StateType.
|
// Possible values for StateType.
|
||||||
|
@ -374,12 +374,6 @@ func (cr *streamReader) stop() {
|
|||||||
<-cr.done
|
<-cr.done
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cr *streamReader) isWorking() bool {
|
|
||||||
cr.mu.Lock()
|
|
||||||
defer cr.mu.Unlock()
|
|
||||||
return cr.closer != nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cr *streamReader) dial(t streamType) (io.ReadCloser, error) {
|
func (cr *streamReader) dial(t streamType) (io.ReadCloser, error) {
|
||||||
u := cr.picker.pick()
|
u := cr.picker.pick()
|
||||||
uu := u
|
uu := u
|
||||||
@ -500,8 +494,3 @@ func checkStreamSupport(v *semver.Version, t streamType) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func isNetworkTimeoutError(err error) bool {
|
|
||||||
nerr, ok := err.(net.Error)
|
|
||||||
return ok && nerr.Timeout()
|
|
||||||
}
|
|
||||||
|
@ -143,13 +143,6 @@ func (w watcherSetByKey) delete(wa *watcher) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
type interval struct {
|
|
||||||
begin string
|
|
||||||
end string
|
|
||||||
}
|
|
||||||
|
|
||||||
type watcherSetByInterval map[interval]watcherSet
|
|
||||||
|
|
||||||
// watcherGroup is a collection of watchers organized by their ranges
|
// watcherGroup is a collection of watchers organized by their ranges
|
||||||
type watcherGroup struct {
|
type watcherGroup struct {
|
||||||
// keyWatchers has the watchers that watch on a single key
|
// keyWatchers has the watchers that watch on a single key
|
||||||
|
Loading…
x
Reference in New Issue
Block a user