The answer is, of course: it depends. There are times when performance is king and times when readability might be more important. Give this a read sometime. And keep in mind that Go is, in my experience, much faster than most other garbage-collected languages (other people have experienced this as well). Now imagine you’re running a simulation that requires you to buy time on expensive hardware and the simulation requires a week to run. If you could improve performance by even 10% do you think that would matter?
So, yes, performance matters. If it didn’t, Go probably wouldn’t exist in the first place. That having been said, for something like this that is completely synthetic and will never see production, take your pick. Don’t prematurely optimize things if you don’t need to.
Finally, I could be in the minority here but I think the imperative approach in this case is easier to read/grok than using recursion. But each to their own.