I dry-fire mine before storing them, but it's probably more of a "We did it that way in the military" thing than anything else.
The firing pin/striker spring in a Glock is only partially compressed during cocking; your finger and the trigger complete the compression stroke just prior to firing, so the spring is not fully compressed while at rest (unlike some other gun designs).
If you're going to dry-fire, I recommend having an extra-safe direction to do it. Always practice and remember basic safety rules, and keep in mind the two worst noises a handgun shooter will ever hear:
- A "Click" when they expect a "Bang" (in defensive use)
- A "Bang" when they expect a "Click" (during so-called dry-fire)