// Chapter 28 example: this file does not compile, on purpose. A struct held in // a map cannot have one field assigned. Run it, read the error, then fix it in // one of the two ways the chapter shows. // // Run with: go run exercises/28/06-map-field-error.go package main import "fmt" type critter struct { name string energy int } func main() { team := map[string]critter{ "spark": {name: "Spark", energy: 3}, } team["spark"].energy = 2 fmt.Println(team["spark"].energy) }