Merge branch 'gonejack-master'

client-spec/clarity
Starbeamrainbowlabs 2020-05-21 12:37:23 +01:00
commit ff6e9c4694
No known key found for this signature in database
GPG Key ID: 1BE5172E637709C2
10 changed files with 164 additions and 0 deletions

8
pages/common/go-bug.md Normal file
View File

@ -0,0 +1,8 @@
# go bug
> Report a bug.
> More information: <https://golang.org/cmd/go/#hdr-Start_a_bug_report>.
- Open a web page to start a bug report:
`go bug`

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

@ -0,0 +1,20 @@
# go build
> Compile Go sources.
> More information: <https://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies>.
- 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}}`

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

@ -0,0 +1,20 @@
# go clean
> Remove object files and cached files.
> More information: <https://golang.org/cmd/go/#hdr-Remove_object_files_and_cached_files>.
- 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`

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

@ -0,0 +1,24 @@
# go doc
> Show documentation for a package or symbol.
> More information: <https://golang.org/cmd/go/#hdr-Show_documentation_for_package_or_symbol>.
- 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}}`

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

@ -0,0 +1,20 @@
# go env
> Manage environment variables used by the Go toolchain.
> More information: <https://golang.org/cmd/go/#hdr-Print_Go_environment_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}}`

8
pages/common/go-fix.md Normal file
View File

@ -0,0 +1,8 @@
# go fix
> Update packages to use new APIs.
> More information: <https://golang.org/cmd/go/#hdr-Update_packages_to_use_new_APIs>.
- Update packages to use new APIs:
`go fix {{packages}}`

View File

@ -0,0 +1,8 @@
# go generate
> Generate Go files by running commands within source files.
> More information: <https://golang.org/cmd/go/#hdr-Generate_Go_files_by_processing_source>.
- Generate Go files by running commands within source files:
`go generate`

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

@ -0,0 +1,20 @@
# go list
> List packages or modules.
> More information: <https://golang.org/cmd/go/#hdr-List_packages_or_modules>.
- 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`

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

@ -0,0 +1,24 @@
# go mod
> Module maintenance.
> More information: <https://golang.org/cmd/go/#hdr-Module_maintenance>.
- 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`

View File

@ -0,0 +1,12 @@
# go version
> Print Go version.
> More information: <https://golang.org/cmd/go/#hdr-Print_Go_version>.
- Print Go version:
`go version`
- Print the Go version used to build the named executable file:
`go version {{path/to/executable}}`