mirror of
https://github.com/golang/go
synced 2024-11-25 09:07:58 -07:00
net/url: add example for JoinPath
Change-Id: Ibbd2bda7ff2ea3c782ad41f6f00ad62849a4f066 Reviewed-on: https://go-review.googlesource.com/c/go/+/618756 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
39fbc4c29a
commit
a9abbac4c8
@ -253,6 +253,18 @@ func ExampleURL_IsAbs() {
|
||||
// true
|
||||
}
|
||||
|
||||
func ExampleURL_JoinPath() {
|
||||
u, err := url.Parse("https://example.com/foo/bar")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Println(u.JoinPath("baz", "qux"))
|
||||
|
||||
// Output:
|
||||
// https://example.com/foo/bar/baz/qux
|
||||
}
|
||||
|
||||
func ExampleURL_MarshalBinary() {
|
||||
u, _ := url.Parse("https://example.org")
|
||||
b, err := u.MarshalBinary()
|
||||
|
Loading…
Reference in New Issue
Block a user