59 lines
740 B
Go
Raw Normal View History

2019-09-27 18:47:42 +08:00
package main
// MyStruct 介绍
type MyStruct struct {
Value int
Key string
Do func(
a int,
2019-09-29 18:48:37 +08:00
b struct {
A, B int
C string
})
2019-09-27 18:47:42 +08:00
S struct{ A int }
}
2019-09-29 18:48:37 +08:00
type MyStruct2 struct {
Value int
Key string
Do func(
a int,
b struct {
A, B int
C string
})
S struct{ A struct{ C interface{} } }
}
// DoFunc 非常丑陋
func DoFunc(a func(
a int,
b struct {
A, B int
C string
})) {
return
}
2019-09-27 18:47:42 +08:00
// ExStruct 升级
type ExStruct struct {
ChildStruct struct {
A int
B interface{}
}
2019-09-29 18:48:37 +08:00
C string
D func(a int, b string)
2019-09-27 18:47:42 +08:00
}
// SetChildStructA set
func (e *ExStruct) SetChildStructA(a int) {
e.ChildStruct.A = a
}
func main() {
a := ExStruct{}
2019-09-29 18:48:37 +08:00
b := MyStruct{}
c := MyStruct2{}
println(a, b, c)
2019-09-27 18:47:42 +08:00
}