/home/josephspurrier

How to Use GO15VENDOREXPERIMENT

Go 1.5 supports an experimental feature which allows you to store the external packages you use in a folder called vendor. In Go 1.6, the feature will be enabled by default. You can enable the feature by setting this environment variable:

GO15VENDOREXPERIMENT=1

If you are using LiteIDE, just add that line to the bottom of your .env file through the menu: View -> Edit current environment.

Once that variable is enabled, the Go build process will check the vendor folder for any external packages first before checking outside your package. To test this on a current project, simply move all the external packages to the vendor folder and your program should continue to compile without any errors. You don’t have to change any import paths. If you have the same package inside the vendor folder and outside your package folder, the one in the vendor folder will be used.

One thing to note is the behavior of go get does not change once that environment variable is enabled. External packages will still be downloaded and placed at the root of the src directory. You either have to move them manually into the vendor folder or use another package management tool to download the packages to the preferred location.

#go