Top "Go" questions

Go is an open-source programming language.

delete map[key] in go?

I have a map: var sessions = map[string] chan int{} How do I delete sessions[key]? I tried: sessions[key] = …

map go
cannot convert data (type interface {}) to type string: need type assertion

I am pretty new to go and I was playing with this notify package. At first I had code that …

go type-mismatch
Delete element in a slice

func main() { a := []string{"Hello1", "Hello2", "Hello3"} fmt.Println(a) // [Hello1 Hello2 Hello3] a = append(a[:0], a[1:]...) fmt.Println(a) // […

go
Cross-Origin Request Blocked

So I've got this Go http handler that stores some POST content into the datastore and retrieves some other info …

ajax google-app-engine go cors firefox-os
How to use custom packages

I'm trying to create and use a custom package in Go. It's probably something very obvious but I cannot find …

import package go
Access HTTP response as string in Go

I'd like to parse the response of a web request, but I'm getting trouble accessing it as string. func main() { …

networking go
Extracting substrings in Go

I'm trying to read an entire line from the console (including whitespace), then process it. Using bufio.ReadString, the newline …

go substring
How to parse unix timestamp to time.Time

I'm trying to parse an Unix timestamp but I get out of range error. That doesn't really makes sense to …

go time unix-timestamp
When is the init() function run?

I've tried to find a precise explanation of what the init() function does in Go. I read what Effective Go …

go init
Declare a constant array

I have tried: const ascii = "abcdefghijklmnopqrstuvwxyz" const letter_goodness []float32 = { .0817,.0149,.0278,.0425,.1270,.0223,.0202, .0609,.0697,.0015,.0077,.0402,.0241,.0675, .0751,.0193,.0009,.0599,.0633,.0906,.0276, .0098,.0236,.0015,.0197,.0007 } const letter_goodness = { .0817,.0149,.0278,.0425,.1270,.0223,.0202, .0609,.0697,.0015,.0077,.0402,.0241,.0675, .0751,.0193,.0009,.0599,.0633,.0906,.0276, .0098,.0236,.0015,.0197,.0007 } const letter_goodness = []float32 { .0817,.0149,.0278,.0425,.1270,.0223,.0202, .0609,.0697,.0015,.0077,.0402,.0241,.0675, .0751,.0193,.0009,.0599,.0633,.0906,.0276, .0098,.0236,.0015,.0197,.0007 } The first declaration …

arrays go constants