There are pellets who CAN make your fish float, but that is usually low-quality foods and should NOT be fed to goldfish if you would notice something like it.
Swim bladder problems can also be caused by bacterial infections. But also if your fish spends lots of time by the surface swallowing air when trying to eat flakes. And therefore, you should feed them something easier to catch
But of course, there is specialized goldfish food in flake form, and so, this is also a suitable staple diet.