if we did go back to a gold standard

how would countries that are lacking in gold function domestically as weel as trade with the rest of the world

Just the same way countries function when they don’t have dollars. They simply trade something of value to a person who gives them dollars or they trade stuff valued in dollars. Similarly under a gold standard people without gold will simply trade stuff for gold or other stuff valued in gold.

If any society went to a gold standard there would not necessarlily be a run on gold like what the world just experienced since 2001 when it was under $300 US for an ounce.

In fact the opposite would be true of a gold standard where the amount of stuff purchased by an amount of gold will increase over time not decrease as it does with fiat money systems.