Total Lines | 25 |
Duplicated Lines | 0 % |
Coverage | 83.33% |
Changes | 0 |
1 | package timeago |
||
2 | |||
3 | import ( |
||
4 | "encoding/json" |
||
5 | "fmt" |
||
6 | "time" |
||
7 | ) |
||
8 | |||
9 | func unixToTime(userDate int) time.Time { |
||
10 | return time.Unix(int64(userDate), 0) |
||
11 | } |
||
12 | |||
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 |