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

goctl: go work support #4332

Open
ningzio opened this issue Aug 26, 2024 · 3 comments
Open

goctl: go work support #4332

ningzio opened this issue Aug 26, 2024 · 3 comments
Assignees

Comments

@ningzio
Copy link

ningzio commented Aug 26, 2024

Is your feature request related to a problem? Please describe.

when creating new project using goctl api new xxx inside of a go workspace, it will failed: "no matched module"

Describe the solution you'd like

goctl can auto detect go workspace, if new project is inside of a go workspace, goctl should handle it, make sure the project is created.

Describe alternatives you've considered

Additional context

goctl use go list -json -m to find current project's go module here, but in go workspace, this command only returns modules that declared in go.work.

I tried add project into go.work after go mod is initialized, and it works.

maybe this is not the best practice but hope it can to be helpful.

image

btw, I find goctl use go list -m -f '{{.GoMod}}' to check if the current path is a go module here, but in go workspace, this command could be inaccurate. go env GOMOD should be better? if the current path is not a go module, it will return "/dev/null".

@ningzio
Copy link
Author

ningzio commented Aug 28, 2024

this can be resolved by add new project to go.work manually, but it would be nice that goctl can do it for us :)

@kevwan
Copy link
Contributor

kevwan commented Aug 28, 2024

Would you please contribute a PR on this?

@ningzio
Copy link
Author

ningzio commented Aug 29, 2024

Would you please contribute a PR on this?

sure, I would love to.

ningzio added a commit to ningzio/go-zero that referenced this issue Aug 31, 2024
ningzio added a commit to ningzio/go-zero that referenced this issue Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@kevwan @kesonan @ningzio and others