Skip to content

Commit 187dc84

Browse files
committed
Make the default cache tag a constant
1 parent ef9413b commit 187dc84

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cache.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ import (
1212
"sync"
1313
)
1414

15+
const defaultCacheTag = "schema"
16+
1517
var errInvalidPath = errors.New("schema: invalid path")
1618

1719
// newCache returns a new cache.
1820
func newCache() *cache {
1921
c := cache{
2022
m: make(map[reflect.Type]*structInfo),
2123
regconv: make(map[reflect.Type]Converter),
22-
tag: "schema",
24+
tag: defaultCacheTag,
2325
}
2426
return &c
2527
}

encoder_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,9 +525,7 @@ func TestRegisterEncoderWithPtrType(t *testing.T) {
525525
}
526526

527527
func TestNewEncoderWithOptions(t *testing.T) {
528-
defaultEncoder := NewEncoder()
529-
530-
aliasTag := defaultEncoder.cache.tag + "-test"
528+
aliasTag := defaultCacheTag + "-test"
531529
encoder := NewEncoder(
532530
WithAliasTagEncoderOpt(aliasTag),
533531
)

0 commit comments

Comments
 (0)