Choosing between a function or a method? That look like a simple question.
Go defines a method as a function with a receiver. What does it mean?
How choose carefully between the two? Let’s dive into this deeper than it seems topic.
For a project I’m working on, I have to manipulate a lot of slices. One of those manipulations is a simple function that creates a new slice filled with the same repeated value.
Being still influenced by other languages I worked with previously, I decided to create a function that I could use on any type.