func readHistoryFile()

in lib/ec2macosinit/instancehistory.go [81:95]


func readHistoryFile(file string) (history History, err error) {
	// Read file
	historyBytes, err := os.ReadFile(file)
	if err != nil {
		return History{}, fmt.Errorf("ec2macosinit: error reading config file located at %s: %w", file, err)
	}

	// Unmarshal to struct
	err = json.Unmarshal(historyBytes, &history)
	if err != nil {
		return History{}, HistoryError{err: err}
	}

	return history, nil
}