Hi,
It would be very similar to defining a function in python, just following Golang syntax. You'd probably also have to recompile mumax to get it to recognize the function. I don't think you would need to run mumax using a go input file (this can be done, but it is very complicated and not well documented). You'd just need the extra function and recompiling mumax, and otherwise you can run mumax as normal.
Unfortunately, I don't have a good example, I haven't had to do it myself yet. A good starting spot might be to look at the mumax source code, and look at the sinc function or the heaviside function (they are defined in the stdlib.go file). They were defined by mumax, they're not standard mathematical functions in Golangs math library. Your custom function would be similar. Yours would be a bit more complicated than that since you would need some sort of sensible interpolation scheme. But otherwise you should be able to pretty much copy the sinc function nearly exactly, in terms of formatting, where to place it in the source code, etc.
That said, chopping it up is almost certainly going to be easier. I would only bother with the interpolation function if you have no feasible alternative.
Best,
Josh L.