MCPcopy Index your code
hub / github.com/maruel/panicparse / splitPath

Function splitPath

stack/context.go:963–981  ·  view source on GitHub ↗

splitPath splits a path using "/" as separator into its components. The first item has its initial path separator kept.

(p string)

Source from the content-addressed store, hash-verified

961//
962// The first item has its initial path separator kept.
963func splitPath(p string) []string {
964 if p == "" {
965 return nil
966 }
967 var out []string
968 s := ""
969 for _, c := range p {
970 if c != '/' || (len(out) == 0 && strings.Count(s, "/") == len(s)) {
971 s += string(c)
972 } else if s != "" {
973 out = append(out, s)
974 s = ""
975 }
976 }
977 if s != "" {
978 out = append(out, s)
979 }
980 return out
981}
982
983// isFile returns true if the path is a valid file.
984func isFile(p string) bool {

Callers 4

TestSplitPathFunction · 0.85
TestIsGomoduleFunction · 0.85
initFunction · 0.85
findRootsMethod · 0.85

Calls

no outgoing calls

Tested by 3

TestSplitPathFunction · 0.68
TestIsGomoduleFunction · 0.68
initFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…