I'm not sure about goldfish, but we have gone through a few fish due to similar circumstances.

What we have found is that the fish just can not stand any alkalinity in the water. They tolerate acid better. Cheap food from supermarkets is terrible and just sits at the bottom of the tank and makes the fish sick. When they show signs of being not themselves, we take them out and put them in a container with a bit of epsom salts in it (not sure of the ratio, but you could google it) and we do a 25% clean out when a fish shows signs of being unwell.

Good luck.