MCPcopy Create free account
hub / github.com/exercism/cli / NewExerciseMetadata

Function NewExerciseMetadata

workspace/exercise_metadata.go:32–43  ·  view source on GitHub ↗

NewExerciseMetadata reads exercise metadata from a file in the given directory.

(dir string)

Source from the content-addressed store, hash-verified

30
31// NewExerciseMetadata reads exercise metadata from a file in the given directory.
32func NewExerciseMetadata(dir string) (*ExerciseMetadata, error) {
33 b, err := os.ReadFile(filepath.Join(dir, metadataFilepath))
34 if err != nil {
35 return nil, err
36 }
37 var metadata ExerciseMetadata
38 if err := json.Unmarshal(b, &metadata); err != nil {
39 return nil, err
40 }
41 metadata.Dir = dir
42 return &metadata, nil
43}
44
45// Suffix is the serial numeric value appended to an exercise directory.
46// This is appended to avoid name conflicts, and does not indicate a particular

Callers 5

metadataMethod · 0.92
getTrackFunction · 0.92
open.goFile · 0.92
GetTestCommandMethod · 0.85
TestExerciseMetadataFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestExerciseMetadataFunction · 0.68