fix the nil judge
Showing
2 changed files
with
2 additions
and
2 deletions
| ... | @@ -22,7 +22,7 @@ First you must import it | ... | @@ -22,7 +22,7 @@ First you must import it |
| 22 | 22 | ||
| 23 | Then init a Cache (example with memory adapter) | 23 | Then init a Cache (example with memory adapter) |
| 24 | 24 | ||
| 25 | bm, err := NewCache("memory", `{"interval":60}`) | 25 | bm, err := cache.NewCache("memory", `{"interval":60}`) |
| 26 | 26 | ||
| 27 | Use it like this: | 27 | Use it like this: |
| 28 | 28 | ... | ... |
| ... | @@ -131,7 +131,7 @@ func getFieldType(val reflect.Value) (ft int, err error) { | ... | @@ -131,7 +131,7 @@ func getFieldType(val reflect.Value) (ft int, err error) { |
| 131 | case reflect.String: | 131 | case reflect.String: |
| 132 | ft = TypeCharField | 132 | ft = TypeCharField |
| 133 | default: | 133 | default: |
| 134 | if elm == nil { | 134 | if elm.IsNil() { |
| 135 | panic(fmt.Errorf("%s is nil pointer, may be miss setting tag", val)) | 135 | panic(fmt.Errorf("%s is nil pointer, may be miss setting tag", val)) |
| 136 | } | 136 | } |
| 137 | switch elm.Interface().(type) { | 137 | switch elm.Interface().(type) { | ... | ... |
-
Please register or sign in to post a comment