I am not sure if this is what you are asking but you can use the u.Path
attribute to get the path of the url or any of the attributes specified by URL
type URL struct {
Scheme string
Opaque string // encoded opaque data
User *Userinfo // username and password information
Host string // host or host:port
Path string
RawQuery string // encoded query values, without '?'
Fragment string // fragment for references, without '#'
}
// scheme://[userinfo@]host/path[?query][#fragment]
Example:
package main
import (
"fmt"
"net/url"
)
func main() {
u, _ := url.Parse("http://www.test.com/url?foo=bar&foo=baz#this_is_fragment")
fmt.Println("full uri:", u.String())
fmt.Println("scheme:", u.Scheme)
fmt.Println("opaque:", u.Opaque)
fmt.Println("Host:", u.Host)
fmt.Println("Path", u.Path)
fmt.Println("Fragment", u.Fragment)
fmt.Println("RawQuery", u.RawQuery)
fmt.Printf("query: %#v", u.Query())
}
http://play.golang.org/p/mijE73rUgw