Code Room
Code reviewMediumcr-g005
Subject Context cancellationLevel Mid–Senior~22 minCommon in Networking & APIs interviewsIndustries Software development

Question

Review this Go helper that fetches with a per-call timeout.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewgo
func fetch(url string) ([]byte, error) {	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)	req, _ := http.NewRequestWithContext(ctx, "GET", url, nil)	resp, err := http.DefaultClient.Do(req)	if err != nil {		return nil, err	}	return io.ReadAll(resp.Body)}
Run or narrate your approach, then ask the coach.