Slide 5
Slide 5 text
net/url JoinPath (Go 1.19)
- elem を base と結合し ./ や ../ が取り除かれた URL 文字列を返す
- 内部では url.Parse したあとに URL.JoinPath (Go 1.19) を呼んでいる
// JoinPath returns a URL string with the provided path elements joined to
// the existing path of base and the resulting path cleaned of any ./ or ../
elements.
func JoinPath(base string, elem ...string) (result string, err error) {
url, err := Parse(base)
if err != nil {
return
}
result = url.JoinPath(elem...).String()
return
}