MCPcopy Create free account
hub / github.com/antonmedv/gitmal / parseRange

Function parseRange

pkg/gitdiff/text.go:167–185  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

165}
166
167func parseRange(s string) (start int64, end int64, err error) {
168 parts := strings.SplitN(s, ",", 2)
169
170 if start, err = strconv.ParseInt(parts[0], 10, 64); err != nil {
171 nerr := err.(*strconv.NumError)
172 return 0, 0, fmt.Errorf("bad start of range: %s: %v", parts[0], nerr.Err)
173 }
174
175 if len(parts) > 1 {
176 if end, err = strconv.ParseInt(parts[1], 10, 64); err != nil {
177 nerr := err.(*strconv.NumError)
178 return 0, 0, fmt.Errorf("bad end of range: %s: %v", parts[1], nerr.Err)
179 }
180 } else {
181 end = 1
182 }
183
184 return
185}
186
187func max(a, b int64) int64 {
188 if a > b {

Callers 1

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected