Pipelines
Updated: September 28, 2024
Pipelines in go are used for…
{{.Title}} // Data Command (injecting data into a template)
{{template "content"}} // function (template) with one arg ("content")
type Data struct {}
func (d Data) SayMsg(m string) string {
return m
}
{{.SayMsg "Hello World!"}} // Method with one arg
{{ command1 command 2 | command3 }} // Pass result of prev cmd as last arg of next cmd
Demo
{{- "some string" -}} // the - removes whitespace on an output before and after respectively