Skip to content

Instantly share code, notes, and snippets.

@shumon84
Last active December 31, 2018 14:05
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 shumon84/889276f3abea009499beedac8f64f2e1 to your computer and use it in GitHub Desktop.
Save shumon84/889276f3abea009499beedac8f64f2e1 to your computer and use it in GitHub Desktop.
package main
import(
"fmt"
)
type Hoge struct {
A int
B struct {
X int
Y struct{
N int
}
}
}
func main() {
hoges := []Hoge{
Hoge{
A: 1,
B: struct {
X int
Y struct {
N int
}
}{
X: 2,
Y: struct {
N int
}{
N: 3,
},
},
},
Hoge{
A: 10,
B: struct {
X int
Y struct {
N int
}
}{
X: 20,
Y: struct {
N int
}{
N: 30,
},
},
},
}
fmt.Println(hoges[0])
fmt.Println(hoges[1])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment