RewriteConfig rewrite config file path
(configFilePath string, allConfig *AllConfig)
| 115 | |
| 116 | // RewriteConfig rewrite config file path |
| 117 | func RewriteConfig(configFilePath string, allConfig *AllConfig) error { |
| 118 | buf := bytes.Buffer{} |
| 119 | enc := yaml.NewEncoder(&buf) |
| 120 | defer func() { |
| 121 | _ = enc.Close() |
| 122 | }() |
| 123 | enc.SetIndent(2) |
| 124 | if err := enc.Encode(allConfig); err != nil { |
| 125 | return err |
| 126 | } |
| 127 | return writer.ReplaceFile(configFilePath, buf.String()) |
| 128 | } |
no test coverage detected