Code Room
Code reviewMedium
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.
Learn the concepts
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.