MCPcopy
hub / github.com/github/github-mcp-server / DumpTranslationKeyMap

Function DumpTranslationKeyMap

pkg/translations/translations.go:60–79  ·  view source on GitHub ↗

DumpTranslationKeyMap writes the translation map to a json file called github-mcp-server-config.json

(translationKeyMap map[string]string)

Source from the content-addressed store, hash-verified

58
59// DumpTranslationKeyMap writes the translation map to a json file called github-mcp-server-config.json
60func 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}

Callers 1

TranslationHelperFunction · 0.85

Calls 2

CloseMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected