Closed jbielick closed 4 years ago
Well done, can’t believe I did t think of this approach.
@mperham one note: I knowingly didn't address config files that are missing a trailing newline. To protect against that I could add one line:
fileBytes = append(fileBytes, "\n"...)
Would you like a PR for that line?
Yeah we’ll want that.
Purpose
Fixes #191
Approach
Concatenate byte slices of each config file and unmarshal at the end of reading all configs.
Issue
Subsequent unmarshal was overwriting keys in the cumulative hash of configuration.
Considerations
Appending bytes from each file and unmarshaling at the end prevents this overwriting from occurring at the cost of not knowing which config has an error if the cumulative contents do not parse correctly.