From dfaf554a74ccbf20e6964501682a8063dd5291bf Mon Sep 17 00:00:00 2001 From: Michael Siegenthaler Date: Sat, 6 Sep 2025 11:47:48 -0700 Subject: [PATCH] Move interface assertions to a test file This is the only dependency on YAML in the model package. Moving it to the tests avoids pulling a dependency into the main module of applications that don't otherwise use YAML. Signed-off-by: Michael Siegenthaler --- model/metric.go | 9 --------- model/metric_test.go | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/model/metric.go b/model/metric.go index 3feebf32..429a0dab 100644 --- a/model/metric.go +++ b/model/metric.go @@ -24,7 +24,6 @@ import ( "unicode/utf8" dto "github.com/prometheus/client_model/go" - "go.yaml.in/yaml/v2" "google.golang.org/protobuf/proto" ) @@ -78,14 +77,6 @@ const ( UTF8Validation ) -var _ interface { - yaml.Marshaler - yaml.Unmarshaler - json.Marshaler - json.Unmarshaler - fmt.Stringer -} = new(ValidationScheme) - // String returns the string representation of s. func (s ValidationScheme) String() string { switch s { diff --git a/model/metric_test.go b/model/metric_test.go index e3573ed2..9b841b29 100644 --- a/model/metric_test.go +++ b/model/metric_test.go @@ -28,6 +28,14 @@ import ( "google.golang.org/protobuf/proto" ) +var _ interface { + yaml.Marshaler + yaml.Unmarshaler + json.Marshaler + json.Unmarshaler + fmt.Stringer +} = new(ValidationScheme) + func testMetric(t testing.TB) { scenarios := []struct { input LabelSet