A man has told a court that taking up golf has helped him kick his heroin habit and transformed his mental health after an incident in Tesco.