Open ningzio opened 3 months ago
this can be resolved by add new project to go.work manually, but it would be nice that goctl can do it for us :)
Would you please contribute a PR on this?
Would you please contribute a PR on this?
sure, I would love to.
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.
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".