printexpression

package
v1.1.0-beta.0...-a5832b4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL