For anyone who gets a sick goldfish like this, test the water for ammonia, nitrite, nitrate and pH, and make sure they are all good. Then do a 75% water change and gravel clean the substrate every day for a week. Make sure any new water is free of chlorine/ chloramine before it's added to the tank.
If there's no improvement after a couple of water changes, you can add some rock salt at a dose of 2 heaped tablespoons per 20 litres of water. Keep the salt in there for a couple of weeks.
This is basic first aid for any freshwater fish and will usually buy you some time to get help.