go
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGo Programming Language
Go 编程语言
Guidelines for working effectively with Go projects.
高效处理Go项目的指南。
Reading Dependency Source Files
阅读依赖项源文件
To see source files from a dependency, or to answer questions about a dependency:
bash
go mod download -json MODULEUse the returned Dir path to read the source files.
若要查看依赖项的源文件,或解答关于依赖项的问题:
bash
go mod download -json MODULE使用返回的Dir路径来读取源文件。
Reading Documentation
阅读文档
Use go doc to read documentation for packages, types, functions, etc:
bash
go doc foo.Bar # Documentation for a specific symbol
go doc -all foo # All documentation for a package使用go doc来查看包、类型、函数等的文档:
bash
go doc foo.Bar # 查看特定符号的文档
go doc -all foo # 查看某个包的全部文档Running Programs
运行程序
Use go run instead of go build to avoid leaving behind build artifacts:
bash
go run . # Run the current package
go run ./cmd/foo # Run a specific command使用go run而非go build,避免留下构建产物:
bash
go run . # 运行当前包
go run ./cmd/foo # 运行特定命令