(s string, base, bitSize int)
| 155 | } |
| 156 | |
| 157 | func parseUint(s string, base, bitSize int) (uint64, error) { |
| 158 | v, err := strconv.ParseUint(s, base, bitSize) |
| 159 | if err != nil { |
| 160 | intValue, intErr := strconv.ParseInt(s, base, bitSize) |
| 161 | // 1. Handle negative values greater than MinInt64 (and) |
| 162 | // 2. Handle negative values lesser than MinInt64 |
| 163 | if intErr == nil && intValue < 0 { |
| 164 | return 0, nil |
| 165 | } else if intErr != nil && |
| 166 | intErr.(*strconv.NumError).Err == strconv.ErrRange && |
| 167 | intValue < 0 { |
| 168 | return 0, nil |
| 169 | } |
| 170 | return 0, err |
| 171 | } |
| 172 | return v, nil |
| 173 | } |
| 174 | |
| 175 | func parseKV(raw string) (string, uint64, error) { |
| 176 | parts := strings.Fields(raw) |
no outgoing calls
no test coverage detected
searching dependent graphs…