WriteFile writes the descriptors to a file.
(filename string)
| 192 | |
| 193 | // WriteFile writes the descriptors to a file. |
| 194 | func (m MessageDescriptorMap) WriteFile(filename string) error { |
| 195 | bytes, err := json.MarshalIndent(m, "", " ") |
| 196 | if err != nil { |
| 197 | return err |
| 198 | } |
| 199 | return os.WriteFile(filename, append(bytes, '\n'), 0o644) //nolint:gas |
| 200 | } |
| 201 | |
| 202 | // Define a message. |
| 203 | func (m MessageDescriptorMap) Define(id, message string) *MessageDescriptor { |
no outgoing calls