loading...

Golang Gorilla Schema HTML Forms

#go
divshekhar profile image Divyanshu Shekhar ・1 min read

Golang Gorilla Schema

func readForm(r *http.Request) *User {
    r.ParseForm()
    user := new(User)
    decoder := schema.NewDecoder()
    decodeErr := decoder.Decode(user, r.PostForm)
    if decodeErr != nil {
        log.Println("Error mapping parsed form data to struct : ", decodeErr)
    }
    return user

}

First of all, learn about Golang HTML Forms then use gorilla schema.

Learn and get the full source code to get the form data using the Gorilla Schema in Golang.

Discussion

pic
Editor guide