It works in some things and not in others.
There's actually something called mindfulness. It's where you stay centered but you think enough about the past/future or failure/success that you don't get skewed and blindsided. If you think too much about failure, you'll fail. If you think too much about success, you won't find satisfaction in success because if you succeed or continue to succeed you'll push the ceiling higher or the bar farther. It's like those people that say "I didn't celebrate graduating high school, it's expected that you graduate. I didn't celebrate graduating college, I planned and expected to. I didn't celebrate buying my first house or landing a big career, I expected to."
When you're doing something in the moment like mountain biking, you always have to keep your eyes where you want the bike to go, no matter the speed whether it's slow or fast, you can't look where you don't want to go. I almost rode off a cliff thinking I could cruise. If you're running a marathon or even a half, you can't have the mindset, "what if I stop?" "What if I blow my knee out?" "What if I sprain my ankle?" You can think about that while in the car or before the run, but while running you have to keep your mind on the task at hand, and the finish. Envision yourself crossing the finish line.
That's why goal setting has to have appropriate benchmarks, deadlines, time-based, or distance measures, you have to keep yourself in check every segment. But in case of failure or setback you have to have resolutions in order.