Standard library / net/url
url.Values.Add()
Append a value without replacing existing values. Expected stdout: '[1 2]\n'.
Formal Syntax & Structure
go syntaxgo
func (v Values) Add(key, value string)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| key | string | Header or query parameter name. |
| value | string | Value to store. |
Working Example
Example Snippetgo
package main
import ( "fmt" "net/url")
func main() { v := url.Values{"a": {"1"}}; v.Add("a", "2"); fmt.Println(v["a"]) }
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) }}