etcd
etcd copied to clipboard
[Improvement] Use workspace mode to simplify the go.mod
Currently there is lots of replace directives in each go.mod file, and most of them are some duplicated items.
In golang 1.18 to be release early next year, a new workspace mode will be added. Please see go/issues/45713. When etcd upgrades the golang version to 1.18, then we can add a go.work in the top level directory, and get all the required replace directives included. Then all the go.mod files do not need to define the replace directives any more. If it's accepted, then I can work on this when the golang version is upgraded to 1.18 in etcd.
On the other hand, I don't think it's good to define lots of replace directives although they are necessary for now. I think we should remove all the replace directives in the go.mod files in all modules in future, so as to remove the build level dependencies on the files on local disk in future. If this is true and accepted, then we do not need the go.work in the future.
I would like to get more feedback on this topic.
cc @mitake
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.
Interesting. But there is also a lot of discussion about not submitting the go.work file into repository as an anti-pattern,
that I would assume is what you are proposing.
https://go.googlesource.com/proposal/+/master/design/45713-workspace.md#preventing-files-from-being-checked-in-to-repositories
Interesting. But there is also a lot of discussion about not submitting the
go.workfile into repository as an anti-pattern, that I would assume is what you are proposing.
Yep it was also surprising for me. I even started working on PR on this as I was tired of cding into every package to test it (don't like to use scripts as I like to add some arguments). However apparently K8s plans to do that?
cc @thockin who is more knowledgeable about this.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.