From 3bacb04a5f9805bb83e016e341a49d0f13a43598 Mon Sep 17 00:00:00 2001 From: Cong Ding Date: Fri, 22 Jun 2018 16:39:13 -0700 Subject: [PATCH] cleanup: remove deadcode --- staging/src/k8s.io/apiserver/pkg/endpoints/installer.go | 7 ------- .../src/k8s.io/apiserver/pkg/storage/etcd/etcd_watcher.go | 4 ---- staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go | 5 ----- staging/src/k8s.io/client-go/util/jsonpath/parser.go | 6 +++--- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go b/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go index 3edd09dcdf9..53b450a693d 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go @@ -855,13 +855,6 @@ func appendIf(actions []action, a action, shouldAppend bool) []action { return actions } -// Wraps a http.Handler function inside a restful.RouteFunction -func routeFunction(handler http.Handler) restful.RouteFunction { - return func(restReq *restful.Request, restResp *restful.Response) { - handler.ServeHTTP(restResp.ResponseWriter, restReq.Request) - } -} - func addParams(route *restful.RouteBuilder, params []*restful.Parameter) { for _, param := range params { route.Param(param) diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd/etcd_watcher.go b/staging/src/k8s.io/apiserver/pkg/storage/etcd/etcd_watcher.go index 21ffc42e57f..d3a2e3c53ad 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd/etcd_watcher.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/etcd/etcd_watcher.go @@ -22,7 +22,6 @@ import ( "net/http" "reflect" "sync" - "time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -100,9 +99,6 @@ type etcdWatcher struct { cache etcdCache } -// watchWaitDuration is the amount of time to wait for an error from watch. -const watchWaitDuration = 100 * time.Millisecond - // newEtcdWatcher returns a new etcdWatcher; if list is true, watch sub-nodes. // The versioner must be able to handle the objects that transform creates. func newEtcdWatcher(list bool, quorum bool, include includeFunc, pred storage.SelectionPredicate, diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go index 1513af8e7c2..dd509444e97 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go @@ -73,11 +73,6 @@ type store struct { leaseManager *leaseManager } -type elemForDecode struct { - data []byte - rev uint64 -} - type objState struct { obj runtime.Object meta *storage.ResponseMeta diff --git a/staging/src/k8s.io/client-go/util/jsonpath/parser.go b/staging/src/k8s.io/client-go/util/jsonpath/parser.go index ef0f9213a4f..99b45849c98 100644 --- a/staging/src/k8s.io/client-go/util/jsonpath/parser.go +++ b/staging/src/k8s.io/client-go/util/jsonpath/parser.go @@ -94,7 +94,7 @@ func (p *Parser) consumeText() string { // next returns the next rune in the input. func (p *Parser) next() rune { - if int(p.pos) >= len(p.input) { + if p.pos >= len(p.input) { p.width = 0 return eof } @@ -266,7 +266,7 @@ Loop: } } text := p.consumeText() - text = string(text[1 : len(text)-1]) + text = text[1 : len(text)-1] if text == "*" { text = ":" } @@ -373,7 +373,7 @@ Loop: } reg := regexp.MustCompile(`^([^!<>=]+)([!<>=]+)(.+?)$`) text := p.consumeText() - text = string(text[:len(text)-2]) + text = text[:len(text)-2] value := reg.FindStringSubmatch(text) if value == nil { parser, err := parseAction("text", text)