Standard library / net/http
http.ErrNoLocation
Sentinel returned when Response.Location has no Location header. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
var ErrNoLocation errorWorking Example
Example Snippetgo
package main
import ( "errors" "fmt" "net/http")
func main() { r := &http.Response{Header: make(http.Header)} _, e := r.Location() fmt.Println(errors.Is(e, http.ErrNoLocation))}
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}