Last active
November 19, 2017 15:28
-
-
Save xcoulon/7d0d61743b97b21d8c157dd536c13530 to your computer and use it in GitHub Desktop.
Nested structs in Golang (resource for the story on Medium)
This file contains hidden or 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
config := Config{ | |
Server: struct { | |
Host string `json:"host"` | |
Port string `json:"port"` | |
}{ | |
Host: "localhost", | |
Port: "8080", | |
}, | |
Postgres: struct { | |
Host string `json:"host"` | |
User string `json:"user"` | |
Password string `json:"password"` | |
DB string `json:"db"` | |
}{ | |
Host: "localhost", | |
User: "db_user", | |
Password: "supersecret", | |
DB: "my_db", | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment