NewExerciseConfig reads exercise metadata from a file in the given directory.
(dir string)
| 22 | |
| 23 | // NewExerciseConfig reads exercise metadata from a file in the given directory. |
| 24 | func NewExerciseConfig(dir string) (*ExerciseConfig, error) { |
| 25 | b, err := os.ReadFile(filepath.Join(dir, configFilepath)) |
| 26 | if err != nil { |
| 27 | return nil, err |
| 28 | } |
| 29 | var config ExerciseConfig |
| 30 | if err := json.Unmarshal(b, &config); err != nil { |
| 31 | return nil, err |
| 32 | } |
| 33 | |
| 34 | return &config, nil |
| 35 | } |
| 36 | |
| 37 | // GetTestFiles finds returns the names of the file(s) that hold unit tests for this exercise, if any |
| 38 | func (c *ExerciseConfig) GetSolutionFiles() ([]string, error) { |
no outgoing calls