"In everything, therefore, treat people the same way you want them to treat you, for this is the Law and the Prophets. (Matthew 7:12 NASB)
Again Jesus is teaching in the context of judgment and discernment. You find in Matthew 7:1-2 that we will be judged by the very standard we set. In Matthew 7:3-5 we are given some perspective as to how much sin we have in our own life in comparison to the sin we perceive in someone else's life. In Matthew 7:6 we are warned that just because we have sin and we are in no position to judge we ought to still proceed with caution, not giving what is holy to dogs, or casting pearls to swine. Then in Matthew 7:7-11 we are admonished to ask, seek, and knock to determine the will of God, and to receive wisdom from Him in discernment in this context of judging and discerning. Moreover in that text we are shown the faithfulness of God in that He will give to us what is good, if we ask (recall this whole text is in the context of judging others and discernment.)
That brings us to Matthew 7:12, and right there in the verse is a 'therefore' which links this passage to the previous passages and tells us that this is not a standalone verse. Recall the first 11 verses of this chapter are dealing with judging others and discernment, Jesus teaches us not to judge and also to discern then gives us verses 7-11 to instruct us to seek Him to know the difference. There is a dependence upon God that the believer must have in exercising biblical discernment, it does not come out of the mind or heart of the believer. If we neglect 'ask, seek, knock' and go with our heart or gut feeling we will fail. How can you know if you are following your heart, or the Lord? The answer is right here in Matthew 7:12.
In light of Christ's liberal offer for wisdom and discernment, and your inability to rightly judge, treat others the same way you want to be treated. It is crystal clear, in fact this verse in a way is nearly identical to Matthew 7:1-2. Matthew 7:12 seems to be a closing statement on this thought which is introduced in Matthew 7:1-2. I would assert that when teaching on judgment Matthew 7:1-12 should be taken as a whole. Of course the golden rule 'treat others as you want to be treated' is a very simple concept, and yet Christ Himself says 'for this is the Law and the Prophets', in other words this simple verse sums up the commands of the OT.
I would say this in closing. Unjust judgment of others leads to mistreatment of others. Again the call to discernment, church discipline, and caution is real and biblical, at the same time, if you come to a place where your actions fail the simple test of Matthew 7:12 you discernment has been wrong.