Skip to content

Instantly share code, notes, and snippets.

@jochasinga
Last active August 29, 2015 14:07
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 jochasinga/1ffad9d7be8c374fff19 to your computer and use it in GitHub Desktop.
Save jochasinga/1ffad9d7be8c374fff19 to your computer and use it in GitHub Desktop.
Struct in Go
package main
import "fmt"
type Gopher struct {
kingdom string
color map[string]int
num_legs int
height float
}
func main() {
chip := Gopher{
"Animalia",
map[string]int{
"r" : 102,
"g" : 255,
"b" : 255,
},
4, 1.5,
}
fmt.Println(chip.kingdom)
fmt.Println(chip.color)
fmt.Println(chip.num_legs)
fmt.Println(chip.height)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment