A minimal Go HTTP service that searches a single Git repository using git grep.
It is the starting point for a coding exercise interview in which the candidate will build out features on top of this service.
The candidate is required to use an agentic coding assistant (Claude Code, Amp, Cursor, Codex, etc...) during the interview.
go run main.go --root ~/src --port 48080Flags:
--root— Directory containing Git repositories (default:.)--port— Port to listen on (default:48080)
Search a single repository.
Parameters:
query— The search pattern (passed togit grep)repo— The repository name (subdirectory under--root)
Example:
curl "http://localhost:48080/search?query=func+main&repo=myrepo"Response:
[
{
"file": "cmd/server/main.go",
"line": 42,
"content": "func main() {",
"score": 0.69
}
]Results are scored by match density: shorter lines where the query covers more of the content score higher (range 0–1).
mkdir -p ~/interview-search/repos
git clone https://github.com/sourcegraph/interview-search-starter.git ~/interview-search/interview-search-starterThese are a mix of languages and sizes:
cd ~/interview-search/repos
git clone https://github.com/go-chi/chi # Go - HTTP router
git clone https://github.com/pallets/flask # Python - web framework
git clone https://github.com/expressjs/express # JavaScript - web framework
git clone https://github.com/serde-rs/serde # Rust - serialization
git clone https://github.com/jqlang/jq # C - JSON processorcd ~/interview-search/interview-search-starter
go run main.go --root ~/interview-search/repos --port 48080curl 'http://localhost:48080/search?query=func+main&repo=chi'Or open http://localhost:48080/ in a browser to use the web UI.
This exercise requires an agentic coding assistant (Claude Code, Amp, Cursor, Codex, etc.), so get yours ready to go with this repo prior to the interview.