If you are like brand spanking new to the hobby, I would recommend considering the type of fish you want first. The first few months are tough with cycling and the unavoidable trial and error with so many details. If you get the smallest tank a fish can handle (which would be a betta in a 5 gallon), you are already at full stock with one fish, meaning the waste in the tank will be maxed for the size. That is not very forgiving when you are getting your sea legs:)
For the smoothest start, you want to ideally cycle with no more than 25% of the tank's potential bioload. This usually doesn't happen, but it makes it so much easier. During cycling, you are growing the various types of bacteria that break down waste and convert it to nitrate. Nitrate is then removed with water changes and is not toxic under 20ppm. Once nitrate is present, you won't have to worry about there every being ammonia or nitrite in the water. If you can make it to that point and you protect your tank from cross-contamination (new fish/plants) by quarantining new fish and sterilizing new plants, you have a very good chance of going years without ever seeing a problem. If you go about it the way most new hobbyists do aka cramming as many fish in there as you can, you could spend years (and mucho dinero) fighting illness and disease.
When you consider types of fish, keep a few things in mind. Is the fish a schooling fish (requiring a minimum number)? How big will the fish get? You can buy 1" goldfish, but in 2 years you could have a beast that is 12-18" long. If you want multiple types, are they compatible? Are you willing to feed them what they require? My axolotl eats live foods. If I travel and need someone to take care of her, it's like radio silence. lol. Does the fish do better with a tall tank or a long tank? Are there going to be a million born into your tank?
For the most part, your average tropical schooling fish needs at least 20-30 gallons per school. Singles need 20 gallons at least unless they stay tiny. A goldfish needs 20-55 gallons. Give yourself some room with gallons or you will be doing a lot of water changes. If you need 20 gallons, get 25 or 30 with adequate filtration.
I do rescue and never recommend a tank smaller than 20 gallons for newbies. If things go wrong in anything smaller, they go wrong fast.
Don't let ammonia or nitrite get over 1ppm while cycling. Prime water conditioner is a good idea:) So are liquid test kits.
If space is an issue in terms of placement, get a tall tank. You have less oxygen but there are species that do better in them, like angels. You can often double your gallons with a taller tank.
As Megan said, skip the goldfish. Here is a monster in a 10 gallon.
Good luck and have fun!