소스 검색

Add missed case for ip

tags/v2.0.0-rc1
9seconds 5 년 전
부모
커밋
a368975959
2개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 4
    0
      config/type_bytes.go
  2. 1
    0
      config/type_ip_test.go

+ 4
- 0
config/type_bytes.go 파일 보기

@@ -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 파일 보기

@@ -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…
취소
저장