A goal no one knows about is easy to quit without loss of face. But if all my friends know I'm doing something, I'm bloody well going to do it.
I always tell my friends I'm going to do something when it's something that really needs to get done. So far, whatever dopamine reward I get from talking about it has overpowered by the knowledge that I said I'd do it and it's not done yet.
As always, your experience may vary.
The weather? War? Religion? WHY ARE YOU WASTING MY TIME WITH TRIVIAL TALK? I AM MAKING THE MOST IMPORTANT THING EVER OVER HERE!
My motivation is progress, most of the time. If I'm not making progress, I'll often switch to some easier task that I know I can get done quickly to get my brain in the right space and make 'getting into the zone' a downhill process.
Sometimes, switching back to whatever task was slowing me down is like going back uphill again, but I often find that I'll usually abandon the easy task because, while doing that, the harder task has been mentally solved (once you stop thinking about a problem, yadda yadda).
Of course, where I generally suffer is in getting all the easy tasks done. Solving a problem is fun. Writing a login page isn't, generally speaking. Making a 'reset your password' form isn't. So all those things often get left by the wayside, and I end up with an awesome project that is completely unsellable because the last 10% goes untouched while I work on something else.
Try your best to keep your goals to yourself. When you start explaining your idea to someone else, the thought is that you receive a dopamine reward associated with completing that goal. Common wisdom suggests that if one tells all their friends about their awesome idea, they'll be more motivated to finish it, but this just isn't true. Individuals who explain and take credit for their idea are more likely to feel more accomplished than those who keep it to themselves.
This was one of the biggest things for me. Be humble. Keep ideas to yourself and reward yourself on results, not just ideas.