diff --git a/pages/common/go-bug.md b/pages/common/go-bug.md new file mode 100644 index 0000000000..768259bce8 --- /dev/null +++ b/pages/common/go-bug.md @@ -0,0 +1,8 @@ +# go bug + +> Report a bug. +> More information: . + +- Open a web page to start a bug report: + +`go bug` diff --git a/pages/common/go-build.md b/pages/common/go-build.md new file mode 100644 index 0000000000..c0e8c6d78f --- /dev/null +++ b/pages/common/go-build.md @@ -0,0 +1,20 @@ +# go build + +> Compile Go sources. +> More information: . + +- Compile a file: + +`go build {{path/to/main.go}}` + +- Compile, specifying the output filename: + +`go build -o {{path/to/binary}} {{path/to/source.go}}` + +- Compile a package: + +`go build -o {{path/to/binary}} {{path/to/package}}` + +- Compile a main package into an executable, with data race detection: + +`go build -race -o {{path/to/executable}} {{path/to/main/package}}` diff --git a/pages/common/go-clean.md b/pages/common/go-clean.md new file mode 100644 index 0000000000..803c821152 --- /dev/null +++ b/pages/common/go-clean.md @@ -0,0 +1,20 @@ +# go clean + +> Remove object files and cached files. +> More information: . + +- Print the remove commands instead of actually removing anything: + +`go clean -n` + +- Delete the build cache: + +`go clean -cache` + +- Delete all cached test results: + +`go clean -testcache` + +- Delete the module cache: + +`go clean -modcache` diff --git a/pages/common/go-doc.md b/pages/common/go-doc.md new file mode 100644 index 0000000000..d21a845873 --- /dev/null +++ b/pages/common/go-doc.md @@ -0,0 +1,24 @@ +# go doc + +> Show documentation for a package or symbol. +> More information: . + +- Show documentation for the current package: + +`go doc` + +- Show package documentation and exported symbols: + +`go doc {{encoding/json}}` + +- Show also documentation of symbols: + +`go doc -all {{encoding/json}}` + +- Show also sources: + +`go doc -all -src {{encoding/json}}` + +- Show a specific symbol: + +`go doc -all -src {{encoding/json.Number}}` diff --git a/pages/common/go-env.md b/pages/common/go-env.md new file mode 100644 index 0000000000..2820bdd4e3 --- /dev/null +++ b/pages/common/go-env.md @@ -0,0 +1,20 @@ +# go env + +> Manage environment variables used by the Go toolchain. +> More information: . + +- Show all environment variables: + +`go env` + +- Show a specific environment variable: + +`go env {{GOPATH}}` + +- Set an environment variable to a value: + +`go env -w {{GOBIN}}={{path/to/directory}}` + +- Reset an environment variable's value: + +`go env -u {{GOBIN}}` diff --git a/pages/common/go-fix.md b/pages/common/go-fix.md new file mode 100644 index 0000000000..fcef7e8572 --- /dev/null +++ b/pages/common/go-fix.md @@ -0,0 +1,8 @@ +# go fix + +> Update packages to use new APIs. +> More information: . + +- Update packages to use new APIs: + +`go fix {{packages}}` diff --git a/pages/common/go-generate.md b/pages/common/go-generate.md new file mode 100644 index 0000000000..8a1f3b746d --- /dev/null +++ b/pages/common/go-generate.md @@ -0,0 +1,8 @@ +# go generate + +> Generate Go files by running commands within source files. +> More information: . + +- Generate Go files by running commands within source files: + +`go generate` diff --git a/pages/common/go-list.md b/pages/common/go-list.md new file mode 100644 index 0000000000..5441ccf8ca --- /dev/null +++ b/pages/common/go-list.md @@ -0,0 +1,20 @@ +# go list + +> List packages or modules. +> More information: . + +- List packages: + +`go list ./...` + +- List standard packages: + +`go list std` + +- List packages in json format: + +`go list -json time net/http` + +- List module dependencies and available updates: + +`go list -m -u all` diff --git a/pages/common/go-mod.md b/pages/common/go-mod.md new file mode 100644 index 0000000000..0d18048640 --- /dev/null +++ b/pages/common/go-mod.md @@ -0,0 +1,24 @@ +# go mod + +> Module maintenance. +> More information: . + +- Initialize new module in current directory: + +`go mod init {{moduleName}}` + +- Download modules to local cache: + +`go mod download` + +- Add missing and remove unused modules: + +`go mod tidy` + +- Verify dependencies have expected content: + +`go mod verify` + +- Copy sources of all dependencies into the vendor directory: + +`go mod vendor` diff --git a/pages/common/go-version.md b/pages/common/go-version.md new file mode 100644 index 0000000000..1ed64f493a --- /dev/null +++ b/pages/common/go-version.md @@ -0,0 +1,12 @@ +# go version + +> Print Go version. +> More information: . + +- Print Go version: + +`go version` + +- Print the Go version used to build the named executable file: + +`go version {{path/to/executable}}`