To run this application, navigate to its root directory and execute the following command: go run .
The goal is to make the solution as extensible and flexible as possible, even beyond common sense. Here’s what it should be:
Read multiple files, each containing JSON object of the following structure, ending with a newline like this: {"message":"test","timestamp":"2023-03-15T21:54:42.123Z"}
Parse each line. Wait for a random number of seconds (less than 5). Write the parsed data to the console and the corresponding output file.
If parsing or writing fails, gracefully stop all goroutines and print the error to the terminal: Important: Panic, os.Exit, etc., are forbidden. All successfully processed lines prior to the error will be saved to the appropriate file and displayed in the terminal.
Execute steps 1, 2, and 3 concurrently to maximize efficiency.