go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

feat(goctl): support go work (#4332)

Open ningzio opened this issue 5 months ago • 2 comments

this PR fixed the error no matched module when using goctl api inside of a go workspace.

in go workspace, command go list -m -f '{{.GoMod}}' only lists modules declared in go.work, so goctl can't can the go.mod path even it's already initilized if the project is not in go.work.

to fix this, goctl should

  • use go env GOMOD to determine whether the project is a go module.
  • check if the project is inside of a go workspace, if it does, it will use go work use . to add the project to go.work.

ningzio avatar Aug 31 '24 15:08 ningzio