MCPcopy Create free account
hub / github.com/bep/s3deploy / pathJoin

Function pathJoin

lib/url.go:81–91  ·  view source on GitHub ↗

Like path.Join, but preserves trailing slash..

(elem ...string)

Source from the content-addressed store, hash-verified

79
80// Like path.Join, but preserves trailing slash..
81func pathJoin(elem ...string) string {
82 if len(elem) == 0 {
83 return ""
84 }
85 hadSlash := strings.HasSuffix(elem[len(elem)-1], "/")
86 p := path.Join(elem...)
87 if hadSlash {
88 p += "/"
89 }
90 return p
91}
92
93// pathClean works like path.Clean but will always preserve a trailing slash.
94func pathClean(p string) string {

Callers 3

planMethod · 0.85
KeyMethod · 0.85
TestPathJoinFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestPathJoinFunction · 0.68