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

Add go.work file #3964

Closed
pellared opened this issue Apr 3, 2023 · 5 comments · Fixed by #4199
Closed

Add go.work file #3964

pellared opened this issue Apr 3, 2023 · 5 comments · Fixed by #4199
Labels
enhancement New feature or request

Comments

@pellared
Copy link
Member

pellared commented Apr 3, 2023

Go 1.18 release introduced Go Workspaces; some references:

I propose to add a go.work file. The main reason is that I believe some of the contributors are using gopls or/and VSCode

I propose to add only the go.work file for convivence. We would still need to have the replace in go.mod files as:

  1. we need to properly define all require of given module (we are not publishing modules so we need to define all dependencies)
  2. all our existing automation does not rely on Go workspaces and also we should not force to use it. E.g. it is sometimes more convenient to just open the editor for a single module.

Probably the cleanest way would be to automate it in crosslink.

Even the proposal is not accepted then I would like to at least add go.work to .gitignore. I am doing it as the first step as it should not harm anybody.

@pellared pellared added the enhancement New feature or request label Apr 3, 2023
@Aneurysm9
Copy link
Member

I support adding go.work to .gitignore and teaching crosslink how to generate a go.work file.

@dmathieu
Copy link
Member

Can this issue be closed, since go.work has been added to gitignore?

@pellared
Copy link
Member Author

pellared commented Apr 11, 2023

Can this issue be closed, since go.work has been added to gitignore?

I would not close it. I plan to implement go.work generation in crosslink. Then we can add go.work to this repo and remove from .gitignore.

@MadVikingGod
Copy link
Contributor

It should also be noted that both the go.work, and the replace directives are only for our development; neither are respected when this code is used as a library1.

I personally would rather have a go.work that includes all the current modules.

Footnotes

  1. from https://go.dev/ref/mod#go-mod-file-replace: replace directives only apply in the main module’s go.mod file and are ignored in other modules.

@pellared
Copy link
Member Author

pellared commented May 8, 2023

I personally would rather have a go.work that includes all the current modules.

We will still need to keep the replace until golang/go#50750 is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
5 participants