package cv import ( "os" "fmt" "encoding/json" ) // NewCV returns a new CV value from the given JSON file. func NewCV(path string) (CV, error) { file, err := os.Open(path) if err != nil { return CV{}, fmt.Errorf("unable to open %s; %w", path, err) } decoder := json.NewDecoder(file) var c CV if err = decoder.Decode(&c); err != nil { return CV{}, fmt.Errorf("unable to decode JSON data; %w", err) } return c, nil }