The Spanish government says it will scrap so-called “golden visas” that allow wealthy people from outside the European Union to obtain residency permits on investing more than half a million euros (dollars) in real estate.