I would not put more than two fancy goldfish in a 30g; the waste output is the issue more than the size, and even with good filtration it may be hard to maintain adequate water quality. Goldfish are also quite active and enjoy plenty of swimming room, so two 6-8" fish in a 30g is really the max you could get while still maintaining a good quality of life for them.
As for commons, since it came up... Common and other single-tail goldfish should not be kept in anything but a pond at maturity; they have the potential to reach 24" in length, and unless stunted will undoubtedly reach at least 1ft. The 20g per goldfish rule, thus, does not apply to them - unless you want a fish whose tail sticks out of the lid for him to fit! From what I've heard, you need anywhere from 3-5 gallons per inch for commons, so the minimum tank size for one mature common given the growth potential, imho, is 75g. Obviously they can be grown out in smaller, but because they are a social species, they are best off in ponds upon reaching any reasonable size.
I personally can attest to how insufficient aquariums are for commons; I have two three-year-old commons myself. They are each about 9-10" in length and seem to grow every day, and live together in a 75g. Even with massive over filtration (think about 10x's what you'd need for two tropicals of that size in the same tank), I am searching for a cheap pond so they can each have a good 150g per fish.