It is true that goldfish can live for decades if it is well taken care of. The world record for goldfish lifespan was 47 years old (I remember saw that on TV a while ago). A six-year-old goldfish is still a kid.
A 2.5 gallon tank is too small for goldfish. In fact, it is too small for any kind of fish.
As the matter of fact, we recommend a minimal 5 gallon fish tank for even the smallest species of fish since it is the bare minimum to hold stable water conditions. To keep fish, stable water conditions such as water temperature, PH, hardness, etc. are extremely important. Fish can easily get into shock and die from sudden large swing in these water conditions. The more water you have, the more stable you can keep your water conditions at. So 5 gallon is the generally accepted bare minimal. I remember 5~6 years ago I bought my 5 gallon tank for $12. And 10 gallon tanks for $14 each. They are not expensive.
Quote: I just saw that petco has a sale on fish tanks right now: $1 = 1G, and it looks like you have to buy at least a 10G tank, so I assume that means the tank will be $10. Is this a good buy?
If you can get a 10 gallon fish tank for $10, it is a good deal.
However, a 10 gallon fish tank is way too small for even just one goldfish. You need minimal 20 gallon for one fancy goldfish, and 30 gallon for two of them. For common goldfish which will grow much larger, you will need minimal 40 gallon for just one, and 55 gallon for two of them. Goldfish are known as messy fish. They eat a lot, poop a lot, and produce a lot of ammonia which is toxic to themselves. It is why you need larger fish tanks and better filtration for them compare to having a lot of other fish.
With a 10 gallon tank, you should get some small tropical fish instead.
The very important thing is that you need to set everything up first with all the necessary gears including filter, heater, thermometer, etc.
And an aquarium nitrogen cycle is highly recommended before you bring fish home.
Since you have mentioned you are on a low budget. I suggest you to save it up first for (everything) before you get started at all.
If you can live with having only one fish, I recommend get a single betta (Siamese fighting fish). You will still need a minimal 5 gallon tank, along with canopy, filter, heater, thermometer, water conditioner, and fish food).
Some rough estimation for the cost is around $60 minimum for everything save for the canopy which you can use perhaps a piece of foam instead if your budget does not allow. (I did use a piece of foam for my 5 gallon hospital tank).