Skip to content

Commit 1c521dc

Browse files
author
Julien Pivotto
committed
Fix marshalling of TLSVersion
Signed-off-by: Julien Pivotto <[email protected]>
1 parent 296ec92 commit 1c521dc

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

config/http_config.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,9 @@ func (tv *TLSVersion) UnmarshalYAML(unmarshal func(interface{}) error) error {
8080
return fmt.Errorf("unknown TLS version: %s", s)
8181
}
8282

83-
func (tv *TLSVersion) MarshalYAML() (interface{}, error) {
84-
if tv == nil || *tv == 0 {
85-
return []byte("null"), nil
86-
}
83+
func (tv TLSVersion) MarshalYAML() (interface{}, error) {
8784
for s, v := range TLSVersions {
88-
if *tv == v {
85+
if tv == v {
8986
return s, nil
9087
}
9188
}
@@ -106,12 +103,9 @@ func (tv *TLSVersion) UnmarshalJSON(data []byte) error {
106103
}
107104

108105
// MarshalJSON implements the json.Marshaler interface for TLSVersion.
109-
func (tv *TLSVersion) MarshalJSON() ([]byte, error) {
110-
if tv == nil || *tv == 0 {
111-
return []byte("null"), nil
112-
}
106+
func (tv TLSVersion) MarshalJSON() ([]byte, error) {
113107
for s, v := range TLSVersions {
114-
if *tv == v {
108+
if tv == v {
115109
return []byte(s), nil
116110
}
117111
}

0 commit comments

Comments
 (0)