From 12e8acad96f0d68b8bb096ef442795b3c3d7e4ab Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Thu, 27 Apr 2023 23:05:50 -0700 Subject: [PATCH] fix lint issues --- .github/workflows/golangci-lint.yml | 2 +- clientcfg/client.go | 4 +- datapoint/dpsink/counter.go | 3 ++ datapoint/dpsink/logfilter_test.go | 2 +- datapoint/dpsink/sink_test.go | 2 +- distconf/bool.go | 1 + distconf/distconf_test.go | 6 +-- distconf/duration.go | 1 + distconf/float.go | 1 + distconf/int.go | 1 + distconf/integration_test.go | 8 ++-- errors/log.go | 14 +++--- errors/matcher.go | 8 ++-- log/counter.go | 2 +- log/kit_test.go | 2 +- log/kitnop_logger_test.go | 2 +- log/nop.go | 2 +- logsink/logsink_test.go | 2 +- metadata/aws/ec2metadata/ec2_test.go | 2 +- metadata/hostmetadata/host-not-linux.go | 4 +- sfxclient/cumulativebucket_test.go | 2 +- sfxclient/httpsink.go | 1 + sfxclient/multitokensink.go | 3 ++ sfxclient/multitokensink_test.go | 12 ++--- sfxclient/rollbucket_test.go | 2 +- sfxclient/sfxclient.go | 64 +++++++++++++------------ sfxclient/sfxclient_test.go | 2 +- sfxclient/spanfilter/spanfilter.go | 2 + timekeeper/timekeeper_test.go | 2 +- trace/format/format.go | 4 ++ trace/trace_test.go | 2 +- web/reqcounter.go | 2 +- 32 files changed, 93 insertions(+), 74 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index c9d1bb2..30b240f 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -12,7 +12,7 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: golangci-lint uses: golangci/golangci-lint-action@v3.4.0 with: diff --git a/clientcfg/client.go b/clientcfg/client.go index 3cd1656..e80bda5 100644 --- a/clientcfg/client.go +++ b/clientcfg/client.go @@ -141,7 +141,7 @@ func (s *ClientConfigChangerSink) AddEvents(ctx context.Context, events []*event return s.Destination.AddEvents(ctx, events) } -func (s *ClientConfigChangerSink) disableCompressionWatch(newValue *distconf.Bool, old bool) { +func (s *ClientConfigChangerSink) disableCompressionWatch(newValue *distconf.Bool, _ bool) { s.logger.Log("disableCompression watch") s.mu.Lock() s.Destination.DisableCompression = newValue.Get() @@ -161,7 +161,7 @@ func (s *ClientConfigChangerSink) authTokenWatch(str *distconf.Str, _ string) { // endpointWatch returns a distconf watch that sets the correct ingest endpoint for a signalfx // client -func (s *ClientConfigChangerSink) endpointWatch(str *distconf.Str, oldValue string) { +func (s *ClientConfigChangerSink) endpointWatch(str *distconf.Str, _ string) { s.logger.Log("endpoint watch") e := str.Get() if e == "" { diff --git a/datapoint/dpsink/counter.go b/datapoint/dpsink/counter.go index b8ad6b4..3f85a20 100644 --- a/datapoint/dpsink/counter.go +++ b/datapoint/dpsink/counter.go @@ -68,6 +68,7 @@ func (c *Counter) logErrMsg(ctx context.Context, err error, msg string) { } // AddDatapoints will send points to the next sink and track points send to the next sink +// //nolint:dupl func (c *Counter) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error { atomic.AddInt64(&c.TotalDatapoints, int64(len(points))) @@ -93,6 +94,7 @@ func (c *Counter) logger() log.Logger { } // AddEvents will send events to the next sink and track events sent to the next sink +// //nolint:dupl func (c *Counter) AddEvents(ctx context.Context, events []*event.Event, next Sink) error { atomic.AddInt64(&c.TotalEvents, int64(len(events))) @@ -111,6 +113,7 @@ func (c *Counter) AddEvents(ctx context.Context, events []*event.Event, next Sin } // AddSpans will send spans to the next sink and track spans sent to the next sink +// //nolint:dupl func (c *Counter) AddSpans(ctx context.Context, spans []*trace.Span, next trace.Sink) error { atomic.AddInt64(&c.TotalSpans, int64(len(spans))) diff --git a/datapoint/dpsink/logfilter_test.go b/datapoint/dpsink/logfilter_test.go index 1e18716..685c619 100644 --- a/datapoint/dpsink/logfilter_test.go +++ b/datapoint/dpsink/logfilter_test.go @@ -17,7 +17,7 @@ import ( type boolFlagCheck bool -func (b *boolFlagCheck) HasFlag(ctx context.Context) bool { +func (b *boolFlagCheck) HasFlag(_ context.Context) bool { return bool(*b) } diff --git a/datapoint/dpsink/sink_test.go b/datapoint/dpsink/sink_test.go index afd579f..eb3ca0e 100644 --- a/datapoint/dpsink/sink_test.go +++ b/datapoint/dpsink/sink_test.go @@ -45,7 +45,7 @@ func (e *expect) next(sendTo Sink) Sink { } } -func TestFromChain(t *testing.T) { +func TestFromChain(_ *testing.T) { e2 := expect{count: 2} e1 := expect{count: 1} e0 := expect{count: 0} diff --git a/distconf/bool.go b/distconf/bool.go index 8d89c66..b2b2299 100644 --- a/distconf/bool.go +++ b/distconf/bool.go @@ -25,6 +25,7 @@ type Bool struct { } // Update the contents of Bool to the new value +// //nolint:ifshort func (s *boolConf) Update(newValue []byte) error { s.mutex.Lock() diff --git a/distconf/distconf_test.go b/distconf/distconf_test.go index 66b9606..906d81c 100644 --- a/distconf/distconf_test.go +++ b/distconf/distconf_test.go @@ -14,15 +14,15 @@ type allErrorBacking struct{} var errNope = errors.New("nope") -func (m *allErrorBacking) Get(key string) ([]byte, error) { +func (m *allErrorBacking) Get(_ string) ([]byte, error) { return nil, errNope } -func (m *allErrorBacking) Write(key string, value []byte) error { +func (m *allErrorBacking) Write(_ string, _ []byte) error { return errNope } -func (m *allErrorBacking) Watch(key string, callback backingCallbackFunction) error { +func (m *allErrorBacking) Watch(_ string, _ backingCallbackFunction) error { return errNope } diff --git a/distconf/duration.go b/distconf/duration.go index 4a7e23b..10f794f 100644 --- a/distconf/duration.go +++ b/distconf/duration.go @@ -33,6 +33,7 @@ func (s *Duration) Get() time.Duration { } // Update the contents of Duration to the new value +// //nolint:ifshort func (s *durationConf) Update(newValue []byte) error { s.mutex.Lock() diff --git a/distconf/float.go b/distconf/float.go index 264fc83..0e7a672 100644 --- a/distconf/float.go +++ b/distconf/float.go @@ -32,6 +32,7 @@ func (c *Float) Get() float64 { } // Update the content of this config variable to newValue. +// //nolint:ifshort func (c *floatConf) Update(newValue []byte) error { c.mutex.Lock() diff --git a/distconf/int.go b/distconf/int.go index 790f0ee..873241e 100644 --- a/distconf/int.go +++ b/distconf/int.go @@ -30,6 +30,7 @@ func (c *Int) Get() int64 { } // Update the content of this config variable to newValue. +// //nolint:ifshort func (c *intConf) Update(newValue []byte) error { c.mutex.Lock() diff --git a/distconf/integration_test.go b/distconf/integration_test.go index 3300082..971eb34 100644 --- a/distconf/integration_test.go +++ b/distconf/integration_test.go @@ -1,15 +1,13 @@ +//go:build integration // +build integration package distconf import ( - "testing" - - "time" - "fmt" - "sync/atomic" + "testing" + "time" "github.com/samuel/go-zookeeper/zk" "github.com/signalfx/golib/v3/nettest" diff --git a/errors/log.go b/errors/log.go index c524458..32f07da 100644 --- a/errors/log.go +++ b/errors/log.go @@ -17,12 +17,12 @@ func LogIfErr(err error, l Loggable, msg string, args ...interface{}) { // DeferLogIfErr will log to l a Printf message if the return value of errCallback is not nil. Intended use // is during a defer function whos return value you don't really care about. // -// func Thing() error { -// f, err := os.Open("/tmp/a") -// if err != nil { return Annotate(err, "Cannot open /tmp/a") } -// defer DeferLogIfErr(f.Close, log, "Cannot close file %s", "/tmp/a") -// // Do something with f -// } +// func Thing() error { +// f, err := os.Open("/tmp/a") +// if err != nil { return Annotate(err, "Cannot open /tmp/a") } +// defer DeferLogIfErr(f.Close, log, "Cannot close file %s", "/tmp/a") +// // Do something with f +// } func DeferLogIfErr(errCallback func() error, l Loggable, msg string, args ...interface{}) { if err := errCallback(); err != nil { l.Printf("%s: %s", err.Error(), fmt.Sprintf(msg, args...)) @@ -37,7 +37,7 @@ func PanicIfErr(err error, msg string, args ...interface{}) { } // PanicIfErrWrite is similar to PanicIfErr, but works well with io results that return integer+err -func PanicIfErrWrite(numWritten int, err error) { +func PanicIfErrWrite(_ int, err error) { if err != nil { panic(fmt.Sprintf("Write err: %s", err.Error())) } diff --git a/errors/matcher.go b/errors/matcher.go index ce6c23b..f86e7fd 100644 --- a/errors/matcher.go +++ b/errors/matcher.go @@ -15,10 +15,10 @@ type Matcher interface { // Matches is used to wrap the Cause() and is similar to something like: // -// f, err := do_something() -// if Matches(err, os.IsTimeout) { -// // It was a timeout error somewhere... -// } +// f, err := do_something() +// if Matches(err, os.IsTimeout) { +// // It was a timeout error somewhere... +// } func Matches(err error, f func(error) bool) bool { return MatchesI(err, MatcherFunc(f)) } diff --git a/log/counter.go b/log/counter.go index 0b48145..2ba5406 100644 --- a/log/counter.go +++ b/log/counter.go @@ -10,7 +10,7 @@ type Counter struct { var _ Logger = &Counter{} // Log increments Count -func (c *Counter) Log(keyvals ...interface{}) { +func (c *Counter) Log(_ ...interface{}) { atomic.AddInt64(&c.Count, 1) } diff --git a/log/kit_test.go b/log/kit_test.go index 69834fa..e265c8e 100644 --- a/log/kit_test.go +++ b/log/kit_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "testing" - "github.com/go-kit/kit/log" + "github.com/go-kit/log" . "github.com/smartystreets/goconvey/convey" ) diff --git a/log/kitnop_logger_test.go b/log/kitnop_logger_test.go index 88ec7c5..5390df7 100644 --- a/log/kitnop_logger_test.go +++ b/log/kitnop_logger_test.go @@ -6,7 +6,7 @@ import ( "github.com/signalfx/golib/v3/log" ) -func TestNopLogger(t *testing.T) { +func TestNopLogger(_ *testing.T) { logger := log.Discard logger.Log("abc", 123) log.NewContext(logger).With("def", "ghi").Log() diff --git a/log/nop.go b/log/nop.go index 6a75dd5..1ee4367 100644 --- a/log/nop.go +++ b/log/nop.go @@ -6,7 +6,7 @@ type nop struct{} var Discard ErrorHandlingDisableableLogger = nop{} // Log does nothing -func (n nop) Log(keyvals ...interface{}) { +func (n nop) Log(_ ...interface{}) { //nolint return } diff --git a/logsink/logsink_test.go b/logsink/logsink_test.go index a362e21..d1e53a7 100644 --- a/logsink/logsink_test.go +++ b/logsink/logsink_test.go @@ -13,7 +13,7 @@ type end struct { count int64 } -func (e *end) AddLogs(ctx context.Context, logs []*Log) error { +func (e *end) AddLogs(_ context.Context, _ []*Log) error { atomic.AddInt64(&e.count, 1) return nil } diff --git a/metadata/aws/ec2metadata/ec2_test.go b/metadata/aws/ec2metadata/ec2_test.go index b315fbf..cc5e821 100644 --- a/metadata/aws/ec2metadata/ec2_test.go +++ b/metadata/aws/ec2metadata/ec2_test.go @@ -14,7 +14,7 @@ type requestHandler struct { response string } -func (rh *requestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { +func (rh *requestHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request) { fmt.Fprintf(w, rh.response) } diff --git a/metadata/hostmetadata/host-not-linux.go b/metadata/hostmetadata/host-not-linux.go index 5624d2d..08e1124 100644 --- a/metadata/hostmetadata/host-not-linux.go +++ b/metadata/hostmetadata/host-not-linux.go @@ -3,10 +3,10 @@ package hostmetadata -func fillPlatformSpecificOSData(info *OS) error { +func fillPlatformSpecificOSData(_ *OS) error { return nil } -func fillPlatformSpecificCPUData(info *CPU) error { +func fillPlatformSpecificCPUData(_ *CPU) error { return nil } diff --git a/sfxclient/cumulativebucket_test.go b/sfxclient/cumulativebucket_test.go index 617cd9b..82787fa 100644 --- a/sfxclient/cumulativebucket_test.go +++ b/sfxclient/cumulativebucket_test.go @@ -20,7 +20,7 @@ func dpNamed(name string, dps []*datapoint.Datapoint) *datapoint.Datapoint { return nil } -func TestCumulativeBucketThreadRaces(t *testing.T) { +func TestCumulativeBucketThreadRaces(_ *testing.T) { cb := &CumulativeBucket{ MetricName: "mname", Dimensions: map[string]string{"type": "dev"}, diff --git a/sfxclient/httpsink.go b/sfxclient/httpsink.go index b487e02..bc1a2a9 100644 --- a/sfxclient/httpsink.go +++ b/sfxclient/httpsink.go @@ -195,6 +195,7 @@ func (h *HTTPSink) doBottom(ctx context.Context, f func() (io.Reader, bool, erro req.Header.Set(k, v) } h.setHeadersOnBottom(ctx, req, contentType, compressed) + // nolint:bodyclose resp, err := h.Client.Do(req) if err != nil { // According to docs, resp can be ignored since err is non-nil, so we diff --git a/sfxclient/multitokensink.go b/sfxclient/multitokensink.go index 35b22da..fc55c3a 100644 --- a/sfxclient/multitokensink.go +++ b/sfxclient/multitokensink.go @@ -644,6 +644,7 @@ func (a *AsyncMultiTokenSink) getChannel(input string, size int) (workerID int64 } // AddDatapointsWithToken emits a list of datapoints using a supplied token +// //nolint:dupl func (a *AsyncMultiTokenSink) AddDatapointsWithToken(token string, datapoints []*datapoint.Datapoint) (err error) { var channelID int64 @@ -685,6 +686,7 @@ func (a *AsyncMultiTokenSink) AddDatapoints(ctx context.Context, datapoints []*d } // AddEventsWithToken emits a list of events using a supplied token +// //nolint:dupl func (a *AsyncMultiTokenSink) AddEventsWithToken(token string, events []*event.Event) (err error) { var channelID int64 @@ -725,6 +727,7 @@ func (a *AsyncMultiTokenSink) AddEvents(ctx context.Context, events []*event.Eve } // AddSpansWithToken emits a list of events using a supplied token +// //nolint:dupl func (a *AsyncMultiTokenSink) AddSpansWithToken(token string, spans []*trace.Span) (err error) { var channelID int64 diff --git a/sfxclient/multitokensink_test.go b/sfxclient/multitokensink_test.go index 5e1a30f..6a981ed 100644 --- a/sfxclient/multitokensink_test.go +++ b/sfxclient/multitokensink_test.go @@ -71,7 +71,7 @@ func TestAsyncMultiTokenSinkClose(t *testing.T) { }) } -func AddDatapointsGetError(ctx context.Context, dps []*datapoint.Datapoint) (err error) { +func AddDatapointsGetError(_ context.Context, _ []*datapoint.Datapoint) (err error) { err = &SFXAPIError{ StatusCode: http.StatusRequestTimeout, ResponseBody: "HELLO", @@ -79,11 +79,11 @@ func AddDatapointsGetError(ctx context.Context, dps []*datapoint.Datapoint) (err return } -func AddDatapointsGetSuccess(ctx context.Context, dps []*datapoint.Datapoint) (err error) { +func AddDatapointsGetSuccess(_ context.Context, _ []*datapoint.Datapoint) (err error) { return } -func AddEventsGetError(ctx context.Context, evs []*event.Event) (err error) { +func AddEventsGetError(_ context.Context, _ []*event.Event) (err error) { err = &SFXAPIError{ StatusCode: http.StatusRequestTimeout, ResponseBody: "HELLO", @@ -91,11 +91,11 @@ func AddEventsGetError(ctx context.Context, evs []*event.Event) (err error) { return } -func AddEventsGetSuccess(ctx context.Context, evs []*event.Event) (err error) { +func AddEventsGetSuccess(_ context.Context, _ []*event.Event) (err error) { return } -func AddSpansGetError(ctx context.Context, evs []*trace.Span) (err error) { +func AddSpansGetError(_ context.Context, _ []*trace.Span) (err error) { err = &SFXAPIError{ StatusCode: http.StatusRequestTimeout, ResponseBody: "HELLO", @@ -103,7 +103,7 @@ func AddSpansGetError(ctx context.Context, evs []*trace.Span) (err error) { return } -func AddSpansGetSuccess(ctx context.Context, evs []*trace.Span) (err error) { +func AddSpansGetSuccess(_ context.Context, _ []*trace.Span) (err error) { return } diff --git a/sfxclient/rollbucket_test.go b/sfxclient/rollbucket_test.go index a3f9b62..15e24d3 100644 --- a/sfxclient/rollbucket_test.go +++ b/sfxclient/rollbucket_test.go @@ -10,7 +10,7 @@ import ( . "github.com/smartystreets/goconvey/convey" ) -func TestRollingBucketThreadRaces(t *testing.T) { +func TestRollingBucketThreadRaces(_ *testing.T) { r := NewRollingBucket("mname", nil) tk := timekeepertest.NewStubClock(time.Now()) r.Timer = tk diff --git a/sfxclient/sfxclient.go b/sfxclient/sfxclient.go index b47d7a9..8c523e9 100644 --- a/sfxclient/sfxclient.go +++ b/sfxclient/sfxclient.go @@ -4,42 +4,44 @@ // ad-hoc. A Scheduler is built on top of this to facility easy management of metrics for multiple // SignalFx reporters at once in more complex libraries. // -// HTTPSink +// # HTTPSink // // The simplest way to send metrics and events to SignalFx is with HTTPSink. The only struct // parameter that needs to be configured is AuthToken. To make it easier to create common // Datapoint objects, wrappers exist for Gauge and Cumulative. An example of sending a hello // world metric would look like this: -// func SendHelloWorld() { -// client := NewHTTPSink() -// client.AuthToken = "ABCDXYZ" -// ctx := context.Background() -// client.AddDatapoints(ctx, []*datapoint.Datapoint{ -// GaugeF("hello.world", nil, 1.0), -// }) -// } // -// Scheduler +// func SendHelloWorld() { +// client := NewHTTPSink() +// client.AuthToken = "ABCDXYZ" +// ctx := context.Background() +// client.AddDatapoints(ctx, []*datapoint.Datapoint{ +// GaugeF("hello.world", nil, 1.0), +// }) +// } +// +// # Scheduler // // To facilitate periodic sending of datapoints to SignalFx, a Scheduler abstraction exists. You // can use this to report custom metrics to SignalFx at some periodic interval. -// type CustomApplication struct { -// queue chan int64 -// } -// func (c *CustomApplication) Datapoints() []*datapoint.Datapoint { -// return []*datapoint.Datapoint { -// sfxclient.Gauge("queue.size", nil, len(queue)), -// } -// } -// func main() { -// scheduler := sfxclient.NewScheduler() -// scheduler.Sink.(*HTTPSink).AuthToken = "ABCD-XYZ" -// app := &CustomApplication{} -// scheduler.AddCallback(app) -// go scheduler.Schedule(context.Background()) -// } // -// RollingBucket and CumulativeBucket +// type CustomApplication struct { +// queue chan int64 +// } +// func (c *CustomApplication) Datapoints() []*datapoint.Datapoint { +// return []*datapoint.Datapoint { +// sfxclient.Gauge("queue.size", nil, len(queue)), +// } +// } +// func main() { +// scheduler := sfxclient.NewScheduler() +// scheduler.Sink.(*HTTPSink).AuthToken = "ABCD-XYZ" +// app := &CustomApplication{} +// scheduler.AddCallback(app) +// go scheduler.Schedule(context.Background()) +// } +// +// # RollingBucket and CumulativeBucket // // Because counting things and calculating percentiles like p99 or median are common operations, // RollingBucket and CumulativeBucket exist to make this easier. They implement the Collector @@ -47,12 +49,14 @@ // // To run integration tests, testing sending to SignalFx with an actual token, create a file named // authinfo.json that has your auth Token, similar to the following -// { -// "AuthToken": "abcdefg" -// } +// +// { +// "AuthToken": "abcdefg" +// } // // Then execute the following: -// go test -v --tags=integration -run TestDatapointSending ./sfxclient/ +// +// go test -v --tags=integration -run TestDatapointSending ./sfxclient/ package sfxclient import ( diff --git a/sfxclient/sfxclient_test.go b/sfxclient/sfxclient_test.go index 2d78d9b..9ff9dcd 100644 --- a/sfxclient/sfxclient_test.go +++ b/sfxclient/sfxclient_test.go @@ -22,7 +22,7 @@ type testSink struct { lastDatapoints chan []*datapoint.Datapoint } -func (t *testSink) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint) (err error) { +func (t *testSink) AddDatapoints(_ context.Context, points []*datapoint.Datapoint) (err error) { t.lastDatapoints <- points return t.retErr } diff --git a/sfxclient/spanfilter/spanfilter.go b/sfxclient/spanfilter/spanfilter.go index 16dd812..213fb4b 100644 --- a/sfxclient/spanfilter/spanfilter.go +++ b/sfxclient/spanfilter/spanfilter.go @@ -11,6 +11,7 @@ import ( // Map is the response we return from ingest wrt our span endpoint // It contains the number of spans that were valid, and a map of string reason to spanIds for each invalid span +// //nolint:errname type Map struct { Valid int `json:"valid"` @@ -80,6 +81,7 @@ func (s *Map) AddValid(i int) { } // FromBytes returns a Map or an error +// //nolint:nilerr func FromBytes(body []byte) *Map { var spanFilter Map diff --git a/timekeeper/timekeeper_test.go b/timekeeper/timekeeper_test.go index 73b6a9b..ca3e1a8 100644 --- a/timekeeper/timekeeper_test.go +++ b/timekeeper/timekeeper_test.go @@ -21,7 +21,7 @@ func TestStop(t *testing.T) { assert.False(t, timer.Stop()) } -func TestAfterClose(t *testing.T) { +func TestAfterClose(_ *testing.T) { timer := time.Millisecond * 10 x := time.NewTimer(timer) x.Stop() diff --git a/trace/format/format.go b/trace/format/format.go index 5140329..dc5d44b 100644 --- a/trace/format/format.go +++ b/trace/format/format.go @@ -6,17 +6,21 @@ import "github.com/signalfx/golib/v3/trace" // which do not adhere to our strict coding standards for test coverage or linting // Span is an alias +// //easyjson:json type Span trace.Span // Trace is an alias +// //easyjson:json type Trace trace.Trace // Endpoint is an alias +// //easyjson:json type Endpoint trace.Endpoint // Annotation is an alias +// //easyjson:json type Annotation trace.Annotation diff --git a/trace/trace_test.go b/trace/trace_test.go index a09af2b..d17fbc5 100644 --- a/trace/trace_test.go +++ b/trace/trace_test.go @@ -13,7 +13,7 @@ type end struct { count int64 } -func (t *end) AddSpans(ctx context.Context, traces []*Span) error { +func (t *end) AddSpans(_ context.Context, _ []*Span) error { atomic.AddInt64(&t.count, 1) return nil } diff --git a/web/reqcounter.go b/web/reqcounter.go index 5d05e22..410f302 100644 --- a/web/reqcounter.go +++ b/web/reqcounter.go @@ -51,7 +51,7 @@ func (m *RequestCounter) ServeHTTP(rw http.ResponseWriter, r *http.Request, next } // GRPCInterceptor makes a unary GRPC interceptor to track requests. -func (m *RequestCounter) GRPCInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { +func (m *RequestCounter) GRPCInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { var resp interface{} var err error