prometheus/vendor/github.com/aws/aws-sdk-go/internal/sdkuri/path.go
Tariq Ibrahim 1c0df5b7d1
update consul and dns dependencies
Signed-off-by: Tariq Ibrahim <tariq181290@gmail.com>
2019-05-20 11:09:08 -07:00

24 lines
453 B
Go

package sdkuri
import (
"path"
"strings"
)
// PathJoin will join the elements of the path delimited by the "/"
// character. Similar to path.Join with the exception the trailing "/"
// character is preserved if present.
func PathJoin(elems ...string) string {
if len(elems) == 0 {
return ""
}
hasTrailing := strings.HasSuffix(elems[len(elems)-1], "/")
str := path.Join(elems...)
if hasTrailing && str != "/" {
str += "/"
}
return str
}