-
Notifications
You must be signed in to change notification settings - Fork 37
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
crosslink: Support go.work #308
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #308 +/- ##
==========================================
+ Coverage 58.99% 59.62% +0.63%
==========================================
Files 46 46
Lines 2024 2120 +96
==========================================
+ Hits 1194 1264 +70
- Misses 698 716 +18
- Partials 132 140 +8
☔ View full report in Codecov by Sentry. |
@@ -7,6 +7,10 @@ Thumbs.db | |||
*.iml | |||
*.so | |||
coverage.* | |||
go.work.sum |
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.
It even is not clear how the go.work.sum
is updated and how it is used so I see no reason to add it. Reference golang/go#51941
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.
Nice! This looks cool, I'm glad you have a use case for this and thanks for contributing it back!
My one question is, should updating a files go.work
and go.mod
files always happen at the same time. With the current implementation this seems to imply that is what a user would always want.
Is there a scenario where you would only want to update go.mod
files and not go.work
files? What about the other way around?
Should users be able to opt in or out of these updates through command flags? Should we instead be separating the updating of a go.work
file behind a different cobra command?
Also, should we support the use case of creating a |
go.work
Outdated
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 we be checking this go.work
file in? Is this intentional? From what I remember the go.work
docs had suggested that these were not suitable for checking in, and only existed for local development. Have we identified a use case where that is not true?
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.
From what I remember the
go.work
docs had suggested that these were not suitable for checking in, and only existed for local development.
From golang/go#53502:
For large monorepos with multiple modules, it likely makes sense to check in go.work, as it makes the setup easier and often has no downsides.
I think this is exactly the use case when crosslink
is used.
The benefit of commiting it is that all developers can profit from it.
EDIT: Also golang/go#53502 (comment)
EDIT 2: I have no idea why GitHub says that this comment is outdated 😆
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.
Anyway if you still have an opinion that it should be not committed I can remove it and add to .gitignore
😉
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.
Removing go.work
because of golang/go#60126.
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.
This comment was marked as outdated.
This comment was marked as outdated.
I was thinking about it as well. For sure it should be an opt-in functionality as somebody may want NOT to use Go workspaces. I found following reasons why I did not want to add such functionality (at least in this PR):
|
I see a use case. Someone may only use Personally, I propose to add it as a separate PR to make it easier to review. Also I do not think it is a blocker as this can be always added on top of existing PR. |
@bryan-aguilar After longer thoughts I am considering to change the code to have a new |
I think this makes sense. My suggestion would have been very similar. I would expect the cli interface to be something like |
Converting to draft. I will change this PR to introduce a |
Closing this PR in favor of #311 |
Why
Towards open-telemetry/opentelemetry-go#3964
go.work
is honored bygopls
language server so that develoeprs get better UX in tools like VSCode, Vim, Emacs etcReferences:
What
Make
crosslink
to update theuse
ingo.work
file (if it exists).Take notice that it will not harm any repositories which do not use Go workspaces. However developers could still use the functionality during development 😉
PS. The tests have a lot of repetition . However refactoring it in this PR would make it very hard to review. I can refactor all crosslink unit tests in next PR.
Testing
You can check the result on this branch and on open-telemetry/opentelemetry-go#4083