Goldfish do not just eat flakes. In fact Flakes should be the last thing you feed your goldfish. due to bringing an air gulping problem.
To make your goldfish it's healthiest you should feed it vegetables like Peas, carrots, broccoli, cumber, zucchini, lettuce. They can even eat eggs.
You can give your goldfish bananas, watermelon, even oranges.
Blood worms, brine shrimp.
But feed those treats in moderation. Don't be shocked if your goldifsh only eats 1 or 2 out of those things I listed. Goldfish have taste bugs all inside their mouth and around their lips. They like and dislike stuff just like people do.
It's more better to feed your goldfish pellets due to sinking to the bottom and it's healthier for them .