func (s *Server) handleFetch(w http.ResponseWriter, r *http.Request) {
	if r.URL.Path == "/" {
		w.Header().Set("Content-Type", "text/html; charset=utf-8")
		fmt.Fprintf(w, "<h1>Hello, Go Discovery Fetch Service!</h1>")
		fmt.Fprintf(w, `<p><a href="/fetch/rsc.io/quote/@v/v1.0.0">Fetch an example module</a></p>`)
		return
	}
	if r.URL.Path == "/favicon.ico" {
		return
	}

	msg, code := s.doFetch(r)
	if code == http.StatusInternalServerError {
		log.Infof(r.Context(), "doFetch of %s returned %d; returning that code to retry task", r.URL.Path, code)
		http.Error(w, http.StatusText(code), code)
		return
	}
	if code/100 != 2 {
		log.Infof(r.Context(), "doFetch of %s returned code %d; returning OK to avoid retry", r.URL.Path, code)
	}
	w.Header().Set("Content-Type", "text/plain; charset=utf-8")
	if code/100 == 2 {
		log.Info(r.Context(), msg)
		fmt.Fprintln(w, msg)
	}
	fmt.Fprintln(w, http.StatusText(code))
}
// handleFetch executes a fetch request and returns a http.StatusOK if the
// status is not http.StatusInternalServerError, so that the task queue does
// not retry fetching module versions that have a terminal error.
handleFetch executes a fetch request and returns a http.StatusOK if the
status is not http.StatusInternalServerError, so that the task queue does
not retry fetching module versions that have a terminal error.
// handleFetch executes a fetch request and returns a http . StatusOK if the // status is not http . StatusInternalServerError so that the task queue does // not retry fetching module versions that have a terminal error .
func (s *Server) handleFetch(w http.ResponseWriter, r *http.Request) {
	if r.URL.Path == "/" {
		w.Header().Set("Content-Type", "text/html; charset=utf-8")
		fmt.Fprintf(w, "<h1>Hello, Go Discovery Fetch Service!</h1>")
		fmt.Fprintf(w, `<p><a href="/fetch/rsc.io/quote/@v/v1.0.0">Fetch an example module</a></p>`)
		return
	}
	if r.URL.Path == "/favicon.ico" {
		return
	}
	msg, code := s.doFetch(r)
	if code == http.StatusInternalServerError {
		log.Infof(r.Context(), "doFetch of %s returned %d; returning that code to retry task", r.URL.Path, code)
		http.Error(w, http.StatusText(code), code)
		return
	}
	if code/100 != 2 {
		log.Infof(r.Context(), "doFetch of %s returned code %d; returning OK to avoid retry", r.URL.Path, code)
	}
	w.Header().Set("Content-Type", "text/plain; charset=utf-8")
	if code/100 == 2 {
		log.Info(r.Context(), msg)
		fmt.Fprintln(w, msg)
	}
	fmt.Fprintln(w, http.StatusText(code))
}
func ( s * Server ) handleFetch ( w http . ResponseWriter , r * http . Request ) { if r . URL . Path == " " { w . Header ( ) . Set ( " " , " " ) fmt . Fprintf ( w , " " ) fmt . Fprintf ( w , `<p><a href="/fetch/rsc.io/quote/@v/v1.0.0">Fetch an example module</a></p>` ) return } if r . URL . Path == " " { return } msg , code := s . doFetch ( r ) if code == http . StatusInternalServerError { log . Infof ( r . Context ( ) , " " , r . URL . Path , code ) http . Error ( w , http . StatusText ( code ) , code ) return } if code / 100 != 2 { log . Infof ( r . Context ( ) , " " , r . URL . Path , code ) } w . Header ( ) . Set ( " " , " " ) if code / 100 == 2 { log . Info ( r . Context ( ) , msg ) fmt . Fprintln ( w , msg ) } fmt . Fprintln ( w , http . StatusText ( code ) ) }
handleFetch executes a fetch request and returns a http.StatusOK if the
status is not http.StatusInternalServerError, so that the task queue does
not retry fetching module versions that have a terminal error.
handleFetch executes a fetch request and returns a http . StatusOK if the status is not http . StatusInternalServerError so that the task queue does not retry fetching module versions that have a terminal error .