isPrimitive is true if the given kind matches a goa primitive type.
(t reflect.Type)
| 894 | |
| 895 | // isPrimitive is true if the given kind matches a goa primitive type. |
| 896 | func isPrimitive(t reflect.Type) bool { |
| 897 | switch t.Kind() { |
| 898 | case reflect.Bool: |
| 899 | fallthrough |
| 900 | case reflect.Int: |
| 901 | fallthrough |
| 902 | case reflect.Int32: |
| 903 | fallthrough |
| 904 | case reflect.Int64: |
| 905 | fallthrough |
| 906 | case reflect.Uint: |
| 907 | fallthrough |
| 908 | case reflect.Uint32: |
| 909 | fallthrough |
| 910 | case reflect.Uint64: |
| 911 | fallthrough |
| 912 | case reflect.Float32: |
| 913 | fallthrough |
| 914 | case reflect.Float64: |
| 915 | fallthrough |
| 916 | case reflect.Interface: |
| 917 | fallthrough |
| 918 | case reflect.String: |
| 919 | return true |
| 920 | case reflect.Slice: |
| 921 | e := t.Elem() |
| 922 | if e.Kind() == reflect.Uint8 { |
| 923 | return true |
| 924 | } |
| 925 | return false |
| 926 | default: |
| 927 | return false |
| 928 | } |
| 929 | } |
| 930 | |
| 931 | type compRec struct { |
| 932 | path string |
no test coverage detected