Skip to content

Commit

Permalink
Merge #58462
Browse files Browse the repository at this point in the history
58462: build: add extra tips when adding new dependency on go.mod r=miretskiy a=otan

Release note: None

Co-authored-by: Oliver Tan <[email protected]>
  • Loading branch information
craig[bot] and otan committed Jan 5, 2021
2 parents 04063a9 + ffe5598 commit 09ccfed
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,18 @@ Dependencies are managed using `go mod`. We use `go mod vendor` so that we can i
### Installing or updating a dependency

Run `go get -u <dependency>`. To get a specific version, run `go get -u <dependency>@<version|branch|sha>`.
You should see changes in `go.mod` when running `git diff`.

When updating a dependency, you should run `go mod tidy` after `go get` to ensure the old entries
are removed from go.sum.

You must then run `make vendor_rebuild` to ensure the modules are installed. These changes must
then be committed in the submodule directory (see [Working with Submodules](#working-with-submodules)).
You must then run `make vendor_rebuild` to ensure the modules are installed.
Ensure the vendor changes are as expected by running `cd vendor && git status`. If your import
is missing, ensure it is used in code. This can be a blank dependency, e.g.
`import _ "golang.org/api/compute/v1"`. These changes must then be committed in the submodule directory
(see [Working with Submodules](#working-with-submodules)).

Programs can then be run using `go build -mod=vendor ...` or `go test -mod=vendor ...`.
Programs can then be run using `go build ...` or `go test ...`.

### Removing a dependency

Expand Down

0 comments on commit 09ccfed

Please sign in to comment.