I have a map:

var sessions =  map[string] chan int{}

How do I delete sessions[key]? I tried:

sessions[key] = nil,false;

That didn’t work.

Update (November 2011):

The special syntax for deleting map entries is removed in Go version 1:

Go 1 will remove the special map assignment and introduce a new built-in function, delete: delete(m, x) will delete the map entry retrieved by the expression m[x]. …

5 Answers
5

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *