Last active
June 12, 2016 11:39
-
-
Save Brunty/da7a9bbc8b07318887635f8f8c0b0600 to your computer and use it in GitHub Desktop.
Style opinion time - which do you prefer? 1 or 2
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
type Money struct { | |
isoCode string | |
symbol string | |
value int | |
} | |
type Product struct { | |
name string | |
price Money | |
} | |
// 1 | |
var productCollection = []Product{{"Playstation 4", Money{"GBP", "£", 45000}}} | |
// 2 | |
var alternativeProductCollection = []Product{{name: "Playstation 4", price: Money{isoCode: "GBP", symbol: "£", value: 45000}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment