zeromicro / go-zero

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

api文件如何定义base struct,可以在多个地方使用? #4304

Closed peiminmin closed 3 months ago

peiminmin commented 3 months ago

go-zero 定义api文件的时候,如果有个base struct,是多个struct引用的,一般怎么处理,我抽出来单独放一个文件 ,然后在使用的地方import,多次import提示重复定义。如果只在入口文件import一次,又回提示找不到base struct。goctl 1.6

peiminmin commented 3 months ago

升级1.7后,可以多次import了

Issues-translate-bot commented 3 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


After upgrading to 1.7, you can import multiple times.