(format string)
| 101 | } |
| 102 | |
| 103 | func makeTemplate(format string) (*template.Template, error) { |
| 104 | switch format { |
| 105 | case "": |
| 106 | return nil, nil |
| 107 | case formatter.JSONFormatKey: |
| 108 | format = formatter.JSONFormat |
| 109 | } |
| 110 | tmpl, err := templates.Parse(format) |
| 111 | if err != nil { |
| 112 | return tmpl, err |
| 113 | } |
| 114 | // execute the template on an empty message to validate a bad |
| 115 | // template like "{{.badFieldString}}" |
| 116 | return tmpl, tmpl.Execute(io.Discard, &events.Message{}) |
| 117 | } |
| 118 | |
| 119 | // rfc3339NanoFixed is similar to time.RFC3339Nano, except it pads nanoseconds |
| 120 | // zeros to maintain a fixed number of characters |
no outgoing calls
no test coverage detected
searching dependent graphs…