"The golden rule is that there are no golden rules"
-- George Bernard Shaw
Ethics is a well defined branch of philosophy, carefully churning over ideas and throwing out or modifying the bad ones. Thousands of papers and not a few books have been written about the golden rule (sometimes referred to as the ethic of reciprocity), and they all agree on one thing -- you can't take it too literally.
You don't need to give your baby nephew a new laptop for his first birthday, or C! that horrible writeup on toilet seats, or serve your grandmother a 6th helping of Thanksgiving turkey. So obviously, Do Unto Others As You Would Have Them Do To You is not a firm and fast rule. This drives philosophers mad.
In the book Formal Ethics Harry J. Gensler attempts to give a complete logical breakdown of the rule, in terms simple enough for the average nudnik to understand. He uses formal logic to forge a 'perfect' form of this statement. He deals with problems such as masochists, dealing with children (when they need punishment), and professionals (when wanting something that you cannot give).
Example Problem: I want this doctor to remove my tonsils. So, I will remove his.
The solution is to modify the rule (The Golden rule) to Do unto others as you would have them do unto you if the roles were reversed.
Another Example Problem: I don't like being downvoted. So I won't downvote.
The solution: Do unto others as you would have them do unto you if you were in the same state -- if I were writing stuff like that, then I should be downvoted!
Of course, those of us who are not philosophers have an easier solution, a commonsense one that usually doesn't even need to be stated. Do Unto Others As You Would Have Them Do Unto You, Unless Their Is A Good Reason Not To. Surprisingly, the eminent philosopher Karl Popper actually put this rather well; "The golden rule is a good standard which is further improved by doing unto others, wherever possible, as they want to be done by."
The golden rule does not include revenge. That would be 'Treat others as they treat you." Somewhat less noble.