Spackling is a stage that comes after hanging your drywall and Yes, it must be done before you paint the walls. I am guessing these are new dry walls you are talking about. Am I right?
You should have everything done to the wall that you are going to do to it, including extensive cleaning, before painting it. You do not need to 1-coat your walls with spackle (mud) before painting unless there is damage to the smooth wall surface, usually from wallpaper removal, patch-ins, etc.
A new layer of paint will not hide these deeper flaws, Its a little more work when working with textured walls but I feel its worth it.