Skip to content

Instantly share code, notes, and snippets.

@EmielM
Created May 23, 2010 01:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EmielM/410556 to your computer and use it in GitHub Desktop.
Save EmielM/410556 to your computer and use it in GitHub Desktop.
package main
import ("log")
type Test struct {
a []byte
}
/*func (t *Test) Push(v byte) *Test {
n := len(t.a)
t.a = t.a[0:n+1]
t.a[n] = v
return t
}
func (t *Test) Clear() *Test {
t.a = t.a[0:0]
return t
}*/
func (t *Test) Len() int {
return len(t.a)
}
type Iface interface {
//Push(byte) *Test
//Clear() *Test
Len() int
//X()
}
func main() {
var t Iface = &(Test{make([]byte, 0, 10)})
//t.Clear().Push(byte(t.Len()+3))
log.Stdoutf("arr = %s", t.(Test).a)
}
emiel-macbook:Temp emiel$ 8g test-chain.go; 8l test-chain.8
test-chain.go:35: Iface cannot contain Test
missing Len() int
??none??: cannot open file: test-chain.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment