Skip to content

Commit

Permalink
chore(cwgo): remove $ prefix of bash and update prism (#897)
Browse files Browse the repository at this point in the history
Signed-off-by: rogerogers <rogers@rogerogers.com>
  • Loading branch information
rogerogers authored Dec 14, 2023
1 parent eb7e239 commit 954b073
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 273 deletions.
44 changes: 22 additions & 22 deletions content/en/docs/cwgo/getting-started/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,37 @@ After completing the environment preparation, the next step will help you get st
## Install

```shell
$ go install github.com/cloudwego/cwgo@latest
go install github.com/cloudwego/cwgo@latest
```

It's easiest to install with the go command, or you can choose to build and install from source yourself. To see where cwgo is installed, use:

```shell
$ go list -f {{.Target}} github.com/cloudwego/cwgo
go list -f {{.Target}} github.com/cloudwego/cwgo
```

To use thrift or protobuf's IDL to generate code, you need to install the corresponding compiler: [thriftgo](https://github.com/cloudwego/thriftgo) or [protoc](https://github.com/protocolbuffers/protobuf/releases).

thriftgo install:

```shell
$ GO111MODULE=on go install github.com/cloudwego/thriftgo@latest
GO111MODULE=on go install github.com/cloudwego/thriftgo@latest
```

protoc install

```shell
# brew install
$ brew install protobuf
brew install protobuf
```

```shell
# Official image installation, take macos as an example
$ wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-osx-x86_64.zip
$ unzip protoc-3.19.4-osx-x86_64.zip
$ cp bin/protoc /usr/local/bin/protoc
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-osx-x86_64.zip
unzip protoc-3.19.4-osx-x86_64.zip
cp bin/protoc /usr/local/bin/protoc
# Make sure include/google is placed under /usr/local/include
$ cp -r include/google /usr/local/include/google
cp -r include/google /usr/local/include/google
```

First, we need to install the command-line code generation tools needed to use this example:
Expand All @@ -60,14 +60,14 @@ First, we need to install the command-line code generation tools needed to use t

After the installation is successful, execute `cwgo --version` and `thriftgo --version` and you should be able to see the output of the specific version number (the version number is different, take x.x.x as an example):

```shell
$ cwgo --version
```bash
cwgo --version
vx.x.x

$ thriftgo --version
thriftgo --version
vx.x.x

$ protoc --version
protoc --version
libprotoc x.x.x
```

Expand All @@ -76,11 +76,11 @@ libprotoc x.x.x
1. If the code is placed under `$GOPATH/src`, you need to create an additional directory under `$GOPATH/src`, and then get the code after entering this directory:

```shell
$ mkdir -p $(go env GOPATH)/src/github.com/cloudwego
$ cd $(go env GOPATH)/src/github.com/cloudwego
mkdir -p $(go env GOPATH)/src/github.com/cloudwego
cd $(go env GOPATH)/src/github.com/cloudwego
```

2. If you put the code outside GOPATH, you can get it directly
2. If you put the code outside `GOPATH`, you can get it directly

## Precautions

Expand All @@ -95,14 +95,14 @@ Let's take thrift as an example
1. First create a directory
```shell
$ mkdir -p $GOPATH/src/local/cwgo_test
$ cd $GOPATH/src/local/cwgo_test
mkdir -p $GOPATH/src/local/cwgo_test
cd $GOPATH/src/local/cwgo_test
```
2. Create an idl directory
```shell
$ mkdir idl
mkdir idl
```
3. Write the idl/hello.thrift file
Expand All @@ -129,7 +129,7 @@ Let's take thrift as an example
static command line
```shell
$ cwgo server -service=a.b.c -type HTTP -idl=idl/hello.thrift
cwgo server -service=a.b.c -type HTTP -idl=idl/hello.thrift
```
dynamic command line
Expand All @@ -139,14 +139,14 @@ Let's take thrift as an example
5. Compile and run
```shell
$ go mod tidy && go mod verify
$ sh build.sh && sh output/bootstrap.sh
go mod tidy && go mod verify
sh build.sh && sh output/bootstrap.sh
```
6. Initiate the call
```shell
$ curl http://127.0.0.1:8080/ping
curl http://127.0.0.1:8080/ping
pong
```
Expand Down
2 changes: 1 addition & 1 deletion content/en/docs/cwgo/tutorials/cli/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ For parameters passed to the tool, refer to [documentation](/docs/hertz/tutorial
### Command description

```shell
$ cwgo -h
cwgo -h
NAME:
cwgo - All in one tools for CloudWeGo

Expand Down
2 changes: 1 addition & 1 deletion content/en/docs/cwgo/tutorials/client/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The cwgo tool supports generating the calling code of HTTP Client or RPC Client
Use `cwgo client -h` to view the help command for generating client code.

```sh
$ cwgo client -h
cwgo client -h
NAME:
cwgo client - generate RPC or HTTP client

Expand Down
40 changes: 20 additions & 20 deletions content/zh/docs/cwgo/getting-started/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,37 @@ cwgo 是 CloudWeGo All in one 代码生成工具,整合了各个组件的优
## 安装 cwgo 工具

```shell
$ go install github.com/cloudwego/cwgo@latest
go install github.com/cloudwego/cwgo@latest
```

用 go 命令来安装是最简单的,你也可以选择自己从源码构建和安装。要查看 cwgo 的安装位置,可以用:

```shell
$ go list -f {{.Target}} github.com/cloudwego/cwgo
go list -f {{.Target}} github.com/cloudwego/cwgo
```

要使用 thrift 或 protobuf 的 IDL 生成代码,需要安装相应的编译器:[thriftgo](https://github.com/cloudwego/thriftgo)[protoc](https://github.com/protocolbuffers/protobuf/releases)

thriftgo 安装:

```shell
$ GO111MODULE=on go install github.com/cloudwego/thriftgo@latest
GO111MODULE=on go install github.com/cloudwego/thriftgo@latest
```

protoc 安装

```shell
# brew 安装
$ brew install protobuf
brew install protobuf
```

```shell
# 官方镜像安装,以 macos 为例
$ wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-osx-x86_64.zip
$ unzip protoc-3.19.4-osx-x86_64.zip
$ cp bin/protoc /usr/local/bin/protoc
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-osx-x86_64.zip
unzip protoc-3.19.4-osx-x86_64.zip
cp bin/protoc /usr/local/bin/protoc
# 确保 include/google 放入 /usr/local/include下
$ cp -r include/google /usr/local/include/google
cp -r include/google /usr/local/include/google
```

首先,我们需要安装使用本示例所需要的命令行代码生成工具:
Expand All @@ -61,13 +61,13 @@ $ cp -r include/google /usr/local/include/google
安装成功后,执行 `cwgo --version``thriftgo --version` 应该能够看到具体版本号的输出(版本号有差异,以 x.x.x 示例):

```shell
$ cwgo --version
cwgo --version
vx.x.x

$ thriftgo --version
thriftgo --version
vx.x.x

$ protoc --version
protoc --version
libprotoc x.x.x
```

Expand All @@ -76,8 +76,8 @@ libprotoc x.x.x
1. 若将代码放置于 `$GOPATH/src` 下,需在 `$GOPATH/src` 下创建额外目录,进入该目录后再获取代码:

```shell
$ mkdir -p $(go env GOPATH)/src/github.com/cloudwego
$ cd $(go env GOPATH)/src/github.com/cloudwego
mkdir -p $(go env GOPATH)/src/github.com/cloudwego
cd $(go env GOPATH)/src/github.com/cloudwego
```

2. 若将代码放置于 GOPATH 之外,可直接获取
Expand All @@ -95,14 +95,14 @@ cwgo 的具体使用请参考[命令行工具](/zh/docs/cwgo/tutorials/cli)
1. 首先创建一个目录

```shell
$ mkdir -p $GOPATH/src/local/cwgo_test
$ cd $GOPATH/src/local/cwgo_test
mkdir -p $GOPATH/src/local/cwgo_test
cd $GOPATH/src/local/cwgo_test
```

2. 创建一个 idl 目录

```shell
$ mkdir idl
mkdir idl
```

3. 编写 idl/hello.thrift 文件
Expand All @@ -129,7 +129,7 @@ cwgo 的具体使用请参考[命令行工具](/zh/docs/cwgo/tutorials/cli)
静态命令行

```shell
$ cwgo server -service=a.b.c -type HTTP -idl=idl/hello.thrift
cwgo server -service=a.b.c -type HTTP -idl=idl/hello.thrift
```

动态命令行
Expand All @@ -139,14 +139,14 @@ cwgo 的具体使用请参考[命令行工具](/zh/docs/cwgo/tutorials/cli)
5. 编译运行

```shell
$ go mod tidy && go mod verify
$ sh build.sh && sh output/bootstrap.sh
go mod tidy && go mod verify
sh build.sh && sh output/bootstrap.sh
```

6. 发起调用

```shell
$ curl http://127.0.0.1:8080/ping
curl http://127.0.0.1:8080/ping
pong
```

Expand Down
Loading

1 comment on commit 954b073

@vercel
Copy link

@vercel vercel bot commented on 954b073 Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.