DumpTranslationKeyMap writes the translation map to a json file called github-mcp-server-config.json
(translationKeyMap map[string]string)
| 58 | |
| 59 | // DumpTranslationKeyMap writes the translation map to a json file called github-mcp-server-config.json |
| 60 | func DumpTranslationKeyMap(translationKeyMap map[string]string) error { |
| 61 | file, err := os.Create("github-mcp-server-config.json") |
| 62 | if err != nil { |
| 63 | return fmt.Errorf("error creating file: %v", err) |
| 64 | } |
| 65 | defer func() { _ = file.Close() }() |
| 66 | |
| 67 | // marshal the map to json |
| 68 | jsonData, err := json.MarshalIndent(translationKeyMap, "", " ") |
| 69 | if err != nil { |
| 70 | return fmt.Errorf("error marshaling map to JSON: %v", err) |
| 71 | } |
| 72 | |
| 73 | // write the json data to the file |
| 74 | if _, err := file.Write(jsonData); err != nil { |
| 75 | return fmt.Errorf("error writing to file: %v", err) |
| 76 | } |
| 77 | |
| 78 | return nil |
| 79 | } |
no test coverage detected