If the gills have stopped, then my condolenses.
If not, change some water. I use distilled water, or treated faucet water (Got a water treatment from the pet store). You could have ammonia buildup.
You could also have shocked the fish with a temperature change, or not have enough aeration in the water.
I have my goldfish in a 20 gallon tank (he's about 7 inches from lip to end of tail). 10 Gallons is the minimum for smaller goldfish.
If you have a lot of ornaments, your fish may have been pinned. I had one pass because it got stuck, the gills couldn't open.
Hope this helps