From 234c7ded30ec2e90bf35813deea3e8e323e14753 Mon Sep 17 00:00:00 2001 From: maura fortino Date: Tue, 23 Jan 2024 11:02:44 -0500 Subject: [PATCH] gokit is no longer imported directly --- go.mod | 2 +- mocks_test.go | 86 --------------------------------------------------- 2 files changed, 1 insertion(+), 87 deletions(-) diff --git a/go.mod b/go.mod index 86f26e48..2c668b53 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( emperror.dev/emperror v0.33.0 github.com/alecthomas/kong v0.8.1 github.com/go-chi/chi/v5 v5.0.10 - github.com/go-kit/kit v0.13.0 github.com/gorilla/mux v1.8.1 github.com/goschtalt/goschtalt v0.22.1 github.com/goschtalt/yaml-decoder v0.0.1 @@ -45,6 +44,7 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/go-kit/kit v0.13.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.4.1 // indirect diff --git a/mocks_test.go b/mocks_test.go index 1c748818..6f69a97a 100644 --- a/mocks_test.go +++ b/mocks_test.go @@ -4,9 +4,7 @@ package main import ( "time" - "unicode/utf8" - "github.com/go-kit/kit/metrics" "github.com/stretchr/testify/mock" "github.com/xmidt-org/wrp-go/v3" ) @@ -37,90 +35,6 @@ func (m *mockSenderWrapper) Shutdown(gentle bool) { m.Called(gentle) } -// mockCounter provides the mock implementation of the metrics.Counter object -type mockCounter struct { - mock.Mock -} - -func (m *mockCounter) Add(delta float64) { - m.Called(delta) -} - -func (m *mockCounter) With(labelValues ...string) metrics.Counter { - for _, v := range labelValues { - if !utf8.ValidString(v) { - panic("not UTF-8") - } - } - args := m.Called(labelValues) - return args.Get(0).(metrics.Counter) -} - -// mockGauge provides the mock implementation of the metrics.Counter object -type mockGauge struct { - mock.Mock -} - -func (m *mockGauge) Add(delta float64) { - m.Called(delta) -} - -func (m *mockGauge) Set(value float64) { - // We're setting time values & the ROI seems pretty low with this level - // of validation... - //m.Called(value) -} - -func (m *mockGauge) With(labelValues ...string) metrics.Gauge { - for _, v := range labelValues { - if !utf8.ValidString(v) { - panic("not UTF-8") - } - } - args := m.Called(labelValues) - return args.Get(0).(metrics.Gauge) -} - -// mockHistogram provides the mock implementation of the metrics.Histogram object -type mockHistogram struct { - mock.Mock -} - -func (m *mockHistogram) Observe(value float64) { - m.Called(value) -} - -func (m *mockHistogram) With(labelValues ...string) metrics.Histogram { - for _, v := range labelValues { - if !utf8.ValidString(v) { - panic("not UTF-8") - } - } - m.Called(labelValues) - return m -} - -// mockCaduceusMetricsRegistry provides the mock implementation of the -// CaduceusMetricsRegistry object -type mockCaduceusMetricsRegistry struct { - mock.Mock -} - -func (m *mockCaduceusMetricsRegistry) NewCounter(name string) metrics.Counter { - args := m.Called(name) - return args.Get(0).(metrics.Counter) -} - -func (m *mockCaduceusMetricsRegistry) NewGauge(name string) metrics.Gauge { - args := m.Called(name) - return args.Get(0).(metrics.Gauge) -} - -func (m *mockCaduceusMetricsRegistry) NewHistogram(name string, buckets int) metrics.Histogram { - args := m.Called(name) - return args.Get(0).(metrics.Histogram) -} - // mockTime provides two mock time values func mockTime(one, two time.Time) func() time.Time { var called bool