Total Lines | 23 |
Duplicated Lines | 0 % |
Coverage | 83.33% |
Changes | 0 |
1 | package timeago |
||
2 | |||
3 | import ( |
||
4 | "encoding/json" |
||
5 | "log" |
||
6 | |||
7 | "github.com/SerhiiCho/timeago/models" |
||
8 | "github.com/SerhiiCho/timeago/utils" |
||
9 | ) |
||
10 | |||
11 | // Parses json file and unmarshals result into a struct |
||
12 | func parseNeededFile(fileName string) models.Lang { |
||
13 | 1 | content := utils.GetFileContent(fileName) |
|
14 | |||
15 | 1 | var result models.Lang |
|
16 | |||
17 | 1 | err := json.Unmarshal(content, &result) |
|
18 | |||
19 | 1 | if err != nil { |
|
20 | log.Fatal(err) |
||
21 | } |
||
22 | |||
23 | 1 | return result |
|
24 | } |
||
25 |