Skip to content

Instantly share code, notes, and snippets.

@javouhey
Created February 22, 2014 21:09
Show Gist options
  • Select an option

  • Save javouhey/9162475 to your computer and use it in GitHub Desktop.

Select an option

Save javouhey/9162475 to your computer and use it in GitHub Desktop.
Forcing a type check
package main
import (
"fmt"
)
type Boo interface{ Write(int32) int32 }
type Babi struct {}
func boo(b Boo) {
fmt.Println(b.Write(99))
}
func main() {
var u int64 = -0x80000000
fmt.Println(u)
fmt.Println(u << 1)
var _ Boo = Babi{} // performs type checking
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment