Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Analyzer = &analysis.Analyzer{ Name: "printexpression", Doc: `Avoid printing expression directly.`, Requires: []*analysis.Analyzer{inspect.Analyzer}, Run: run, }
Analyzer defines the linter for `emptynil` check
This linter avoids calling `fmt.Println(expr)` or `fmt.Printf(\"%s\", expr)` directly, because `Expression` doesn't implement `String()` method, so it will print the address or internal state of the expression. It handles the following function call: 1. `fmt.Println(expr)` 2. `fmt.Printf(\"%s\", expr)` 4. `fmt.Sprintf(\"%s\", expr)` 5. `(*Error).GenWithStack/GenWithStackByArgs/FastGen/FastGenByArgs`
Every struct which implemented `StringWithCtx` but not implemented `String` cannot be used as an argument.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.