You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make the `gf gen service` command compatible with the scenario where the program entry file is located in the cmd/ directory. i.e.:
```
$ tree .
.
├── cmd
│ ├── gf2-demo-api
│ │ └── gf2-demo-api.go
│ └── gf2-demo-cli
│ └── gf2-demo-cli.go
```
1. What version of
Go
and system type/arch are you using?go version go1.20.4 darwin/amd64
2. What version of
GoFrame
are you using?goframe: v2.4.4
gf cli: v2.4.4
3. Can this issue be re-produced with the latest release?
yes
4. What did you do?
报错如下:
查看gf最新版源码发现https://github.com/gogf/gf/blob/master/cmd/gf/internal/cmd/genservice/genservice.go的
checkAndUpdateMain
函数, 将项目程序入口文件默认为了项目根路径下的main.go
, 而我的项目的入口文件是cmd/gf2-demo-api/gf2-demo-api.go
, 从而导致后续代码报错.不知道能否考虑兼容一下入口文件在
cmd/
下的这种使用方式, 目前看这种应该还算比较主流.我这边想到的最简单的兼容方法是在生成完service代码文件进入
checkAndUpdateMain
后, 如果发现项目跟路径下没有main.go
文件, 就忽略后续处理, 提前返回即可.The text was updated successfully, but these errors were encountered: