zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.
https://go-zero.dev
MIT License
29.38k stars 3.97k forks source link

goctl api go error when go 1.21.0 in go.mod #3540

Closed edieruby closed 1 year ago

edieruby commented 1 year ago

when go 1.21.0 in go.mod goctl api go error occur: Error: go: go.mod already exists

change to go 1.18 in go.mod goctl api go is okay.

edieruby commented 1 year ago

It seems that go x.y.z not support go x.y support

go 1.21.0 not work go 1.21 work

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically. πŸ‘―πŸ‘­πŸ»πŸ§‘β€πŸ€β€πŸ§‘πŸ‘«πŸ§‘πŸΏβ€πŸ€β€πŸ§‘πŸ»πŸ‘©πŸΎβ€πŸ€β€πŸ‘¨πŸΏπŸ‘¬πŸΏ


It seems that go x.y.z not support go x.y support

relxet commented 1 year ago

This is because you used go work, add the current project to go work and try again

edieruby commented 1 year ago

This is because you used go work, add the current project to go work and try again

not used go work. just change to go 1.18 in go.mod the command works

kesonan commented 1 year ago

Please change to version go1.21.0, and then execute the following command in the same directory specified by goctl api go, and observe the result?

go list -m -f {{.GoMod}}
edieruby commented 1 year ago

Please change to version go1.21.0, and then execute the following command in the same directory specified by goctl api go, and observe the result?

go list -m -f {{.GoMod}}

Thank you. 1.21.0 is installed by install multiple versions of Go current go is still 1.20.6 goctl use go 1.20.6, it doesn't support x.y.z

relxet commented 1 year ago

Please change to version go1.21.0, and then execute the following command in the same directory specified by goctl api go, and observe the result?

go list -m -f {{.GoMod}}

Thank you. 1.21.0 is installed by install multiple versions of Go current go is still 1.20.6 goctl use go 1.20.6, it doesn't support x.y.z

it support x.y.z

just run go work use <project_dir> to add this project

relxet commented 1 year ago

i think it seems like a bug, i am not sure if it is a gozero bug or not? i also use go 1.21.0 and have this problem. add this project to go work and the problem is fixed.

edieruby commented 1 year ago

i think it seems like a bug, i am not sure if it is a gozero bug or not? i also use go 1.21.0 and have this problem. add this project to go work and the problem is fixed.

It's the problem of my environment. Not BUG. installed multiple go version.

My default cmd go -> go 1.20.6 cmd go1.21.0 -> go 1.21.0 When run goctl , it uses my default go. go 1.20.6 not suppot go x.y.z in the go.mod.

relxet commented 1 year ago

i also have this problem,so i think its not your problem 🀣