cloudwego / cloudwego/kitex

自定义模板生成报错

Open
#1,358 5 comments 0 reactions 1 assignee Claimed by @HeyJavaBean View on GitHub
Dominant language
Go
Stars
8k
Forks
918
Avg merge
1d 13h
Merged PRs (30d)
7

Description

**Describe the bug**
使用kitex自定义模板生成报错
![img_v3_02b7_b2f0ec07-1909-4ba0-9312-2793085d6e6g](https://github.com/cloudwego/kitex/assets/72679319/6001aef0-1935-468e-aaf8-fd2097cfc84f)
生成的目录结构
![img_v3_02b7_cf7baa41-65a9-465e-96ed-8a798c67faag](https://github.com/cloudwego/kitex/assets/72679319/0147b72f-59b2-42d9-b39c-02c9badc82b9)
_default.go中的内容
![image](https://github.com/cloudwego/kitex/assets/72679319/9c94c287-4da5-479f-9cd4-f48a89000d7c)

PackageInfo.RealServiceName由tool/internal_package/generator/generator.go中的Config.ServiceName赋值,Config.ServiceName是通过-service参数指定的,但是-service参数和-template-dir是不能同时指定的,这好像矛盾了?

**To Reproduce**
创建两个文件夹tpl和idl,在idl中创建hello.thrift,tpl中创建default.yaml
```go
// hello.thrift
namespace go api

struct Request {
1: string message
}

struct Response {
1: string message
}

service Hello {
Response echo(1: Request req)
}

```
tpl/default.yaml用的是https://github.com/cloudwego/cwgo/blob/main/tpl/kitex/client/standard/default_tpl.yaml
运行命令 `kitex -module github.com/xxx/demo -service demo -template-dir tpl idl/hello.thrift`
**Expected behavior**

正确生成自定义模板

**Kitex version:**

v0.9.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.