| 64 | } |
| 65 | |
| 66 | func loadJSON(path string) (map[string]any, string, error) { |
| 67 | data, err := os.ReadFile(path) |
| 68 | if err != nil { |
| 69 | if os.IsNotExist(err) { |
| 70 | return map[string]any{}, path, nil |
| 71 | } |
| 72 | return nil, path, fmt.Errorf("editorconfig: read %s: %w", path, err) |
| 73 | } |
| 74 | if len(data) == 0 { |
| 75 | return map[string]any{}, path, nil |
| 76 | } |
| 77 | out := map[string]any{} |
| 78 | if err := json.Unmarshal(data, &out); err != nil { |
| 79 | return nil, path, fmt.Errorf("editorconfig: parse %s: %w", path, err) |
| 80 | } |
| 81 | return out, path, nil |
| 82 | } |
| 83 | |
| 84 | func (c *jsonToolConfig) LoadAll() map[string]ScopedConfig { |
| 85 | all := map[string]ScopedConfig{} |