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

feat(gomod): Support go work vendor #29216

Merged
merged 11 commits into from
Jun 11, 2024

Conversation

chancez
Copy link
Contributor

@chancez chancez commented May 22, 2024

Changes

Run go work vendor instead of go mod vendor if a go.work is present in the module. As of Go 1.22 (golang/go#60056) Go supports vendoring with workspaces. If a go.work is located in the module along with the vendor directory, go mod vendor will fail, so go work vendor is needed instead.

I also run go work sync since pretty likely users want their dependencies synced across all their modules in the repository. If this is undesirable, an option could be added to skip this step as well.

Context

Relates to #29107. I wanted an option to disable the vendoring behavior entirely, but I figured making renovate run go work vendor would help more people, so I opted to do this instead.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

If go.work is present and a vendor/ is present, then the module is using
go workspaces with vendoring, recently introduced with Go 1.22 (see
golang/go#60056 for details).

When using Go workspaces, you must use `go work vendor` instead of `go
mod vendor`.
@chancez chancez changed the title Support go work vendor feat(gomod): Support go work vendor May 22, 2024
lib/modules/manager/gomod/artifacts.ts Outdated Show resolved Hide resolved
lib/modules/manager/gomod/artifacts.ts Outdated Show resolved Hide resolved
lib/modules/manager/gomod/artifacts.ts Outdated Show resolved Hide resolved
lib/modules/manager/gomod/artifacts.ts Outdated Show resolved Hide resolved
lib/modules/manager/gomod/artifacts.ts Show resolved Hide resolved
@chancez chancez requested a review from viceice May 23, 2024 15:37
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments

@chancez chancez requested review from viceice and rarkins May 28, 2024 17:21
@chancez
Copy link
Contributor Author

chancez commented Jun 4, 2024

@viceice PTAL

lib/modules/manager/gomod/artifacts.ts Outdated Show resolved Hide resolved
lib/modules/manager/gomod/artifacts.ts Outdated Show resolved Hide resolved
lib/modules/manager/gomod/artifacts.ts Show resolved Hide resolved
@chancez chancez requested a review from viceice June 4, 2024 19:57
@chancez
Copy link
Contributor Author

chancez commented Jun 4, 2024

@viceice updated, PTAL

@chancez chancez force-pushed the pr/chancez/go_work_vendor branch from 3ff8444 to 90a60b8 Compare June 5, 2024 16:48
@chancez
Copy link
Contributor Author

chancez commented Jun 10, 2024

@viceice I think this is ready to merge, let me know if you have any other changes you would like to see. Thanks!

@rarkins rarkins added this pull request to the merge queue Jun 11, 2024
Merged via the queue into renovatebot:main with commit 381fa55 Jun 11, 2024
35 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 37.402.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chancez chancez deleted the pr/chancez/go_work_vendor branch June 11, 2024 14:26
kosmoz pushed a commit to kosmoz/renovate that referenced this pull request Jun 12, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants