Skip to content

Instantly share code, notes, and snippets.

@suzuki-shunsuke
Last active August 12, 2018 01:31
Show Gist options
  • Save suzuki-shunsuke/e633a8503e27170abadffb9c4705b216 to your computer and use it in GitHub Desktop.
Save suzuki-shunsuke/e633a8503e27170abadffb9c4705b216 to your computer and use it in GitHub Desktop.
// https://play.golang.org/p/2LBJbIBVw37
package main
import (
"fmt"
)
type Foo struct {
name string
}
func (foo *Foo) Name() string {
return foo.name
}
type Bar struct {
Name func() string
}
func main() {
foo := &Foo{name: "hello"}
bar := Bar{Name: foo.Name}
fmt.Println(bar.Name())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment