Beispiel #1
0
// Work makes a Person go to work for h hours
func (p *Person) Work(h int) error {
	cpkg.Printf("working...\n")
	if h > 7 {
		return fmt.Errorf("can't work for %d hours!", h)
	}
	cpkg.Printf("worked for %d hours\n", h)
	return nil
}
Beispiel #2
0
func init() {
	F1 = func() {
		cpkg.Printf("calling F1\n")
	}

	F2 = Func(func() {
		cpkg.Printf("calling F2\n")
	})
}
Beispiel #3
0
func init() {
	cpkg.Printf("empty.init()... [CALLED]\n")
}
Beispiel #4
0
// CallIface calls F() on v
func CallIface(v Iface) {
	cpkg.Printf("iface.CallIface...\n")
	v.F()
	cpkg.Printf("iface.CallIface... [DONE]\n")
}
Beispiel #5
0
func (t *T) F() {
	cpkg.Printf("t.F [CALLED]\n")
}
Beispiel #6
0
// Inc increments the value of s
func Inc(s *S) {
	cpkg.Printf("==> go: s.Value==%d\n", s.Value)
	s.Value++
	cpkg.Printf("<== go: s.Value==%d\n", s.Value)
}