Skip to content

Instantly share code, notes, and snippets.

@chai2010
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save chai2010/cffe524439a9a3c3011d to your computer and use it in GitHub Desktop.

Select an option

Save chai2010/cffe524439a9a3c3011d to your computer and use it in GitHub Desktop.
Go模拟显示接口
package main
import (
"fmt"
"testing"
)
func main() {
testTB(new(TB))
}
func testTB(t testing.TB) {
t.Fatal("foo")
}
type TB struct {
testing.TB
}
func (p *TB) Fatal(args ...interface{}) {
fmt.Println("TB.Fatal disabled!")
}
// http://play.golang.org/p/L5CEf7982p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment