bodyclose icon indicating copy to clipboard operation
bodyclose copied to clipboard

custom interfaces are not handled

Open dcu opened this issue 6 years ago • 0 comments

package main

import (
	"net/http"
)

type myCloser interface {
	Close() error
}

func closeBody(c myCloser) {
	_ = c.Close()
}

func main() {
	resp, _ := http.Get("https://example.com")
	defer closeBody(resp.Body)
}

dcu avatar Apr 06 '19 15:04 dcu