Bettas being warm water fish, and goldfish being cold water fish is bad. Keeping both of them in a TEN gallon tank is worse. Given the right conditions, goldfish will keep growing until one goldfish is about a foot long, and will need TWENTY gallons of water at the bare minimum. Though it's body won't out grow your 10 gallon tank, it's intestines will. Eventually, the body won't be big enough to hold guts the size of a healthy normal sized adult goldfish, and the goldfish will die a slow and painful death. D: That is why goldfish never last long in the 'goldfish bowls'.
Also, goldfish give off a huge amount of waste. You'll probably need two or even three filters to properly take care of all the waste that one goldfish will produce. If in the long run, you want the two fish to be healthy, you will seperate them, and have the goldfish in a twenty gallon tank, or in a pond, and the betta in the ten gallon tank that is heated, possibly with some other SMALL TROPICAL fish.