-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreturns.go
More file actions
33 lines (24 loc) · 783 Bytes
/
returns.go
File metadata and controls
33 lines (24 loc) · 783 Bytes
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
package consistent
import (
"go/ast"
"golang.org/x/tools/go/analysis"
)
var returnsFlagAllowedValues = []string{flagIgnore, fieldListExplicit, fieldListCompact}
func checkReturnsFunc(pass *analysis.Pass, fun *ast.FuncDecl, mode string) {
if !namedFields(fun.Type.Results) {
return
}
checkFieldList(pass, fun.Type.Results, "function return values", mode)
}
func checkReturnsMethod(pass *analysis.Pass, method *ast.FuncDecl, mode string) {
if !namedFields(method.Type.Results) {
return
}
checkFieldList(pass, method.Type.Results, "method return values", mode)
}
func checkReturnsFuncLit(pass *analysis.Pass, fun *ast.FuncLit, mode string) {
if !namedFields(fun.Type.Results) {
return
}
checkFieldList(pass, fun.Type.Results, "function return values", mode)
}