You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by dgarlitt March 15, 2023
I was following the documentation here to learn how to use --output-map with external templates. I created the out.t file as indicated:
out.t
{{-/* .in may contain a directory name - we want to preserve that */-}}
{{ $f:=filepath.Base .in-}}
out/{{ .in| strings.ReplaceAll $f (index .filemap $f) }}.out
as well as the filemap.json file:
filemap.json
{ "eins.txt": "uno", "deux.txt": "dos" }
and stored my templates in the in directory. However, when I run the command in the example:
ERR error="failed to gather templates for rendering: failed to render outputMap with ctx &map[ctx:0xc000a4e1b0 filemap:map[deux.txt:dos eins.txt:uno] in:deux.txt] and inPath deux.txt: failed to render template <OutputMap>: template: out:2:7: executing \"out\" at <.in>: nil data; no entry for key \"in\""
I am sure that I have a basic misunderstanding. Can someone please help point me in the right direction?
The text was updated successfully, but these errors were encountered:
Hi @dgarlitt, thanks for reporting this - it looks like this is at least a bug in the documentation, and likely also a bug with how nested templates interact with output maps.
I tested this with various gomplate versions all the way back to v3.4.0 (when the output-map feature was added), and I get the same error too.
Discussed in #1676
Originally posted by dgarlitt March 15, 2023
I was following the documentation here to learn how to use
--output-map
with external templates. I created theout.t
file as indicated:out.t
as well as the filemap.json file:
filemap.json
and stored my templates in the
in
directory. However, when I run the command in the example:gomplate -t out=out.t -c filemap.json --input-dir=in --output-map='{{ template "out" }}'
I get the following error:
ERR error="failed to gather templates for rendering: failed to render outputMap with ctx &map[ctx:0xc000a4e1b0 filemap:map[deux.txt:dos eins.txt:uno] in:deux.txt] and inPath deux.txt: failed to render template <OutputMap>: template: out:2:7: executing \"out\" at <.in>: nil data; no entry for key \"in\""
I am sure that I have a basic misunderstanding. Can someone please help point me in the right direction?
The text was updated successfully, but these errors were encountered: