Codebase

Navigate the Codebase using the tree view. Use the filters to highlight where various files are grouped to aid understanding.

Getting Started Commands

Project Structure

Below is a short description of the key directories of the project to aid you when understanding where key files are located.

.vscode/ - This directory contains Visual Studio Code specific configuration files for the project.
build/ - This directory contains the build files for the project.
build/testdata/ - This directory contains example files used for testing. It includes files in various programming languages such as C, Java, Kotlin, Python, Ruby, and Scala.
cmd/ - This directory contains the command-line interface (CLI) for Zoekt.
cmd/zoekt-archive-index/ - This directory contains the code for building and managing archive indexes.
cmd/zoekt-dynamic-indexserver/ - This directory contains the code for the dynamic index server.
cmd/zoekt-git-clone/ - This directory contains the code for cloning Git repositories.
cmd/zoekt-git-index/ - This directory contains the code for managing Git indexes.
cmd/zoekt-index/ - This directory contains the code for managing indexes in general.
cmd/zoekt-indexserver/ - This directory contains the code for the index server.
cmd/zoekt-merge-index/ - This directory contains the code for merging indexes.
cmd/zoekt-repo-index/ - This directory contains the code for managing repository indexes.
cmd/zoekt-sourcegraph-indexserver/ - This directory contains the code for the Sourcegraph index server.
cmd/zoekt/ - This directory contains the main package for the CLI tool.
ctags/ - This directory contains the code for the Ctags parser.
debugserver/ - This directory contains the code for the debug server.
doc/ - This directory contains documentation for the project.
gitindex/ - This directory contains the code for managing Git indexes.
grpc/ - This directory contains the code for gRPC support.
internal/ - This directory contains internal packages used by the project.
json/ - This directory contains the code for handling JSON data.
query/ - This directory contains the code for query processing.
shards/ - This directory contains the code for managing shards.
testdata/ - This directory contains test data for the project.
trace/ - This directory contains the code for tracing.
web/ - This directory contains the code for the web server.

Entrypoints

Below are files we identified as entrypoints for to the codebase. This is where the application starts and a good place to start when learning.

cmd/zoekt-archive-index/main.go - The main entrypoint for the archive index binary, which indexes an archive.
cmd/zoekt-dynamic-indexserver/main.go - The main entrypoint for the dynamic index server, handling logging, indexing repositories, and empty directories.
cmd/zoekt-git-clone/main.go - The main entrypoint for the git clone binary, which fetches and clones repositories from various sources.
cmd/zoekt-git-index/main.go - The main entrypoint for the git index binary, which indexes a git repository.
cmd/zoekt-index/main.go - The main entrypoint for the index binary, which indexes a repository or an archive.
cmd/zoekt-indexserver/main.go - The main entrypoint for the index server, handling logging, periodic fetching, indexing pending repos, and deleting logs.
cmd/zoekt-merge-index/main.go - The main entrypoint for the merge index binary, which merges indexes from multiple shards.
cmd/zoekt-mirror-bitbucket-server/main.go - The main entrypoint for the bitbucket-server mirror binary, which fetches and clones repositories from a bitbucket server.
cmd/zoekt-mirror-gerrit/main.go - The main entrypoint for the gerrit mirror binary, which fetches and indexes repositories using the gerrit protocol.
cmd/zoekt-mirror-github/main.go - The main entrypoint for the github mirror binary, which fetches and clones repositories from a GitHub user or organization.
cmd/zoekt-mirror-gitiles/main.go - The main entrypoint for the gitiles mirror binary, which fetches and indexes repositories from a gitiles server.
cmd/zoekt-mirror-gitlab/main.go - The main entrypoint for the gitlab mirror binary, which fetches and indexes repositories using the gitlab API.
cmd/zoekt-repo-index/main.go - The main entrypoint for the repo-index binary, which indexes a repository-based repository using a manifest file.
cmd/zoekt-sourcegraph-indexserver/main.go - The main entrypoint for the sourcegraph index server, which periodically reindexes enabled repositories on Sourcegraph.
cmd/zoekt-test/main.go - The entrypoint for the zoekt-test binary, which compares the search engine results with raw substring search.
cmd/zoekt-webserver/main.go - The main entrypoint for the web server, which serves search results and handles various HTTP requests.
cmd/zoekt/main.go - The main entrypoint for the Zoekt command-line tool, providing functions for displaying matches, loading shards, and starting various profiling modes.
testdata/repo/main.go - Not an entrypoint, but a test data file for a repository.
testdata/repo2/main.go - Not an entrypoint, but a test data file for another repository.