CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/go-error-handling

Error handling for Go HTTP servers — structured error responses, error wrapping,

88

1.80x
Quality

81%

Does it follow best practices?

Impact

99%

1.80x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-3/

Build a Parking Reservation API

Problem/Feature Description

A parking garage needs a backend API to manage parking spot reservations. Build it in Go using the standard library.

Resources:

  • ParkingSpot: { id, level, number, type (regular/handicap/ev), isAvailable }
  • Reservation: { id, spotId, licensePlate, startTime, endTime, createdAt }

Endpoints:

  • GET /api/spots -- list all spots, with optional ?type=ev&available=true filters
  • GET /api/spots/{id} -- get a single spot
  • POST /api/spots -- create a spot (level and number required; combination must be unique)
  • POST /api/reservations -- create a reservation:
    • spotId, licensePlate, startTime, and endTime are required
    • spot must exist and be available
    • endTime must be after startTime
    • startTime must not be in the past
    • mark the spot as unavailable
  • GET /api/reservations/{id} -- get a reservation
  • DELETE /api/reservations/{id} -- cancel a reservation (mark the spot as available again)

Seed with 10 parking spots across 2 levels. Use in-memory storage.

Output Specification

Produce:

  • main.go -- entry point and server setup
  • Source files for handlers, models, errors, and any middleware
  • go.mod

You may organize files as you see fit.

evals

tile.json