Skip to content

Commit e5e8c37

Browse files
committed
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.
1 parent 5ef1ac5 commit e5e8c37

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

model/metric.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"unicode/utf8"
2525

2626
dto "github.com/prometheus/client_model/go"
27-
"go.yaml.in/yaml/v2"
2827
"google.golang.org/protobuf/proto"
2928
)
3029

@@ -78,14 +77,6 @@ const (
7877
UTF8Validation
7978
)
8079

81-
var _ interface {
82-
yaml.Marshaler
83-
yaml.Unmarshaler
84-
json.Marshaler
85-
json.Unmarshaler
86-
fmt.Stringer
87-
} = new(ValidationScheme)
88-
8980
// String returns the string representation of s.
9081
func (s ValidationScheme) String() string {
9182
switch s {

model/metric_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ import (
2828
"google.golang.org/protobuf/proto"
2929
)
3030

31+
var _ interface {
32+
yaml.Marshaler
33+
yaml.Unmarshaler
34+
json.Marshaler
35+
json.Unmarshaler
36+
fmt.Stringer
37+
} = new(ValidationScheme)
38+
3139
func testMetric(t testing.TB) {
3240
scenarios := []struct {
3341
input LabelSet

0 commit comments

Comments
 (0)