Created
October 20, 2016 00:56
-
-
Save Henry0422/f9012202333d7649365a8adc4b91bcd5 to your computer and use it in GitHub Desktop.
Assign to a field of a map - Golang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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