去模板和标签字

问题描述 投票:0回答:1

我想使用go模板语法在字符串中插入制表符。

基本上我的尝试是这样的。

{{ .title }}\t{{ .description }}

现在打印出来的是"\t",而不是一个实际的制表符。

谢谢你的帮助!

go grafana go-templates
1个回答
3
投票

替换 \t 用制表符或使用 {{"\t"}}.

在操场上运行它.

(ht to icza for simplification in edit)

© www.soinside.com 2019 - 2024. All rights reserved.