Add bool case to ToStringE
This commit is contained in:
		
							parent
							
								
									6770a32f65
								
							
						
					
					
						commit
						ee7b3e0353
					
				| @ -40,6 +40,8 @@ func TestToString(t *testing.T) { | |||||||
| 	assert.Equal(t, ToString(template.URL("http://somehost.foo")), "http://somehost.foo") | 	assert.Equal(t, ToString(template.URL("http://somehost.foo")), "http://somehost.foo") | ||||||
| 	assert.Equal(t, ToString(foo), "one more time") | 	assert.Equal(t, ToString(foo), "one more time") | ||||||
| 	assert.Equal(t, ToString(nil), "") | 	assert.Equal(t, ToString(nil), "") | ||||||
|  | 	assert.Equal(t, ToString(true), "true") | ||||||
|  | 	assert.Equal(t, ToString(false), "false") | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type foo struct { | type foo struct { | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								caste.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								caste.go
									
									
									
									
									
								
							| @ -194,6 +194,8 @@ func ToStringE(i interface{}) (string, error) { | |||||||
| 	switch s := i.(type) { | 	switch s := i.(type) { | ||||||
| 	case string: | 	case string: | ||||||
| 		return s, nil | 		return s, nil | ||||||
|  | 	case bool: | ||||||
|  | 		return strconv.FormatBool(s), nil | ||||||
| 	case float64: | 	case float64: | ||||||
| 		return strconv.FormatFloat(i.(float64), 'f', -1, 64), nil | 		return strconv.FormatFloat(i.(float64), 'f', -1, 64), nil | ||||||
| 	case int: | 	case int: | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user