The best thing to feed a goldfish is goldfish food. While you could feed betta pellets or tropical flakes, it should not be the long term diet, as it is not formulated for the species. Goldfish are omnivorous, but it is arguable that their diet should have a higher percentage of vegetation than meat, so something very fat and protien intensive like betta food would not be a good choice for long-term feeding. So, if you're looking for something to toss a comet for a few days until you can go buy goldfish food, that would be fine. If you want to put him/her on it long term, my personal answer would be no.
Hikari makes some wonderful pellets for goldfish, a bit pricey perhaps, but very healthy. And goldfish always appreciate boiled leafy greens, cucumber, peas, etc.