(vr *types.Var, suffix string)
| 61 | } |
| 62 | |
| 63 | func varName(vr *types.Var, suffix string) string { |
| 64 | name := vr.Name() |
| 65 | if name != "" && name != "_" { |
| 66 | return name + suffix |
| 67 | } |
| 68 | |
| 69 | name = varNameForType(vr.Type()) + suffix |
| 70 | |
| 71 | switch name { |
| 72 | case "mock", "callInfo", "break", "default", "func", "interface", "select", "case", "defer", "go", "map", "struct", |
| 73 | "chan", "else", "goto", "package", "switch", "const", "fallthrough", "if", "range", "type", "continue", "for", |
| 74 | "import", "return", "var", |
| 75 | // avoid shadowing basic types |
| 76 | "string", "bool", "byte", "rune", "uintptr", |
| 77 | "int", "int8", "int16", "int32", "int64", |
| 78 | "uint", "uint8", "uint16", "uint32", "uint64", |
| 79 | "float32", "float64", "complex64", "complex128": |
| 80 | name += "Param" |
| 81 | } |
| 82 | |
| 83 | return name |
| 84 | } |
| 85 | |
| 86 | // varNameForType generates a name for the variable using the type |
| 87 | // information. |
no test coverage detected
searching dependent graphs…