| Conditions | 3 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3.0416 |
| Changes | 0 | ||
| 1 | package timeago |
||
| 13 | func parseLangSet(filePath string) (*LangSet, error) { |
||
| 14 | content, err := langsFS.ReadFile(filePath) |
||
| 15 | if err != nil { |
||
| 16 | return nil, fmt.Errorf("could not read language file: %w", err) |
||
| 17 | } |
||
| 18 | |||
| 19 | langSet := &LangSet{} |
||
| 20 | |||
| 21 | if err := json.Unmarshal(content, &langSet); err != nil { |
||
| 22 | return nil, fmt.Errorf("could not unmarshal language file: %w", err) |
||
| 23 | } |
||
| 24 | |||
| 25 | return langSet, nil |
||
| 26 | } |
||
| 42 |