From 103ea2095f68439f54532dc3ce359e198b839f40 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 30 Dec 2020 17:43:01 +0000 Subject: [PATCH] Fix lint warnings in Go code All cosmetic. --- app/api_topology.go | 2 +- app/multitenant/consul_client.go | 4 ++-- app/multitenant/consul_pipe_router.go | 7 ++++--- probe/docker/container.go | 1 - probe/endpoint/ebpf.go | 1 + 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/api_topology.go b/app/api_topology.go index 9a811bcfa..8e4385755 100644 --- a/app/api_topology.go +++ b/app/api_topology.go @@ -166,7 +166,7 @@ type websocketState struct { } func (wc *websocketState) update(ctx context.Context) error { - span := ot.StartSpan("websocket.Render", ot.Tag{"topology", wc.topologyID}) + span := ot.StartSpan("websocket.Render", ot.Tag{Key: "topology", Value: wc.topologyID}) defer span.Finish() ctx = ot.ContextWithSpan(ctx, span) // We measure how much time has passed since the channel was opened diff --git a/app/multitenant/consul_client.go b/app/multitenant/consul_client.go index 42613ca06..a06db05da 100644 --- a/app/multitenant/consul_client.go +++ b/app/multitenant/consul_client.go @@ -61,7 +61,7 @@ type consulClient struct { // Get and deserialise a JSON value from consul. func (c *consulClient) Get(ctx context.Context, key string, out interface{}) error { - span, ctx := opentracing.StartSpanFromContext(ctx, "Consul Get", opentracing.Tag{"key", key}) + span, ctx := opentracing.StartSpanFromContext(ctx, "Consul Get", opentracing.Tag{Key: "key", Value: key}) defer span.Finish() kvp, _, err := c.kv.Get(key, queryOptions) if err != nil { @@ -76,7 +76,7 @@ func (c *consulClient) Get(ctx context.Context, key string, out interface{}) err // CAS atomically modify a value in a callback. // If value doesn't exist you'll get nil as a argument to your callback. func (c *consulClient) CAS(ctx context.Context, key string, out interface{}, f CASCallback) error { - span, ctx := opentracing.StartSpanFromContext(ctx, "Consul CAS", opentracing.Tag{"key", key}) + span, ctx := opentracing.StartSpanFromContext(ctx, "Consul CAS", opentracing.Tag{Key: "key", Value: key}) defer span.Finish() var ( index = uint64(0) diff --git a/app/multitenant/consul_pipe_router.go b/app/multitenant/consul_pipe_router.go index 7546c1a8a..53e828f36 100644 --- a/app/multitenant/consul_pipe_router.go +++ b/app/multitenant/consul_pipe_router.go @@ -9,6 +9,7 @@ import ( "time" "context" + "github.com/gorilla/mux" "github.com/gorilla/websocket" opentracing "github.com/opentracing/opentracing-go" @@ -289,7 +290,7 @@ func (pr *consulPipeRouter) Get(ctx context.Context, id string, e app.End) (xfer } key := fmt.Sprintf("%s%s-%s", pr.prefix, userID, id) log.Infof("Get %s:%s", key, e) - span, ctx := opentracing.StartSpanFromContext(ctx, "PipeRouter Get", opentracing.Tag{"key", key}) + span, ctx := opentracing.StartSpanFromContext(ctx, "PipeRouter Get", opentracing.Tag{Key: "key", Value: key}) defer span.Finish() // Try to ensure the given end of the given pipe @@ -333,7 +334,7 @@ func (pr *consulPipeRouter) Release(ctx context.Context, id string, e app.End) e } key := fmt.Sprintf("%s%s-%s", pr.prefix, userID, id) log.Infof("Release %s:%s", key, e) - span, ctx := opentracing.StartSpanFromContext(ctx, "PipeRouter Release", opentracing.Tag{"key", key}) + span, ctx := opentracing.StartSpanFromContext(ctx, "PipeRouter Release", opentracing.Tag{Key: "key", Value: key}) defer span.Finish() // atomically clear my end of the pipe in consul @@ -360,7 +361,7 @@ func (pr *consulPipeRouter) Delete(ctx context.Context, id string) error { } key := fmt.Sprintf("%s%s-%s", pr.prefix, userID, id) log.Infof("Delete %s", key) - span, ctx := opentracing.StartSpanFromContext(ctx, "PipeRouter Delete", opentracing.Tag{"key", key}) + span, ctx := opentracing.StartSpanFromContext(ctx, "PipeRouter Delete", opentracing.Tag{Key: "key", Value: key}) defer span.Finish() return pr.client.CAS(ctx, key, &consulPipe{}, func(in interface{}) (interface{}, bool, error) { diff --git a/probe/docker/container.go b/probe/docker/container.go index da27ac6d4..76d9f22d9 100644 --- a/probe/docker/container.go +++ b/probe/docker/container.go @@ -399,7 +399,6 @@ func (c *container) controls() []string { default: return []string{StartContainer, RemoveContainer} } - return nil } func (c *container) GetNode() report.Node { diff --git a/probe/endpoint/ebpf.go b/probe/endpoint/ebpf.go index 847c5d8a0..06fa8e18c 100644 --- a/probe/endpoint/ebpf.go +++ b/probe/endpoint/ebpf.go @@ -373,6 +373,7 @@ func (t *EbpfTracker) isDead() bool { return t.dead } +// Stop the tracker and wait for it to signal it has stopped func (t *EbpfTracker) Stop() { t.stop() if t.stopping != nil {