go-*: add Chinese translation (#8266)

pull/1/head
Minghao Liu 2022-08-01 04:25:57 +08:00 committed by GitHub
parent 79d47906f8
commit b15ee904f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,8 @@
# go bug
> 报告一个错误。
> 更多信息:<https://golang.org/cmd/go/#hdr-Start_a_bug_report>.
- 打开一个网页并开始报告错误:
`go bug`

View File

@ -0,0 +1,20 @@
# go build
> 编译 Go 源代码。
> 更多信息:<https://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies>.
- 编译package main文件输出为不带扩展名的文件名
`go build {{路径/到/main.go}}`
- 编译,并指定输出文件名:
`go build -o {{路径/到/二进制文件}} {{路径/到/源文件.go}}`
- 编译一个包:
`go build -o {{路径/到/二进制文件}} {{路径/到/包}}`
- 编译 main 包为可执行文件,并开启数据竞态检测:
`go build -race -o {{路径/到/可执行文件}} {{路径/到/main/包}}`

View File

@ -0,0 +1,20 @@
# go clean
> 移除目标文件和缓存文件。
> 更多信息:<https://golang.org/cmd/go/#hdr-Remove_object_files_and_cached_files>.
- 只打印移除命令,而不会真正移除任何东西:
`go clean -n`
- 删除编译缓存:
`go clean -cache`
- 删除所有测试结果缓存:
`go clean -testcache`
- 删除模块缓存:
`go clean -modcache`

24
pages.zh/common/go-doc.md Normal file
View File

@ -0,0 +1,24 @@
# go doc
> 显示包或符号的文档。
> 更多信息:<https://golang.org/cmd/go/#hdr-Show_documentation_for_package_or_symbol>.
- 显示当前包的文档:
`go doc`
- 显示包文档及导出符号:
`go doc {{encoding/json}}`
- 同时显示符号的文档:
`go doc -all {{encoding/json}}`
- 同时显示源代码:
`go doc -all -src {{encoding/json}}`
- 显示指定的符号:
`go doc -all -src {{encoding/json.Number}}`

20
pages.zh/common/go-env.md Normal file
View File

@ -0,0 +1,20 @@
# go env
> 管理 Go 工具链使用的环境变量。
> 更多信息:<https://golang.org/cmd/go/#hdr-Print_Go_environment_information>.
- 显示所有环境变量:
`go env`
- 显示指定的环境变量:
`go env {{GOPATH}}`
- 设置某个环境变量为指定值:
`go env -w {{GOBIN}}={{路径/到/目录}}`
- 重置某个环境变量的值:
`go env -u {{GOBIN}}`