From 82a430ccf7bbf80f806d012b29048decc14bb1ed Mon Sep 17 00:00:00 2001 From: Sargun Dhillon Date: Tue, 24 Sep 2019 12:55:52 -0700 Subject: [PATCH] Add unused code linter --- .golangci.yml | 1 + go.mod | 1 - node/api/exec.go | 1 - node/pod.go | 16 ---------------- 4 files changed, 1 insertion(+), 18 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index b73925141..5f7e34de8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -11,3 +11,4 @@ linters: - golint - goconst - goimports + - unused diff --git a/go.mod b/go.mod index ca195826d..1b9600817 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.12 require ( contrib.go.opencensus.io/exporter/jaeger v0.1.0 contrib.go.opencensus.io/exporter/ocagent v0.4.12 - github.com/davecgh/go-spew v1.1.1 github.com/docker/spdystream v0.0.0-20170912183627-bc6354cbbc29 // indirect github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f // indirect github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 // indirect diff --git a/node/api/exec.go b/node/api/exec.go index 25000547f..1d7fbc9d7 100644 --- a/node/api/exec.go +++ b/node/api/exec.go @@ -109,7 +109,6 @@ func getExecOptions(req *http.Request) (*remotecommand.Options, error) { type containerExecContext struct { h ContainerExecHandlerFunc - eio *execIO namespace, pod, container string ctx context.Context } diff --git a/node/pod.go b/node/pod.go index cfc3fc264..eb2294f17 100644 --- a/node/pod.go +++ b/node/pod.go @@ -16,10 +16,8 @@ package node import ( "context" - "hash/fnv" "time" - "github.com/davecgh/go-spew/spew" "github.com/google/go-cmp/cmp" pkgerrors "github.com/pkg/errors" "github.com/virtual-kubelet/virtual-kubelet/errdefs" @@ -117,20 +115,6 @@ func podsEqual(pod1, pod2 *corev1.Pod) bool { } -// This is basically the kube runtime's hash container functionality. -// VK only operates at the Pod level so this is adapted for that -func hashPodSpec(spec corev1.PodSpec) uint64 { - hash := fnv.New32a() - printer := spew.ConfigState{ - Indent: " ", - SortKeys: true, - DisableMethods: true, - SpewKeys: true, - } - printer.Fprintf(hash, "%#v", spec) - return uint64(hash.Sum32()) -} - func (pc *PodController) handleProviderError(ctx context.Context, span trace.Span, origErr error, pod *corev1.Pod) { podPhase := corev1.PodPending if pod.Spec.RestartPolicy == corev1.RestartPolicyNever {