我有这个接口,我需要为两个调用实现,
1. req, err := http.NewRequest("GET", "http://example.com/healthz", nil)
2. req, err := http.NewRequest("GET", "http://localhost:8082/rest/foos/9", nil)
但是接口使用的是reqof类型的*http.Request方法,我该怎么做呢?
type HealthChecker interface {
Name() string
Check(req *http.Request) error
}
type ping struct{}
func (p ping) Check(req *http.Request) error {
}
func (ping) Name() string {
return "check1"
}
https://play.golang.org/p/PvpKD-_MFRS
SMILET
相关分类