【发布时间】:2023-03-11 05:09:01
【问题描述】:
我有以下需要解析为结构的 yaml。 在 builds 属性中,我在调试时得到了空值,我在这里缺少什么?
我使用“gopkg.in/yaml.v2”
- name: srv
type: java
path: srv
builds:
- name: db
properties:
JBR_CONFIG_RESOURCE_CONFIG: '[META-INF/context.xml:
{"service_name" : "~{h-container}"}]'
TEST2: aaaa
结构是
type Runs struct {
Name string
Type string
Path string `yaml:"path,omitempty"`
Builds []Builds `yaml:”builds,omitempty"`
}
type Builds struct {
Name string `yaml:"name,omitempty"`
Properties Properties `yaml:"properties,omitempty"`
}
type Properties map[string]string
【问题讨论】:
-
请分享您的尝试...