(funcName string, entries interface{})
| 24 | ) |
| 25 | |
| 26 | func getArrayValues(funcName string, entries interface{}) (*reflect.Value, error) { |
| 27 | entriesVal := reflect.ValueOf(entries) |
| 28 | |
| 29 | kind := entriesVal.Kind() |
| 30 | |
| 31 | if kind == reflect.Ptr { |
| 32 | entriesVal = entriesVal.Elem() |
| 33 | kind = entriesVal.Kind() |
| 34 | } |
| 35 | |
| 36 | switch kind { |
| 37 | case reflect.Array, reflect.Slice: |
| 38 | break |
| 39 | default: |
| 40 | return nil, fmt.Errorf("must pass an array or slice to '%v'; received %v; kind %v", funcName, entries, kind) |
| 41 | } |
| 42 | return &entriesVal, nil |
| 43 | } |
| 44 | |
| 45 | func newTemplate(name string) *template.Template { |
| 46 | tmpl := template.New(name) |
no outgoing calls