Goldfish will literally eat anything they can fit into their mouths - and some things that they only THINK they can fit in their mouth! They love fruits and veggies, as well as the fish/protien foods. A varied diet is the best for them - just as it is for just about every form of life on this planet.
In this food forum, there are many lists of suggested foods - most of which are great. You can feed a processed food pellet - like ProGold or Hikari or such, or you can feed a gel food you create yourself. I do all of the above. I feed fresh veggies in gel food, on veggie clips and just dropped in. I feed fruits. I feed high protien pellets and spiriliana flakes.
The most important thing I feed in goldfish feeding is to make the food in a form that sinks. Fish that eat on the surface can potentially develop stability problems. If you have floating food - and I have a fair amount of floating food that I really like - make it into a form that sinks. This may mean soaking it before offering it. Or it may mean incorporating it into a sinking gel food.