Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions docs/updating-dependencies.md
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
Expand All @@ -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
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

```

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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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?

Copy link
Collaborator

Choose a reason for hiding this comment

The 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 GO111MODULE="", I can test this now, so I'll give it a go and see what happens :)

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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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>

Expand Down
Loading