Is there a function similar to PHP's isset() in Go? -
in http request, want know if request contains specific parameter, similar php's isset
function. how test in go? thanks.
once have parsed request, can check parameter's value type equal type's 0 value.
for example, can use "comma, ok" idiom check query parameters:
u, err := url.parse("http://google.com/search?q=term") if err != nil { log.fatal(err) } q := u.query() if _, ok := q["q"]; ok { // process q }
Comments
Post a Comment