b1b4dbb0 by astaxie

fix the nil judge

1 parent 77e1f26d
...@@ -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) {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!