diff --git a/cmd/xrpc/README.md b/cmd/xrpc/README.md index bff0287..8d32477 100644 --- a/cmd/xrpc/README.md +++ b/cmd/xrpc/README.md @@ -1,5 +1,5 @@ # xrpc 说明 -English(README.md) | 中文 +[English](README_en.md) | 中文 xrpc是用来自动生成rpc服务接口信息代码的工具 @@ -9,7 +9,7 @@ xrpc是用来自动生成rpc服务接口信息代码的工具 go install github.com/yc90s/xrpc/cmd/xrpc@latest ``` -2. 编写接口文件hello.service, 定义一个服务`HelloService`, 它提供两个接口 +2. 编写一个接口文件`hello.service`如下, 它定义了一个服务`HelloService`, 包含两个接口 ``` package main diff --git a/cmd/xrpc/README_en.md b/cmd/xrpc/README_en.md index d140ec9..43a9502 100644 --- a/cmd/xrpc/README_en.md +++ b/cmd/xrpc/README_en.md @@ -1,15 +1,15 @@ # xrpc demo -English | 中文(README_cn.md) +English | [中文](README.md) xrpc is a tool used to automatically generate RPC service interface information codes. ## Getting Started -1. download xrpc +1. Download xrpc ```git go install github.com/yc90s/xrpc/cmd/xrpc@latest ``` -2. write the interface file hello.service and define a service called HelloService, which provides two interfaces +2. Write the interface file `hello.service` as follows, which defines a service `HelloService` that includes two interfaces ``` package main @@ -19,7 +19,7 @@ service HelloService { } ``` -3. Generate code. Execute the following command to generate a hello. service. go file in the current directory, which defines the rpc interface information of the 'HelloService' service +3. Generate code. Execute the following command to generate a hello. service. go file in the current directory, which defines the rpc interface information of the `HelloService` service ``` xrpc -out ./ hello.service ``` @@ -30,20 +30,20 @@ xrpc -out ./ hello.service Maximizing the closeness of interface files to Golang's native syntax. 1. Define package name -Each service needs to start with 'package', followed by the module's package name, which supports numbers, letters, and underscores. +Each service needs to start with `package`, followed by the module's package name, which supports numbers, letters, and underscores. ``` package main ``` 2. import package -You can use the 'import' keyword to import other dependent packages, and each 'import' can only import one package. +You can use the `import` keyword to import other dependent packages, and each `import` can only import one package. ``` import "github.com/yc90s/xrpc/examples/protobuf/pb" import "fmt" ``` 3. Define Services -An interface file can define multiple services, with the keyword 'service' indicating the definition of a service, followed by the service name. +An interface file can define multiple services, with the keyword `service` indicating the definition of a service, followed by the service name. ``` service HelloService { diff --git a/cmd/xrpc/main.go b/cmd/xrpc/main.go index f9efcf3..f5dc5f7 100644 --- a/cmd/xrpc/main.go +++ b/cmd/xrpc/main.go @@ -6,6 +6,8 @@ import ( "html/template" "os" "path/filepath" + + "github.com/yc90s/xrpc" ) const tmplService = `// Code generated by xrpc. DO NOT EDIT. @@ -124,7 +126,7 @@ func main() { flag.Parse() if version { - fmt.Println("xrpc v1.0.3") + fmt.Println(xrpc.Version) return } diff --git a/version.go b/version.go index 9073685..7790027 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package xrpc -const Version = "v1.0.3" +const Version = "v1.0.4"