MCPcopy Create free account
hub / github.com/DoNewsCode/core / write

Method write

config/module.go:305–327  ·  view source on GitHub ↗
(file *os.File, configs []ExportedConfig, confMap map[string]interface{})

Source from the content-addressed store, hash-verified

303}
304
305func (r rewriteHandler) write(file *os.File, configs []ExportedConfig, confMap map[string]interface{}) error {
306 if confMap == nil {
307 confMap = make(map[string]interface{})
308 }
309 for _, exportedConfig := range configs {
310 for k := range exportedConfig.Data {
311 if _, ok := confMap[k]; ok {
312 continue
313 }
314 confMap[k] = exportedConfig.Data[k]
315 }
316 }
317 file.Seek(0, 0)
318 data, err := r.codec.Marshal(confMap)
319 if err != nil {
320 return err
321 }
322 if _, err := file.Write(data); err != nil {
323 return err
324 }
325 fmt.Fprintln(file)
326 return err
327}

Callers

nothing calls this directly

Calls 2

MarshalMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected