M cmd/tallyard/main.go => cmd/tallyard/main.go +3 -1
@@ 269,12 269,14 @@ func getElections(userID id.UserID) (*election.ElectionsMap, error) {
return nil, fmt.Errorf("couldn't stat elections file: %s", err)
}
+ log.Info("reading elections file...")
jsonBytes, err := ioutil.ReadFile(electionsFname)
if err != nil {
return nil, fmt.Errorf("couldn't read elections file: %s", err)
}
- em, err := election.ReadElectionsMapFrom(jsonBytes, userID, saveElections)
+ log.Info("unmarshalling elections file...")
+ em, err := election.UnmarshalElectionsMapFrom(jsonBytes, userID, saveElections)
if err != nil {
return nil, fmt.Errorf("couldn't read elections map: %s", err)
}
M election/map.go => election/map.go +1 -1
@@ 41,7 41,7 @@ func NewElectionsMap(userID id.UserID, save func(*ElectionsMap)) *ElectionsMap {
}
}
-func ReadElectionsMapFrom(jsonBytes []byte, userID id.UserID, save func(*ElectionsMap)) (*ElectionsMap, error) {
+func UnmarshalElectionsMapFrom(jsonBytes []byte, userID id.UserID, save func(*ElectionsMap)) (*ElectionsMap, error) {
em := &ElectionsMap{}
err := json.Unmarshal(jsonBytes, em)
if err != nil {