Matthew 19:17 (also Mark 10:18) And he said unto him, Why callest thou me good? there is none good but one, that is, God....
The word good in this verse is the Greek word Agathos and means "good" in the moral sense of without fault or propensity to sin.
John 10:11 I am the good shepherd: the good shepherd giveth his life for the sheep.
The word "good" in this passage is a different word entirely. It is Kalos and means "virtuous" or, in this case, courageous and diligent.