46elks / 46elks-getting-started

An introduction to the 46elks API with code examples
https://46elks.com/docs/
52 stars 26 forks source link

Illegal rune litteral in Go example #57

Open zeidlitz opened 3 months ago

zeidlitz commented 3 months ago

in golang-calls.go on line 17 the error "Illegal rune literal" occurs because in Go, single quotes are used for character (rune) literals, not for strings. However, in your code, you are trying to define a JSON string within single quotes, which Go interprets as a rune literal.

This can easily be adjusted with a set of backticks or double quotes for string literals like so:

data := url.Values{
    "from":        {"+46709751949"},
    "to":          {"+46700000000"},
    "voice_start": {`{"connect":"+461890510"}`},
}

Might be very nitpick but this will make so the code example can compile out of the box ✌