9951 explained code solutions for 126 technologies

golangHow to generate query string from map

package main
import "net/url"

func main() {
  q := url.Values{}
  q.Add("a", "12")
  q.Add("b", "hello")
  encoded := q.Encode()
}ctrl + c
package main

default package declaration

func main() {

declare main function that will be launched automatically


create new Values object to generate query string


adds new param to query string object


generate query string from given values