From a36897595917a9c10406c87a7615821846080cc7 Mon Sep 17 00:00:00 2001 From: 9seconds Date: Thu, 1 Apr 2021 17:08:26 +0300 Subject: [PATCH] Add missed case for ip --- config/type_bytes.go | 4 ++++ config/type_ip_test.go | 1 + 2 files changed, 5 insertions(+) diff --git a/config/type_bytes.go b/config/type_bytes.go index deed46e..4c7d7d6 100644 --- a/config/type_bytes.go +++ b/config/type_bytes.go @@ -38,6 +38,10 @@ func (c TypeBytes) MarshalText() ([]byte, error) { } func (c TypeBytes) String() string { + if c.value == 0 { + return "" + } + return strings.ToLower(c.value.String()) } diff --git a/config/type_ip_test.go b/config/type_ip_test.go index 8b23fc8..85189f4 100644 --- a/config/type_ip_test.go +++ b/config/type_ip_test.go @@ -94,6 +94,7 @@ func (suite *TypeIPTestSuite) TestMarshalOk() { func (suite *TypeIPTestSuite) TestValue() { testStruct := &typeIPTestStruct{} + suite.Empty(testStruct.Value.String()) suite.Nil(testStruct.Value.Value(nil)) suite.Equal("127.1.0.1", testStruct.Value.Value(net.ParseIP("127.1.0.1")).String())