There are many routes to get to Gokyo, almost all of them starting from Lukla and diverted from Namche Bazaar. The shortest route to Gokyo is from Namche Bazaar to Machhermo via Dole. It only takes 4 days to reach Gokyo from this route. Another route is to first visit Everest base camp and then get to Dzongla via the Cho La pass. It takes around 10 days to reach Gokyo via this route, but the perk is, you get to visit Everest on the same route.