Standard library / html/template
html/template.URL
Trusted URL content; suppresses scheme filtering, so do not cast untrusted URLs. Expected stdout: '<a href="/docs">link</a>\n'.
Formal Syntax & Structure
go syntaxgo
type URL stringWorking Example
Example Snippetgo
package main
import ( "fmt" "html/template" "os")
func check(e error) { if e != nil { panic(e) }}
func main() { t := template.Must(template.New("x").Parse("<a href=\"{{.}}\">link</a>")) check(t.Execute(os.Stdout, template.URL("/docs"))) fmt.Println()}