Skip to content

Exception occurs when using multilevel directory nesting in .api group: demo/login due to types file separation #4878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ouyang6559 opened this issue May 20, 2025 · 6 comments

Comments

@ouyang6559
Copy link

ouyang6559 commented May 20, 2025

Exception occurs when using multilevel directory nesting in .api group: demo/login due to types file separation

Error message:
2025/05/20 21:06:44 open internal/types/demo/login.go: no such file or directory

@server (
// Represents that the route generation code under the current service code block will be placed in the login directory
group: demo/login
// Defines the route prefix as "/v1"
prefix: /v1
)

The following example can be generated:
@server (
// Represents that the route generation code under the current service code block will be placed in the login directory
group: login
// Defines the route prefix as "/v1"
prefix: /v1
)


当.api的group: demo/login多层级目录嵌套会因为types的分文件导致异常

报错内容
2025/05/20 21:06:44 open internal/types/demo/login.go: no such file or directory

@server (
// 代表当前 service 代码块下的路由生成代码时都会被放到 login 目录下
group: demo/login
// 定义路由前缀为 "/v1"
prefix: /v1
)

下面这一种是可以生成的
@server (
// 代表当前 service 代码块下的路由生成代码时都会被放到 login 目录下
group: login
// 定义路由前缀为 "/v1"
prefix: /v1
)

Image
@cqjokers
Copy link

goctl version 1.8.3,今天也遇到这个问题

@alex86w
Copy link

alex86w commented May 21, 2025

1.8.3 问题多多,还有inport api 后重复生成的问题

@kevwan kevwan changed the title 当.api的group: demo/login多层级目录嵌套会因为types的分文件导致异常 Exception occurs when using multilevel directory nesting in .api group: demo/login due to types file separation May 23, 2025
@kesonan
Copy link
Collaborator

kesonan commented May 23, 2025

it fixed on master branch

@vibe-sudo
Copy link

I have watched the gotl source code for release 1.8.3 and found that this issue can be resolved by disabling the GOCTL.exe PERIMENTAL environment to disable the new API feature. However, it seems that this variable has always been enabled by default, so I haven't dealt with it either.

Image

Image

At the same time, I solved this problem by using the latest version of goctl to enable API features. The main reason for upgrading is because I want to use the swagger generation function of the gotl API. After using it, I fixed the issue with the gotl swagger plugin. I would like to know if the official and stable 1.8.4 version of gotl will be released soon.

Image

@kevwan
Copy link
Contributor

kevwan commented May 24, 2025

Yes, within 2 weeks. go-zero usuallly release every month.

@kevwan
Copy link
Contributor

kevwan commented May 24, 2025

Fixed in master. close now, reopen if needed.

@kevwan kevwan closed this as completed May 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants