MCPcopy Create free account
hub / github.com/BryanMwangi/pine / nextSegment

Function nextSegment

router.go:257–263  ·  view source on GitHub ↗

nextSegment splits path at the first '/' returning (segment, remainder). The leading '/' in remainder is consumed.

(path string)

Source from the content-addressed store, hash-verified

255// nextSegment splits path at the first '/' returning (segment, remainder).
256// The leading '/' in remainder is consumed.
257func nextSegment(path string) (seg, rest string) {
258 idx := strings.IndexByte(path, '/')
259 if idx == -1 {
260 return path, ""
261 }
262 return path[:idx], path[idx+1:]
263}
264
265// segSep returns "/" + rest when rest is non-empty, so segments can be
266// rejoined correctly during split/insert operations.

Callers 3

insertMethod · 0.85
searchMethod · 0.85
searchAnyMethodMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected