-
Notifications
You must be signed in to change notification settings - Fork 16
/
go_vet.cli.txt
90 lines (68 loc) · 5.65 KB
/
go_vet.cli.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
GO_VET
VERSION ==> #See Go language
RELATED DOCUMENTATION ==> #See Go language
ALTERNATIVES ==> # - gofmt: styling issues
# - go build: compile-time errors
# - go vet: runtime errors
# - msan: reading unitialized VARs
/=+===============================+=\
/ : : \
)==: GENERAL :==(
\ :_______________________________: /
\=+===============================+=/
go vet IMPORT_PATHS #Lints for programming errors that cannot be caught by compilers, because not 100% sure it is error
#Exit code non-0 if error
#Runs all RULE by default
#Can be run by go test (see its doc)
-RULE=true #Only run that RULE
-RULE=false #Do not run that RULE
-c=NUM #Show source, with NUM lines around.
#-1 (def) to disable.
-json #JSON output
-vettool=BIN_PATH #Use a different linter
-ANY_GO_BUILD_FLAG #
/=+===============================+=\
/ : : \
)==: RULES :==(
\ :_______________________________: /
\=+===============================+=/
unreachable #Unreachable code
assign #Useless assignments like VAR = VAR
bools #Common mistakes with BOOL
shift #Wrong << >>
stringintconv #string(NUM) except string(BYTE|RUNE)
loopclosure #Closure of goroutine|deferred FUNC inside a for loop, use VAR iterated by that for loop
nilfunc #FUNC == nil (might have meant FUNC() == nil)
ifaceassert #INTERFACE.(TYPE) known to always fail
unsafeptr #Invalid conversions with uintptr|unsafe.Pointer
composites #Positional arguments to an inline STRUCT from a different PACKAGE
composites.whitelist #'STRUCT,...'
structtag #STRUCT tags conventions
stdmethods #When using standard library INTERFACEs, check types
unusedresult #Return value not used from a standard library FUNC with no side effects
unusedresult.funcs "FUNC,..."
unusedresult.stringmethods
"METHOD,..." #Customize
errorsas #Wrong argument type to errors.As()
atomic #Common mistakes with sync/atomic
copylocks #Passing sync.* as value instead of using pointers
lostcancel #Ensure FUNC from context.With*()->FUNC is called
printf #Check printf-like FUNC arguments
#By default checks all the ones from standard library
printf.funcs "STR,..." #Additional FUNCs to check
unmarshal #Wrong arugment to json.Unmarshal()
httpresponse #defer resp.Body.Close() before checking err != nil
tests #Common mistakes in tests
buildtag #+build tags syntax errors
asmdecl #Mismatch between ASM and Go
cgocall #Passing a CHAN|MAP|FUNC|SLICE to C, with cgo
/=+===============================+=\
/ : : \
)==: MSAN :==(
\ :_______________________________: /
\=+===============================+=/
go build|tool compile|link -msan #Use LLVM Memory Sanitizer, which lints against reading uninititalized VARs.
#Done runtime, i.e. should only be done during development.
#Only supported on linux/adm64|arm64.