Skip to content
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

lsc: trpc-go-cmdline => trpc-cmdline #72

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ tRPC-Go has the following features:
- All components are pluggable, with default implementations for various basic functionalities that can be replaced. Other components can be implemented by third parties and registered within the framework.
- All interfaces can be mock tested using gomock&mockgen to generate mock code, facilitating testing.
- The framework supports any third-party protocol by implementing the `codec` interfaces for the respective protocol. It defaults to supporting trpc and http protocols and can be switched at any time.
- It provides the [trpc command-line tool][trpc-go-cmdline] for generating code templates.
- It provides the [trpc command-line tool][trpc-cmdline] for generating code templates.

## Related Documentation

- [quick start guide][quick start] and [detailed documentation][docs]
- readme documents in each directory
- [trpc command-line tool][trpc-go-cmdline]
- [trpc command-line tool][trpc-cmdline]
- [helloworld development guide][helloworld]
- [example documentation for various features][features]

Expand All @@ -49,7 +49,7 @@ If you're interested in contributing, please take a look at the [contribution gu
[Go]: https://golang.org
[go-releases]: https://golang.org/doc/devel/release.html
[tRPC]: https://github.com/trpc-group/trpc
[trpc-go-cmdline]: https://github.com/trpc-group/trpc-go-cmdline
[trpc-cmdline]: https://github.com/trpc-group/trpc-cmdline
[docs]: /docs/README.md
[quick start]: /docs/quick_start.md
[contributing]: CONTRIBUTING.md
Expand Down
6 changes: 3 additions & 3 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ tRPC-Go 具有以下特点:
- 所有的组件都是可插拔的,内置了各种基本功能的默认实现,可以进行替换。其他组件可以由第三方实现并注册到框架中。
- 所有的接口都可以进行模拟测试,使用 gomock&mockgen 生成 mock 代码,方便进行测试。
- 框架支持任意的第三方协议,只需要实现协议的打包和解包接口即可。默认支持 trpc 和 http 协议,可以随时切换。
- 提供了 [trpc 命令行工具][trpc-go-cmdline] 用于生成代码模板。
- 提供了 [trpc 命令行工具][trpc-cmdline] 用于生成代码模板。

## 相关文档

- [快速上手][quick start] 以及 [详细文档][docs]
- 各个目录下的 README 文档
- [trpc 命令行工具][trpc-go-cmdline]
- [trpc 命令行工具][trpc-cmdline]
- [helloworld 开发指南][helloworld]
- [各种特性的示例文档][features]

Expand All @@ -48,7 +48,7 @@ tRPC-Go 具有以下特点:

[Go]: https://golang.org
[tRPC]: https://github.com/trpc-group/trpc
[trpc-go-cmdline]: https://github.com/trpc-group/trpc-go-cmdline
[trpc-cmdline]: https://github.com/trpc-group/trpc-cmdline
[docs]: /docs/README.zh_CN.md
[quick start]: /docs/quick_start.zh_CN.md
[go-releases]: https://golang.org/doc/devel/release.html
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ English | [中文](README.zh_CN.md)
- [Reverse Proxy](/docs/user_guide/reverse_proxy.md)
- [Graceful Restart](/docs/user_guide/graceful_restart.md)
- [Health Check](/healthcheck/README.md)
- [Cmdline Tools](https://github.com/trpc-group/trpc-go-cmdline)
- [Cmdline Tools](https://github.com/trpc-group/trpc-cmdline)
- [High Performance Network Package tnet](/docs/user_guide/tnet.md)
- [Track Running Status](/rpcz/README.md)
- [Attachment (Big Binary Data) Transfer](/docs/user_guide/attachment.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
- [反向代理](/docs/user_guide/reverse_proxy.zh_CN.md)
- [优雅重启](/docs/user_guide/graceful_restart.zh_CN.md)
- [健康检查](/healthcheck/README.zh_CN.md)
- [命令行工具](https://github.com/trpc-group/trpc-go-cmdline)
- [命令行工具](https://github.com/trpc-group/trpc-cmdline)
- [高性能网络库 tnet](/docs/user_guide/tnet.zh_CN.md)
- [运行状态追踪](/rpcz/README.zh_CN.md)
- [附件(大二进制数据)传输](/docs/user_guide/attachment.zh_CN.md)
Expand Down
14 changes: 7 additions & 7 deletions docs/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ English | [中文](quick_start.zh_CN.md)
## Prerequisites

- **[Go][]**: any one of the **three latest major** [releases][go-releases].
- **[trpc-go-cmdline][]**: follow the instructions in the [README][trpc-go-cmdline] to install trpc-go-cmdline and its related dependencies correctly.
- **[trpc-cmdline][]**: follow the instructions in the [README][trpc-cmdline] to install trpc-cmdline and its related dependencies correctly.

## Create a Full Project Step by Step

Expand Down Expand Up @@ -35,7 +35,7 @@ service HelloWorldService {
}
```

* Using [trpc-go-cmdline][] to generate a full project:
* Using [trpc-cmdline][] to generate a full project:
```shell
$ trpc create -p helloworld.proto -o out
```
Expand Down Expand Up @@ -102,7 +102,7 @@ out
`-- helloworld_mock.go
```

The following lists some frequently used flags for [trpc-go-cmdline][].
The following lists some frequently used flags for [trpc-cmdline][].

* `-f`: Force overwrite the existing code.
* `-d some-dir`: Search paths for pb files (including dependent pb files), can be specified multiple times.
Expand All @@ -113,12 +113,12 @@ For additional flags please run `trpc -h` and `trpc [subcmd] -h`.

## What's Next

Try [more features][features]. Learn more about [trpc-go-cmdline][]'s [documentation][cmdline-doc].
Try [more features][features]. Learn more about [trpc-cmdline][]'s [documentation][cmdline-doc].

[Go]: https://golang.org
[go-releases]: https://golang.org/doc/devel/release.html
[trpc-go-cmdline]: https://github.com/trpc-group/trpc-go-cmdline
[cmdline-releases]: https://github.com/trpc-group/trpc-go-cmdline/releases
[trpc-cmdline]: https://github.com/trpc-group/trpc-cmdline
[cmdline-releases]: https://github.com/trpc-group/trpc-cmdline/releases
[helloworld]: /examples/helloworld/
[features]: /examples/features/
[cmdline-doc]: https://github.com/trpc-group/trpc-go-cmdline/tree/main/docs
[cmdline-doc]: https://github.com/trpc-group/trpc-cmdline/tree/main/docs
16 changes: 8 additions & 8 deletions docs/quick_start.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## 安装依赖

- **[Go][]**: **最近的三个 major** [releases][go-releases].
- **[trpc-go-cmdline][]**: 正确按照 [README][trpc-go-cmdline] 来安装 trpc-go-cmdline 以及相关依赖
- **[trpc-cmdline][]**: 正确按照 [README][trpc-cmdline] 来安装 trpc-cmdline 以及相关依赖

## 创建完整的项目

Expand Down Expand Up @@ -35,7 +35,7 @@ service HelloWorldService {
}
```

* 通过以下命令使用 [trpc-go-cmdline][] 来生成一个完整的项目:
* 通过以下命令使用 [trpc-cmdline][] 来生成一个完整的项目:
```shell
$ trpc create -p helloworld.proto -o out
```
Expand Down Expand Up @@ -90,7 +90,7 @@ $ tree

## 创建服务桩代码

* 在执行 trpc-go-cmdline 工具时直接添加 `--rpconly` 即可只生成服务桩代码:
* 在执行 trpc-cmdline 工具时直接添加 `--rpconly` 即可只生成服务桩代码:
```go
$ trpc create -p helloworld.proto -o out --rpconly
$ tree out
Expand All @@ -102,7 +102,7 @@ out
`-- helloworld_mock.go
```

下面列举了 [trpc-go-cmdline][] 的一些常用的命令行选项
下面列举了 [trpc-cmdline][] 的一些常用的命令行选项

* `-f`: 覆盖写入输出目录
* `-d some-dir`: 指定 proto 文件的搜索路径,可以指定多次以添加多个路径
Expand All @@ -113,12 +113,12 @@ out

## 下一步

尝试 [更多特性][features],学习更多关于 [trpc-go-cmdline][] 的 [用法][cmdline-doc]。
尝试 [更多特性][features],学习更多关于 [trpc-cmdline][] 的 [用法][cmdline-doc]。

[Go]: https://golang.org
[go-releases]: https://golang.org/doc/devel/release.html
[trpc-go-cmdline]: https://github.com/trpc-group/trpc-go-cmdline
[cmdline-releases]: https://github.com/trpc-group/trpc-go-cmdline/releases
[trpc-cmdline]: https://github.com/trpc-group/trpc-cmdline
[cmdline-releases]: https://github.com/trpc-group/trpc-cmdline/releases
[helloworld]: /examples/helloworld/
[features]: /examples/features/
[cmdline-doc]: https://github.com/trpc-group/trpc-go-cmdline/tree/main/docs
[cmdline-doc]: https://github.com/trpc-group/trpc-cmdline/tree/main/docs
2 changes: 1 addition & 1 deletion docs/user_guide/framework_conf.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ We have introduced that the startup of the program initializes the framework by

### Create Configurations through Tools

The framework configuration file can be automatically generated by [trpc-go-cmdline](https://github.com/trpc-group/trpc-go-cmdline) tool. The services defined in the PB file are automatically added to the configuration file.
The framework configuration file can be automatically generated by [trpc-cmdline](https://github.com/trpc-group/trpc-cmdline) tool. The services defined in the PB file are automatically added to the configuration file.

```shell
# generate the stub code and the framework configuration file "trpc_go.yaml" through PB file
Expand Down
2 changes: 1 addition & 1 deletion docs/user_guide/framework_conf.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ plugins:

### 通过工具创建配置

框架配置文件可以通过 [trpc-go-cmdline](https://github.com/trpc-group/trpc-go-cmdline) 工具生成。配置文件中会自动添加 PB 文件中定义的服务。
框架配置文件可以通过 [trpc-cmdline](https://github.com/trpc-group/trpc-cmdline) 工具生成。配置文件中会自动添加 PB 文件中定义的服务。

```shell
# 通过 PB 文件生成桩代码和框架配置文件 "trpc_go.yaml"
Expand Down
6 changes: 3 additions & 3 deletions docs/user_guide/server/flatbuffers.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Drawbacks:
![flatbuffers](/.resources/user_guide/server/flatbuffers/flatbuffers.png)

# Example
Firstly, install the latest version of the [trpc-go-cmdline](https://github.com/trpc-group/trpc-go-cmdline) tool.
Firstly, install the latest version of the [trpc-cmdline](https://github.com/trpc-group/trpc-cmdline) tool.

Next, use the tool to generate flatbuffers corresponding stub code, which currently supports single-send and single-receive, server/client streaming, bidirectional streaming, etc.

Expand All @@ -38,7 +38,7 @@ First, define an IDL file. Its syntax can be learned from the flatbuffers offici
namespace trpc.testapp.greeter; // Equivalent to the "package" in protobuf.

// Equivalent to the "go_package" statement in protobuf.
// Note: "attribute" is a standard syntax in flatbuffers, and the "go_package=xxx" syntax is a custom support implemented by trpc-go-cmdline.
// Note: "attribute" is a standard syntax in flatbuffers, and the "go_package=xxx" syntax is a custom support implemented by trpc-cmdline.
attribute "go_package=github.com/trpcprotocol/testapp/greeter";

table HelloReply { // "table" is equivalent to "message" in protobuf.
Expand Down Expand Up @@ -222,7 +222,7 @@ The load testing environment consisted of two machines with 8 cores, 2.5 GHz CPU
# FAQ
## Q1: How to generate stub code when other files are included in the .fbs file?

Refer to the following usage examples on https://github.com/trpc-group/trpc-go-cmdline/tree/main/testcase/flatbuffers:
Refer to the following usage examples on https://github.com/trpc-group/trpc-cmdline/tree/main/testcase/flatbuffers:

- 2-multi-fb-same-namespace: Multiple .fbs files with the same namespace are in the same directory (namespace in flatbuffers is equivalent to the package statement in protobuf), and one of the main files includes the other .fbs files.
- 3-multi-fb-diff-namespace: Multiple .fbs files are in the same directory with different namespaces. For example, the main file defining RPC references types in different namespaces.
Expand Down
6 changes: 3 additions & 3 deletions docs/user_guide/server/flatbuffers.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
![flatbuffers](/.resources/user_guide/server/flatbuffers/flatbuffers_zh_CN.png)

# 示例
首先安装最新版本 [trpc-go-cmdline](https://github.com/trpc-group/trpc-go-cmdline) 工具
首先安装最新版本 [trpc-cmdline](https://github.com/trpc-group/trpc-cmdline) 工具

然后使用该工具来生成 flatbuffers 对应的桩代码,目前已经支持单发单收、服务端/客户端流式、双向流式等

Expand All @@ -36,7 +36,7 @@
namespace trpc.testapp.greeter; // 相当于 protobuf 中的 package

// 相当于 protobuf 的 go_package 声明
// 注意:attribute 本身是 flatbuffers 的标准语法,里面加 "go_package=xxx" 这种写法则是通过 trpc-go-cmdline 中实现的自定义支持
// 注意:attribute 本身是 flatbuffers 的标准语法,里面加 "go_package=xxx" 这种写法则是通过 trpc-cmdline 中实现的自定义支持
attribute "go_package=github.com/trpcprotocol/testapp/greeter";

table HelloReply { // table 相当于 protobuf 中的 message
Expand Down Expand Up @@ -223,7 +223,7 @@ req.Message() // 访问 req 中的 message 字段
# FAQ
## Q1: .fbs 文件中 include 了其他文件,如何生成桩代码?

参考 https://github.com/trpc-group/trpc-go-cmdline/tree/main/testcase/flatbuffers 中的下面几个使用示例:
参考 https://github.com/trpc-group/trpc-cmdline/tree/main/testcase/flatbuffers 中的下面几个使用示例:

- 2-multi-fb-same-namespace: 在同一目录下有多个 .fbs 文件,每个 .fbs 文件的 namespace 都是一样的(flatbuffers 中的 namespace 等同于 protobuf 中的 package 语句),然后其中一个主文件 include 了其他 .fbs 文件
- 3-multi-fb-diff-namespace: 在同一个目录下有多个 .fbs 文件,每个 .fbs 文件的 namespace 不一样,比如定义 RPC 的主文件中引用了不同 namespace 中的类型
Expand Down
2 changes: 1 addition & 1 deletion docs/user_guide/server/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ message HelloReply {
}
```

Step 2: The corresponding stub code for the server and client can be generated by [trpc-go-cmdline](https://github.com/trpc-group/trpc-go-cmdline):
Step 2: The corresponding stub code for the server and client can be generated by [trpc-cmdline](https://github.com/trpc-group/trpc-cmdline):

```shell
trpc create -p helloworld.proto
Expand Down
2 changes: 1 addition & 1 deletion docs/user_guide/server/overview.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ message HelloReply {
}
```

第二步:通过 [trpc-go-cmdline](https://github.com/trpc-group/trpc-go-cmdline) 工具可以生成对应服务端和客户端的桩代码
第二步:通过 [trpc-cmdline](https://github.com/trpc-group/trpc-cmdline) 工具可以生成对应服务端和客户端的桩代码

```shell
trpc create -p helloworld.proto
Expand Down
2 changes: 1 addition & 1 deletion examples/features/attachment/proto/echo/echo.trpc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/features/restful/pb/helloworld.trpc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/features/rpcz/proto/helloworld.trpc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/features/stream/proto/helloworld.trpc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/helloworld/pb/helloworld.trpc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions restful/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ After understanding HttpRule, let's take a look at how to enable tRPC-Go's RESTf

**1. PB Definition**

First, update the `trpc-go-cmdline` tool to the latest version. To use the **trpc.api.http** annotation, you need
First, update the `trpc-cmdline` tool to the latest version. To use the **trpc.api.http** annotation, you need
to import a proto file:

```protobuf
Expand Down Expand Up @@ -626,7 +626,7 @@ service HelloTrpcGo {
}
```

Next, regenerate the stub code using the trpc-go-cmdline command-line tool.
Next, regenerate the stub code using the trpc-cmdline command-line tool.
Finally, add the CORS plugin to the service interceptors.

If you do not want to modify the protobuf file, RESTful also provides a code-based custom method for cross-origin requests.
Expand Down
4 changes: 2 additions & 2 deletions restful/README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ message GetMessageRequest {

**一、PB 定义**

先更新 `trpc-go-cmdline` 工具到最新版本,要使用 **trpc.api.http** 注解,需要 import 一个 proto 文件:
先更新 `trpc-cmdline` 工具到最新版本,要使用 **trpc.api.http** 注解,需要 import 一个 proto 文件:

```protobuf
import "trpc/api/annotations.proto";
Expand Down Expand Up @@ -567,7 +567,7 @@ service HelloTrpcGo {
}
```

然后,通过 trpc-go-cmdline 命令行工具重新生成桩代码。
然后,通过 trpc-cmdline 命令行工具重新生成桩代码。
最后,在 service 拦载器中配上 CORS 插件。

如果不想修改 pb。RESTful 也提供了代码自定义跨域的方式。
Expand Down
2 changes: 1 addition & 1 deletion restful/pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Pattern struct {
*httprule.PathTemplate
}

// Parse parses the url path into a *Pattern. It should only be used by trpc-go-cmdline.
// Parse parses the url path into a *Pattern. It should only be used by trpc-cmdline.
func Parse(urlPath string) (*Pattern, error) {
tpl, err := httprule.Parse(urlPath)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion stream/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ message HelloReply {

#### Generate service code

First install [trpc-go-cmdline](https://github.com/trpc-group/trpc-go-cmdline).
First install [trpc-cmdline](https://github.com/trpc-group/trpc-cmdline).

Then generate the streaming service stub code

Expand Down
2 changes: 1 addition & 1 deletion stream/README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ message HelloReply {

### 生成服务代码

首先安装 [trpc-go-cmdline](https://github.com/trpc-group/trpc-go-cmdline)
首先安装 [trpc-cmdline](https://github.com/trpc-group/trpc-cmdline)

然后生成流式服务桩代码

Expand Down
2 changes: 1 addition & 1 deletion test/protocols/test.trpc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion testdata/restful/bookstore/bookstore.trpc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion testdata/restful/helloworld/helloworld.trpc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion testdata/trpc/helloworld/helloworld.trpc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading