mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-22 15:02:09 +02:00
go-vet: add page (#6832)
This commit is contained in:
parent
bb83c2b705
commit
b5aa93b291
1 changed files with 29 additions and 0 deletions
29
pages/common/go-vet.md
Normal file
29
pages/common/go-vet.md
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
# go vet
|
||||||
|
|
||||||
|
> Check Go source code and report suspicious constructs (e.g. lint your Go source files).
|
||||||
|
> Go vet returns a non-zero exit code if problems are found; returns a zero exit code if no problems are found.
|
||||||
|
> More information: <https://pkg.go.dev/cmd/vet>.
|
||||||
|
|
||||||
|
- Check the Go package in the current directory:
|
||||||
|
|
||||||
|
`go vet`
|
||||||
|
|
||||||
|
- Check the Go package in the specified path:
|
||||||
|
|
||||||
|
`go vet {{path/to/file_or_directory}}`
|
||||||
|
|
||||||
|
- List available checks that can be run with go vet:
|
||||||
|
|
||||||
|
`go tool vet help`
|
||||||
|
|
||||||
|
- View details and flags for a particular check:
|
||||||
|
|
||||||
|
`go tool vet help {{check_name}}`
|
||||||
|
|
||||||
|
- Display offending lines plus N lines of surrounding context:
|
||||||
|
|
||||||
|
`go vet -c={{N}}`
|
||||||
|
|
||||||
|
- Output analysis and errors in JSON format:
|
||||||
|
|
||||||
|
`go vet -json`
|
Loading…
Add table
Reference in a new issue