title: How to parse/create a dynamic url in golang
body: <p>I am trying to create a buildURL function that can generate an url. However I have run into a problem when facing a dynamic url.</p>
  
  <pre><code>type ShopifyDownloader struct {
      Domain      string
      AccessToken string
  }
  
  func (sd *ShopifyDownloader) BuildURL(Path string, Query map[string]string) (string, error) {
      u, err := url.Parse("https://123.myshopify.com/admin/orders/count.json?access_token=123")
      if err != nil {
          fmt.Println("Cannot parse", err)
          return "", err
      }
      u.Host = sd.Domain
      u.Path = Path
      params := url.Values{}
      for key, value := range Query {
          params.Add(key, value)
      }
      u.RawQuery = params.Encode()
      nu := u.String()
      var buffer bytes.Buffer
      buffer.WriteString(nu)
      buffer.WriteString("?access_token=")
      buffer.WriteString(sd.AccessToken)
      bu := buffer.String()
      return bu, err
  }
  </code></pre>
  
  <p>It takes domain, token, path and queries and generate an url in string. However it does not work with a dynamic path (with id) like 
  this /admin/orders/#{id}.json or this /admin/products/#{id}/images/#{id}.json
  Does anybody have any suggestion?</p>