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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -