# Clarification on how moby uses import packages from URL

**URL:** <https://forums.mobyproject.org/t/clarification-on-how-moby-uses-import-packages-from-url/472>\
**Category:** Support\
**Created:** [August 6, 2019, 9:17pm UTC](https://forums.mobyproject.org/t/clarification-on-how-moby-uses-import-packages-from-url/472 "2019-08-06T21:17:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick24](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@nick24](https://forums.mobyproject.org/u/nick24)\
**Post date:** [August 6, 2019, 9:17pm UTC](https://forums.mobyproject.org/t/clarification-on-how-moby-uses-import-packages-from-url/472/1 "2019-08-06T21:17:23Z")

</div>

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/](http://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](http://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?

---

<div class="post-metadata">

**Author:** ![thaJeztah](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.mobyproject.org/thajeztah/32/2_2.png) [@thaJeztah](https://forums.mobyproject.org/u/thaJeztah)\
**Post date:** [August 6, 2019, 11:07pm UTC](https://forums.mobyproject.org/t/clarification-on-how-moby-uses-import-packages-from-url/472/2 "2019-08-06T23:07:58Z")

</div>

The repository uses vendoring, which means that a copy of all the dependencies (or more factually; all the files of the dependencies that are actually used) are included in the repository inside the “vendor” directory; [https://github.com/moby/moby/tree/master/vendor](https://github.com/moby/moby/tree/master/vendor)

vendoring allows building the project with a guarantee that you’ll always have the exact same version of the dependencies, and also makes sure that we don’t have to rely on the repositories where those dependencies live (they may be unavailable at times, or bad things could happen, such as someone deleting those repositories, or force-pushing changes)

We vendor those files using a tool named `vndr` [https://github.com/lk4d4/vndr](https://github.com/lk4d4/vndr)

which uses the `vendor.conf` file to get the specified version of the dependencies (and where to get them from, in case we (temporarily) use a fork / branch) [https://github.com/moby/moby/blob/6f234db9fef23c591d8376f96db062e7107b658f/vendor.conf](https://github.com/moby/moby/blob/6f234db9fef23c591d8376f96db062e7107b658f/vendor.conf)

if you want to make changes to those files; it’s best to make a fork of the dependency repository that you want to modify, make the changes there, and specify your fork as source for the dependency; that way you don’t have to change the import paths; you can find an example of a dependency that’s currently using a fork at this line; [https://github.com/moby/moby/blob/6f234db9fef23c591d8376f96db062e7107b658f/vendor.conf#L5](https://github.com/moby/moby/blob/6f234db9fef23c591d8376f96db062e7107b658f/vendor.conf#L5)

---

<div class="post-metadata">

**Author:** ![nick24](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@nick24](https://forums.mobyproject.org/u/nick24)\
**Post date:** [August 14, 2019, 11:22pm UTC](https://forums.mobyproject.org/t/clarification-on-how-moby-uses-import-packages-from-url/472/5 "2019-08-14T23:22:55Z")

</div>

@thaJeztah Thanks you for the detailed explanation. Initially I could not get the changes to reflect in the binary just by updating vendor.conf with the URL of the fork. It’s only when I ran `vndr` from my root repository on the link you shared [https://github.com/lk4d4/vndr](https://github.com/lk4d4/vndr) that I could solve this issue. I assumed that running vndr command was not required initially.
