Get down the pet shop and buy some swim bladder treatment ASAP, I recommend the No 13 swim bladder treatment from a company I can't remember the name of.
and then work out why your fish has swim bladder problems/infection.
1: do you have a filter? they need filters they produce more piss then any other fish, you need a filter, you need at least a 20 litre tank for the thing, you need to change half the water once a week and clean it out fully every month.
2: are you using water conditioner?, tap water is not safe you need tap water conditioner and depending on the filter type bio top ups to replace the good bacteria taken out when you change the water, Aquasafe by intra pet contains both, there are many others.
3: what are you feeding the thing, can't go giving it flakes or pellets all the time they need some fresh stuff in there diet like blood worms, brine srimps etc you can buy them in packets or simply tiny bits of cooked fresh peas, take any uneaten bits out the tank.
4: where is the tank, never keep on in the kitchen and never keep one in direct sunlight.
Goldfish live a long time when looked after properly, they are harder to keep then tropical fish, yet people still insist on thinking they are perfect first pets.
A common goldfish lives up to 30 years.
A Comet tail type lives up to 18 years.
A Fantail/ryukin lives up to 12 years.
A More/bubble eye lives up to 7 years.
Basic rule of thumb the more fancy and less like a normal carp shape it is the shorter the expected life span.