It's hard not to picture a goal as a destination, but that type of thinking can be demotivating. You're either there having succeeded, or you're not. By thinking of your goals as a compass, you can keep your focus on the direction you need to go.
Photo by Colin Zhu
You might know what you want to accomplish, but the trick is finding out how to do it, and making that the focus. On his blog, James Clear suggests you release your desire to achieve your goal completely and only worry about the direction you're heading:
The problem with a treasure hunt is that most people spend all of their time thinking about the treasure. The fastest way to get to a particular spot, however, is to set your compass and start walking... Develop a clear, single-minded focus for where you are headed... your goal becomes your compass, not your buried treasure. The goal is your direction, not your destination. The goal is a mission that you are on, a path that you follow.
When you approach your goals this way, you're already achieving them by taking the smallest of steps forward. For example, your goal wouldn't be "learn how to code", it would be spend one hour a day learning and practising. Or instead of "I want to lose weight", it could be switching in a healthy substitute for something for every meal.
When your goal is the process, you manage to hold on to your motivation longer because you're achieving your goal every day. Eventually you might find the treasure at the end, but the road will keep going on because you've developed the habits to keep you marching forward.