I\'m working on a templating system written in Go, which means it requires liberal use of the reflect
package. In this specific circumstance I need to be able t
This is a good example of golang to implement similar functionality:
package main
import "fmt"
type Parent struct {
Attr1 string
}
type Parenter interface {
GetParent() Parent
}
type Child struct {
Parent //embed
Attr string
}
func (c Child) GetParent() Parent {
return c.Parent
}
func setf(p Parenter) {
fmt.Println(p)
}
func main() {
var ch Child
ch.Attr = "1"
ch.Attr1 = "2"
setf(ch)
}
code from : https://groups.google.com/d/msg/golang-nuts/8lK0WsGqQ-0/HJgsYW_HCDoJ