Prompt for a small Go ZIP code check

Vibe codingEasy20 min

Your task

You need a small Go function that checks whether a string is a valid 5-digit US ZIP code. You want only the standard library and code a reviewer can read in 10 seconds. The last time you asked an assistant for a tiny helper, it pulled in a validation package and a regex, and you had to ask again.

Write the prompt you would give the assistant.

What you know:

  • the function goes in package address, and the repo writes table-driven tests
  • your forms accept 5-digit ZIP codes only, never ZIP+4 like 94107-1234
  • the form trims spaces before it calls the function

Then, in a few sentences: why name your constraints in the first prompt?