Skip to content

Instantly share code, notes, and snippets.

@xcoulon
Last active November 19, 2017 13:09
Show Gist options
  • Save xcoulon/501c3ae1a51046b92193b339dada695a to your computer and use it in GitHub Desktop.
Save xcoulon/501c3ae1a51046b92193b339dada695a to your computer and use it in GitHub Desktop.
Nested structs in Golang (resource for the story on Medium)
type Config struct {
Server Server `json:"server"`
Postgres Postgres `json:"postgres"`
}
type Server struct {
Host string `json:"host"`
Port string `json:"port"`
}
type Postgres struct {
Host string `json:"host"`
User string `json:"user"`
Password string `json:"password"`
DB string `json:"db"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment