Electric fences didn't keep ours in but then we don't have such a great track record with electric fences. Ours are always battery run (solar powered) but we have friends that have mains-run systems and that seems to keep the goats in. We did however have sucess with electric fences keeping them out of things (like the orchard with my lovely new saplings in). They are odd (and loveable) beasts in my opinion and seem to object to having their freedom curtailed. If they have lots of space and just the odd corner is fenced off to them they don't seem to mind so much. They do seem to sense immediately when the battery's not working and they sneak through so we can't afford to get complacent! Ours are French Alpines.
My experience/observation of goats is that if they once learn that they can get to the other side of a fence, then they will forever attempt to do so. Doesn't matter what the fence is made of, if they want out and can find a way, pain isn't a deterrent. I do think electric fences could work, IF they were trained to respect them from a young age, and you would want a sturdy fence not far on the other side to keep them in just in case.
goats are mischivious and daredevils and insanely smart at being insanely stupid.
some people have a hundred goats and only use 4 strand electric wire and no escapees.
some have 2 dozen and have to chase goats at least once a day even with 9 ft fence.
some goats are good and stay in with no want of getting out or even the thought of it.
on the other hand some goats will wait until you get back in the house and go back out the same way they just did and you find them again a half hour later cruising down on your garden.
never use barb wire in my opinion. even just regular fence wire can be bad enough for jumper goats. doe jumps a fence and cuts her udder on the fence and you will understand. especially so when she does it in full milk at the beginning of her freshening.
some goats jump over. make sure your fence is not sagging. they DO test for weak points.
some goats bulldoze underneath. make sure fence is tight to the ground. though i've seen a goat go through a spot that i wouldnt have thought even a piglet woulda tryed to wiggle through.
goats will walk along the fence, leanin on it to scratch. give them stuff to scratch on other then the fence helps. but make sure fence is nice and tight cause they will push it alot.