Annoying at best and dangerous at worst the principle cause of fogged glasses or goggles is simple. "Static Electricity*" and the solution is easily understood "remove or dissolve any statically charged particles from the lens surface!" Now the lenses might get "wet" but not fogged up! ( *statically charged microscopic particles that attract small water particles or droplets.)
Unfortunately there is no practical long-term anti-fog coating since glasses or goggles are continually exposed to dust and a variety of atmospheric or aqueous contaminants that will build up a new layer of "charged particles" over time.
The only real remedy is regular use of a lens cleaning and treatment that removes the particles (nucleus) that fog forms on! Anti-Fog Coating.
It is formulated to be safe and non-irritating to your eyes! Some commercial preparations must be left to dry for over one hour after application or irritation to the eyes may occur! Non-toxic, safe for children to use AND effective!