MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / ToYaml

Method ToYaml

cli/pkg/docker/compose/yml.go:100–118  ·  view source on GitHub ↗

把结构化对象转换为string

()

Source from the content-addressed store, hash-verified

98
99// 把结构化对象转换为string
100func (c *DockerComposeYml) ToYaml() (result string, err error) {
101 if c == nil {
102 return
103 }
104 if c.IsNil() {
105 return
106 }
107
108 //fmt.Println(c)
109
110 d, err := yaml.Marshal(&c)
111 common.CheckError(err)
112 result = string(d)
113
114 result = strings.ReplaceAll(result, "\\'", "'")
115
116 //result = strings.ReplaceAll(result, "\"", "\\\"") // 文本中包含双引号
117 return result, nil
118}

Callers 6

get.goFile · 0.45
Feedback_FinishFunction · 0.45
Send_WorkspaceInfoFunction · 0.45
hasChangedFunction · 0.45
ExecuteVmStartCmdFunction · 0.45
ExecuteStartCmdFunction · 0.45

Calls 1

IsNilMethod · 0.95

Tested by

no test coverage detected