This is quite an interesting question as both are correct terms and can be used at will for most situations.
The first usage is the most common. The second is more formal and is likely to be used as part of a list of instructions.
List of things to do next week while I'm away:
On Tuesday, take out the rubbish.
On Friday, do the shopping.
Don't forget to turn off the light before going to bed.
Here, the instruction implies that it's meant for every night of the week.
By contrast, the other version might more commonly be used by one person to another (or others) as an instruction for this occassion only, though it could also cover a period of time depending on the context.
If the usage of the phrases were swapped for these examples it would still be clearly understood but might raise an eyebrow or two.
Equally, "before you go" implies a known subject whereas "before going" is more generic and, therefore, more likely to be found in a written context.