Skip to content

Commit

Permalink
Add hook to confmap.Conf.Marshal
Browse files Browse the repository at this point in the history
  • Loading branch information
djaglowski committed Jun 6, 2024
1 parent b72dd77 commit 6e24246
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions confmap/confmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ func decodeConfig(m *Conf, result any, errorUnused bool, skipTopLevelUnmarshaler
func encoderConfig(rawVal any) *encoder.EncoderConfig {
return &encoder.EncoderConfig{
EncodeHook: mapstructure.ComposeDecodeHookFunc(
encoder.YamlMarshalerHookFunc(),
encoder.TextMarshalerHookFunc(),
marshalerHookFunc(rawVal),
),
Expand Down
2 changes: 2 additions & 0 deletions confmap/internal/mapstructure/encoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (

"github.com/go-viper/mapstructure/v2"
"github.com/stretchr/testify/require"


)

type TestComplexStruct struct {
Expand Down

0 comments on commit 6e24246

Please sign in to comment.