jsonnet: 又一种配置文件
一个不错的配置文件格式
安装
brew install go-jsonnet
示例

{
array: [1, 2] + [3],
math: (4 + 5) / 3 * 2,
format: 'Hello, I am %s' % 'alei',
concat: 'Hello, ' + 'I am alei',
slice: [1,2,3,4][1:3],
'list comprehension': [x * x for x in [1,2,3,4]],
condition:
if 2 > 1 then
'true'
else
'false',
}
编译出的结果
$
jsonnet test.jsonnet
{
"array": [
1,
2,
3
],
"concat": "Hello, I am alei",
"condition": "true",
"format": "Hello, I am alei",
"list comprehension": [
1,
4,
9,
16
],
"math": 6,
"slice": [
2,
3
]
}