===================================output=================================== This is a fack imooc.com HTTP/1.1 200 OK Accept-Ranges: bytes Age: 9 Connection: keep-alive Content-Type: text/html; charset=utf-8 Date: Wed, 10 Oct 2018 14:38:23 GMT Server: nginx Vary: Accept-Encoding Via: 1.1 varnish (Varnish/6.0) X-Cache: HIT from CS42 X-Varnish: 280162519 281222076 ... ...body省略 ... ===================================output===================================
看看interface里面有什么? func main() { var r Retriever r = mock.Retriever{"This is a fack imooc.com"} fmt.Printf("%T %v\n", r, r) //fmt.Println(download(r)) r = real.Retriever{} fmt.Printf("%T %v\n", r, r) //fmt.Println(download(r)) } ===================================output=================================== mock.Retriever {This is a fack imooc.com} real.Retriever { 0s} ===================================output===================================