blob: 16b029af34ff78fa1b44e6194f9ceaae26f5b2b1 [file] [log] [blame]
Rémy Oudompheng2ece2f52012-02-18 22:15:42 +01001// run
Ian Lance Taylor3f69acf2008-12-30 15:03:46 -08002
3// Copyright 2009 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7package main
8
Russ Cox918afd942009-05-08 15:21:41 -07009import "os"
10
Russ Cox839a6842009-01-20 14:40:40 -080011type I interface { send(chan <- int) }
Ian Lance Taylor3f69acf2008-12-30 15:03:46 -080012
Russ Cox839a6842009-01-20 14:40:40 -080013type S struct { v int }
Ian Lance Taylor3f69acf2008-12-30 15:03:46 -080014func (p *S) send(c chan <- int) { c <- p.v }
15
16func main() {
Rob Pike74dd0ab2009-08-17 13:30:22 -070017 s := S{0};
18 var i I = &s;
19 c := make(chan int);
20 go i.send(c);
21 os.Exit(<-c);
Ian Lance Taylor3f69acf2008-12-30 15:03:46 -080022}