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-2/

Build an Inventory Management API

Problem/Feature Description

A small warehouse company needs a REST API to track its inventory. Build it using Go with net/http (standard library).

Resources:

  • Product: { id, sku, name, quantity, location }

Endpoints:

  • GET /api/products -- list all products
  • GET /api/products/{id} -- get a single product by ID
  • POST /api/products -- create a product (sku required and must be unique, name required, quantity >= 0)
  • PUT /api/products/{id} -- update a product
  • DELETE /api/products/{id} -- delete a product
  • POST /api/products/{id}/adjust -- adjust stock quantity (body: { "delta": 5 } or { "delta": -3 }). Quantity must not go below zero.

Use in-memory storage (no real database needed). Seed with 3 sample products.

Output Specification

Produce:

  • main.go -- server entry point and route registration
  • errors.go -- error types
  • handlers.go -- route handlers
  • models.go -- data types and in-memory store
  • go.mod -- module definition

You may create additional files as needed for a well-structured codebase.

evals

tile.json