Skip to content

Instantly share code, notes, and snippets.

@Henry0422
Created October 20, 2016 00:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Henry0422/f9012202333d7649365a8adc4b91bcd5 to your computer and use it in GitHub Desktop.
Save Henry0422/f9012202333d7649365a8adc4b91bcd5 to your computer and use it in GitHub Desktop.
Assign to a field of a map - Golang
var m = make(map[string] newDataType)
type newDataType struct {
x int
y string
}
func main() {
var tmp = m["foo"]
tmp.x = 4
m["foo"] = tmp
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment