Selaa lähdekoodia

Add missed case for ip

tags/v2.0.0-rc1
9seconds 5 vuotta sitten
vanhempi
commit
a368975959
2 muutettua tiedostoa jossa 5 lisäystä ja 0 poistoa
  1. 4
    0
      config/type_bytes.go
  2. 1
    0
      config/type_ip_test.go

+ 4
- 0
config/type_bytes.go Näytä tiedosto

@@ -38,6 +38,10 @@ func (c TypeBytes) MarshalText() ([]byte, error) {
38 38
 }
39 39
 
40 40
 func (c TypeBytes) String() string {
41
+	if c.value == 0 {
42
+		return ""
43
+	}
44
+
41 45
 	return strings.ToLower(c.value.String())
42 46
 }
43 47
 

+ 1
- 0
config/type_ip_test.go Näytä tiedosto

@@ -94,6 +94,7 @@ func (suite *TypeIPTestSuite) TestMarshalOk() {
94 94
 
95 95
 func (suite *TypeIPTestSuite) TestValue() {
96 96
 	testStruct := &typeIPTestStruct{}
97
+	suite.Empty(testStruct.Value.String())
97 98
 
98 99
 	suite.Nil(testStruct.Value.Value(nil))
99 100
 	suite.Equal("127.1.0.1", testStruct.Value.Value(net.ParseIP("127.1.0.1")).String())

Loading…
Peruuta
Tallenna