-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation - Update Go dependency management doc #3321
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
# Updating dependencies | ||
|
||
- Go Documentation for [Managing dependencies](https://go.dev/doc/modules/managing-dependencies) | ||
- [Go Module Awareness](https://go.dev/blog/go116-module-changes) | ||
|
||
To update golang dependencies one has to choose between two options: | ||
|
||
1) update the whole dependency tree | ||
|
@@ -9,37 +12,23 @@ To update golang dependencies one has to choose between two options: | |
## Update the whole dependency tree | ||
|
||
Done when the need to catch upstream dependencies arises, it can be done by | ||
calling | ||
|
||
```bash | ||
make vendor | ||
``` | ||
|
||
in root folder, which calls `hack/update-go-module-dependencies.sh`. | ||
|
||
The reason for calling script instead of directly calling: | ||
calling: | ||
|
||
```bash | ||
# Ensure go module-aware mode is set to auto | ||
export GO111MODULE=auto | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My work laptop is fubar so I can't test this myself, but I am 99% sure this breaks re: mac vs linux. Can we get an SRE from each side of the aisle to attempt this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Woops, ok, so maybe it was a Linux thing - have my laptop back up and I, for reasons unknown along my dev journey on this team, have changed my |
||
go get -u ./... | ||
go mod tidy -compat=1.18 | ||
go mod vendor | ||
``` | ||
|
||
is that packages modified in this script do not fully support modules and | ||
semantic versioning via tags. Therefore the proper version is parsed from the version | ||
branch and fixed using replace directive. Otherwise it will upgrade every time | ||
the command is started. | ||
|
||
When upgrading to a newer version of OpenShift, this script have to be updated to | ||
reflect the proper release. | ||
|
||
|
||
## Update only required dependencies | ||
|
||
When adding new dependencies or updating old ones, based on the requirement of | ||
the PR, one can simply call | ||
the PR, one can simply call: | ||
|
||
```bash | ||
export GO111MODULE=auto | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
go get <module>@<release> OR | ||
go get -u <module>@<release> | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the makefile target be deprecated / removed altogether? I'm curious on if we still need it for anything if we're removing it from docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was asking myself the same question. I see Ben updated the script a few weeks ago PR #3301
He said it still has some uses, so I don't think we should remove it. Documentation on it's specific purposes and uses would be nice.