Also, I am not a regular Go programmer. I've started doing challenges in Go just for my own amusement, but I would definitely not assume that whatever solution I come up with is optimal 😅
Just a small advert: you should defer f.Close() after check if there's an error.
Also: Check out my GitHub Repo.
Oh, if this were production code I totally would, but I'm really only building these solutions to solve the problem, and not looking to make them infinitely extensible.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.