panic
func main() {
http.HandleFunc("/pdf", function(w ResponseWriter, r *http.Request) {
w.Header().Add("Content-Type", "application/pdf");
fp, err:= os.Open("./go.pdf")
if err!=nil {
http.Error(w, fmt.Errorf("internal server error"), http.StatusInternalServerError)
return;
}
defer fp.Close()
if _, err:=io.Copy(w, fp);err!=nil {
http.Error(w, fmt.Errorf("internal server error"), http.StatusInternalServerError)
return;
}
});
}