Docker Community Forums

Share and learn in the Docker community.

Clarification on how moby uses import packages from URL

Hi, I’m trying to understand how import from URL worls in moby/moby repository. The source files under moby/moby github repository have import paths like the following:

import "github.com/docker/swarmkit/api"
import "github.com/docker/docker/api/server/httputils"

The 2nd URL doesn’t even exist so I assume it points to github.com/moby/moby/api/… instead?

From what I understand is that whenever we want to import any external package we have to first perform go get <package URL> and then add that URL path under import in the source file. But I’m able to simply clone the moby/moby repo and compile code directly without performing ‘go get…’ prior to it and the compilation just happens fine. I do see a github.com folder in my GOPATH but DO NOT see any child folders like docker/swarmkit/ in it. So, I can’t understand how were the external packages fetched from those URLs? Is it the case that these packages are fetched during the build process and then the local folders are deleted as soon as the build finishes?