MCPcopy Create free account
hub / github.com/docker/cli / makeTemplate

Function makeTemplate

cli/command/system/events.go:103–117  ·  view source on GitHub ↗
(format string)

Source from the content-addressed store, hash-verified

101}
102
103func 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

Callers 1

runEventsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…