blob: d7a712df4e3b1914b439d7d4402fe8b3f3b9f69e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package internal
import "net/url"
type URL struct {
*url.URL
}
func (u *URL) MarshalText() ([]byte, error) {
return []byte(u.URL.String()), nil
}
func (u *URL) UnmarshalText(buf []byte) error {
var err error
u.URL, err = url.Parse(string(buf))
if err != nil {
return err
}
return nil
}
func MustURL(arg string) *URL {
u, err := url.Parse(arg)
if err != nil {
panic(err)
}
return &URL{u}
}
|