I copied a code from a tutorial which gives me an error:
{{ .Scratch.Add "greetings" (slice "Hello") }}
{{ .Scratch.Add "greetings" (slice "Goodbye") }}
{{ .Scratch.Add "greetings" (slice "Aloha" "Buenos dias") }}
{{ range where .Scratch.Get "greetings" }}
<ol>
<li>
{{ . }}
</li>
</ol>
{{ end }}
Error: <.Scratch.Get>: wrong number of args for Get: want 1 got 0
Debugging 1
{{ .Scratch.Add "greetings" (slice "Hello") }}
{{ .Scratch.Add "greetings" (slice "Goodbye") }}
{{ .Scratch.Add "greetings" (slice "Aloha" "Buenos dias") }}
{{ .Scratch.Get "greetings" }}
prints
[Hello Goodbye Aloha Buenos dias]
Debugging 2
{{ .Scratch.Add "greetings" (slice "Hello") }}
{{ .Scratch.Add "greetings" (slice "Goodbye") }}
{{ .Scratch.Add "greetings" (slice "Aloha" "Buenos dias") }}
{{ range .Scratch.Get "greetings" }}
<ol>
<li>
{{ . }}
</li>
</ol>
{{ end }}
…which prints the correct output. So the tutorial is wrong?