I found an interface with a method called _ . I tried to implement it, but it does not work:
package main func main() {} func ft(t T) { fi(t) } func fi(I) {} type I interface { _() int } type T struct {} func (T) _() int { return 0 } func (T) _(int) int { return 0 }
$ go run a.go ./a.go:4: cannot use t (type T) as type I in function argument: T does not implement I (missing _ method)
I also tried adding the overloaded _(int) method, but this also does not work:
package main func main() {} type I interface { _() int _(int) int } type T struct {} func (T) _() int { return 0 } func (T) _(int) int { return 0 }
$ go run a.go # command-line-arguments ./a.go:12: internal compiler error: sigcmp vs sortinter _ _
Why? What is the purpose of this method _ ? I think this could be a way to prevent the user from using an interface (like private interfaces in Java)?
source share