MCPcopy
hub / github.com/tinode/chat / parseVersionPart

Function parseVersionPart

server/utils.go:285–301  ·  view source on GitHub ↗

Parse one component of a semantic version string.

(vers string)

Source from the content-addressed store, hash-verified

283
284// Parse one component of a semantic version string.
285func parseVersionPart(vers string) int {
286 end := strings.IndexFunc(vers, func(r rune) bool {
287 return !unicode.IsDigit(r)
288 })
289
290 t := 0
291 var err error
292 if end > 0 {
293 t, err = strconv.Atoi(vers[:end])
294 } else if len(vers) > 0 {
295 t, err = strconv.Atoi(vers)
296 }
297 if err != nil || t > 0x1fff || t <= 0 {
298 return 0
299 }
300 return t
301}
302
303// Parses semantic version string in the following formats:
304//

Callers 1

parseVersionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…