From 50e547db4dc9c9c3a2f112ff430eb736ddfca3c4 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 23 Sep 2020 17:00:25 -0400 Subject: [PATCH] remove vendoring from contribution guide --- .github/CONTRIBUTING.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e1f72451e..6cdfeb97a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -201,7 +201,7 @@ make protobuf ## External Dependencies -Terraform uses Go Modules for dependency management, but currently uses "vendoring" to include copies of all of the external library dependencies in the Terraform repository to allow builds to complete even if third-party dependency sources are unavailable. +Terraform uses Go Modules for dependency management. Our dependency licensing policy for Terraform excludes proprietary licenses and "copyleft"-style licenses. We accept the common Mozilla Public License v2, MIT License, and BSD licenses. We will consider other open source licenses in similar spirit to those three, but if you plan to include such a dependency in a contribution we'd recommend opening a GitHub issue first to discuss what you intend to implement and what dependencies it will require so that the Terraform team can review the relevant licenses to for whether they meet our licensing needs. @@ -213,24 +213,23 @@ go get github.com/hashicorp/hcl/v2@2.0.0 This command will download the requested version (2.0.0 in the above example) and record that version selection in the `go.mod` file. It will also record checksums for the module in the `go.sum`. -To complete the dependency change, clean up any redundancy in the module metadata files and resynchronize the `vendor` directory with the new package selections by running the following commands: +To complete the dependency change, clean up any redundancy in the module metadata files by running: ``` go mod tidy -go mod vendor ``` -To ensure that the vendoring has worked correctly, be sure to run the unit test suite at least once in *vendoring* mode, where Go will use the vendored dependencies to build the test programs: +To ensure that the upgrade has worked correctly, be sure to run the unit test suite at least once: ``` -go test -mod=vendor ./... +go test ./... ``` Because dependency changes affect a shared, top-level file, they are more likely than some other change types to become conflicted with other proposed changes during the code review process. For that reason, and to make dependency changes more visible in the change history, we prefer to record dependency changes as separate commits that include only the results of the above commands and the minimal set of changes to Terraform's own code for compatibility with the new version: ``` -git add go.mod go.sum vendor -git commit -m "vendor: go get github.com/hashicorp/hcl/v2@2.0.0" +git add go.mod go.sum +git commit -m "go get github.com/hashicorp/hcl/v2@2.0.0" ``` You can then make use of the new or updated dependency in new code added in subsequent commits.