yaml语法
关于yaml语法网络上的资料非常多,不做特别整理。个人理解yaml主要是切片、map等数据结构的一种比较容易解读的格式。
示例
安装yaml解析库
go get gopkg.in/yaml.v2
创建yml文件
HostName: Sunny
Addr: 127.0.0.1
Logs:
- Name: business
LogPath: /home/work/log
Files:
- a.txt
- b.txt
- Name: nginx
LogPath: /home/work/log
Files:
- 1.txt
- 2.txt
解析yaml文件代码
package main
import (