Skip to content

Go

Ada has a Go client available on GitHub.

Go 1.24 or better.

Terminal window
go get github.com/ada-url/goada
import (
"github.com/ada-url/goada"
"fmt"
)
url, err := goada.New("https://www.GOogle.com")
if err != nil {
// handle error
}
fmt.Println(url.Href()) // https://www.google.com/
url.SetProtocol("http:")
url.SetHash("goada")
fmt.Println(url.Hash()) // #goada
fmt.Println(url.Href()) // http://www.google.com/#goada

Go’s built-in net/url follows RFC 3986 rather than the WHATWG URL standard used by browsers. This leads to differences in practice:

String sourceValue
Inputhttps://www.7-Eleven.com/Home/../Privacy/Montréal
Ada (goada)https://www.xn--7eleven-506c.com/Home/Privacy/Montr%C3%A9al
Go net/urlhttps://www.7-Eleven.com/Home/../Privacy/Montr%C3%A9al

Specifically, Go’s net/url:

  • Does not normalize hostnames (no IDNA/Punycode encoding)
  • Does not process path components (no dot-segment removal)
  • Does not encode special characters in query parameters the same way browsers do

Benchmarks against the top 100k URLs dataset:

Libraryns/op per URLWHATWG compliant
github.com/ada-url/goada22.0Yes
Go net/url19.4No
github.com/nlnwa/whatwg-url139.0Yes

goada is the fastest WHATWG-compliant URL parser available for Go.

Run go test -bench BenchmarkTop100 -run - to reproduce these results.