Essential Go Vendoring  Edit on GitHub      File Issue

Use govendor to add external packages

Govendor is a tool that is used to import 3rd party packages into your code repository in a way that is compatible with golang’s vendoring.

Say for example that you are using a 3rd party package

package main

import ""

func main() {
    slog.Infof("Hello World")

Your directory structure might look like:

|   ├── hello.go
|   ├── ... (slog files)

However someone who clones may not have a $GOPATH/src/ folder, causing their build to fail due to missing packages.

Running the following command at your command prompt will grab all the external packages from your Go package and package the required bits into a vendor folder:

govendor add +e

This instructs govendor to add all of the external packages into your current repository.

Your application’s directory structure would now look like:

|   ├── vendor/
|   |   ├──
|   |   |   ├── ... (slog files)
|   ├── hello.go

and those who clone your repository will also grab the required 3rd party packages.

  ↑ ↓ to navigate     ↵ to select     Esc to close