(expr *ast.BasicLit)
| 105 | } |
| 106 | |
| 107 | func parseBasicLit(expr *ast.BasicLit) (interface{}, error) { |
| 108 | var err error |
| 109 | |
| 110 | if expr.Kind.String() == "INT" { |
| 111 | var res int64 |
| 112 | res, err = strconv.ParseInt(expr.Value, 10, 0) |
| 113 | if err != nil { |
| 114 | return nil, err |
| 115 | } |
| 116 | return int(res), nil |
| 117 | } |
| 118 | |
| 119 | if expr.Kind.String() == "FLOAT" { |
| 120 | var res float64 |
| 121 | res, err = strconv.ParseFloat(expr.Value, 0) |
| 122 | if err != nil { |
| 123 | return nil, err |
| 124 | } |
| 125 | return res, nil |
| 126 | } |
| 127 | |
| 128 | if expr.Kind.String() == "STRING" { |
| 129 | return expr.Value[1 : len(expr.Value)-1], nil |
| 130 | } |
| 131 | |
| 132 | return expr.Value, nil |
| 133 | } |
no outgoing calls
no test coverage detected