MCPcopy Create free account
hub / github.com/CloudyKit/jet / Open

Method Open

loader.go:110–120  ·  view source on GitHub ↗

Open returns a template's contents, or an error if no template was added under this path using Set().

(templatePath string)

Source from the content-addressed store, hash-verified

108
109// Open returns a template's contents, or an error if no template was added under this path using Set().
110func (l *InMemLoader) Open(templatePath string) (io.ReadCloser, error) {
111 templatePath = l.normalize(templatePath)
112 l.lock.RLock()
113 defer l.lock.RUnlock()
114 f, ok := l.files[templatePath]
115 if !ok {
116 return nil, fmt.Errorf("%s does not exist", templatePath)
117 }
118
119 return io.NopCloser(bytes.NewReader(f)), nil
120}
121
122// Exists returns whether or not a template is indexed under this path.
123func (l *InMemLoader) Exists(templatePath string) bool {

Callers

nothing calls this directly

Calls 1

normalizeMethod · 0.95

Tested by

no test coverage detected