Vendoring Go dependencies

kops uses dep to manage vendoreddependencies in most versions leading up to kops 1.14.kops uses go mod to managevendored dependencies in versions 1.15 and newer.

Prerequisites

The following software must be installed prior to running theupdate commands:

  • bazel
  • dep for kops 1.14 or older
  • go mod for kops 1.15 and newer branches (including master)
  • hg

Adding a dependency to the vendor directory

Go modules will manage required dependencies based on the importsfound in the source code. Follow these steps to run the update process:

  • Add the desired import to a .go file.
  • Run make gomod to start the update process. If this step issuccessful, the imported dependency will be added to the vendorsubdirectory.
  • Commit any changes, including changes to the vendor directory,go.mod, and go.sum.
  • Open a pull request with these changes separately from other workso that it is easier to review.

Updating a dependency in the vendor directory (e.g. aws-sdk-go)

  • Update the locked version as specified in go.mod
  • Run make gomod.
  • Review the changes to ensure that they are as intended / trustworthy.
  • Commit any changes, including changes to the vendor directory,go.mod and go.sum.
  • Open a pull request with these changes separately from other work so that itis easier to review. Please include any significant changes you observed.