(config *globalProcessComposeConfig, file *os.File)
| 68 | } |
| 69 | |
| 70 | func writeGlobalProcessComposeJSON(config *globalProcessComposeConfig, file *os.File) error { |
| 71 | // convert config to json using cue |
| 72 | json, err := cuecfg.MarshalJSON(config.Instances) |
| 73 | if err != nil { |
| 74 | return fmt.Errorf("failed to convert config to json: %w", err) |
| 75 | } |
| 76 | |
| 77 | if err := file.Truncate(0); err != nil { |
| 78 | return fmt.Errorf("failed to truncate global config file: %w", err) |
| 79 | } |
| 80 | |
| 81 | if _, err := file.Write(json); err != nil { |
| 82 | return fmt.Errorf("failed to write global config file: %w", err) |
| 83 | } |
| 84 | |
| 85 | return nil |
| 86 | } |
| 87 | |
| 88 | func openGlobalConfigFile() (*os.File, error) { |
| 89 | configPath, err := globalProcessComposeJSONPath() |
no test coverage detected