explaingit

golang-standards/project-layout

Analysis updated 2026-06-20

55,922MakefileAudience · developerComplexity · 1/5Setup · easy

TLDR

A community-maintained reference guide showing the widely-adopted folder structure for Go projects, explaining what code belongs in directories like /cmd, /internal, /pkg, and /api.

Mindmap

mindmap
  root((repo))
    What It Is
      Folder structure guide
      Community convention
    Key Directories
      cmd entry points
      internal private code
      pkg reusable code
      api definitions
    Who It Is For
      Go beginners
      Growing teams
    What It Is Not
      Runnable code
      Official standard
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Set up a consistent, community-standard folder structure when starting a new Go application expected to grow.

USE CASE 2

Onboard new Go developers by giving them a shared understanding of what each project directory is for.

USE CASE 3

Review an existing Go repository to see which directories follow or diverge from community conventions.

What is it built with?

GoMakefile

How does it compare?

golang-standards/project-layoutjobbole/awesome-python-cnuber-go/guide
Stars55,92230,38017,482
LanguageMakefileMakefileMakefile
Setup difficultyeasyeasyeasy
Complexity1/51/51/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

In plain English

This repository is a community-maintained reference guide that shows developers how to organize the files and folders in a Go programming language project. Go (also called Golang) is a programming language made by Google, and when you start a new project in it, you face the question of where to put different types of code. This repo answers that question by providing a recommended folder structure that has become widely adopted across the Go ecosystem. The core idea is that a Go project should be split into well-named directories, each with a specific purpose. For example, the "/cmd" folder holds the entry points for your application, "/internal" holds private code that other projects cannot import, "/pkg" holds reusable library code that outside projects are welcome to use, and "/api" holds API definition files. Each directory name signals intent clearly to any developer who opens the project. This is not an official Go standard, the readme is careful to say it is a community convention, not a mandate from the Go core team. It is more like a widely-shared best practice that emerged from real-world usage across many large Go projects. Beginners are explicitly warned not to use it for small projects, since a single main.go file is fine for learning or prototyping. You would reach for this reference when starting a new Go application that is expected to grow, when joining a Go team that wants consistent structure across repositories, or when reviewing an existing Go project's layout. It does not provide runnable code, it is a documented template with explanations. The tech stack is minimal: the repository itself uses a Makefile for automation but its value is entirely in the documentation and directory structure it describes, all targeting the Go programming language and its module system.

Copy-paste prompts

Prompt 1
Using the golang-standards project layout, create the initial folder structure for a Go REST API with a CLI entry point, internal business logic, and a public SDK package.
Prompt 2
I am building a Go application. Based on the standard project layout, where should I put database models, HTTP handlers, CLI commands, and shared utility functions?
Prompt 3
Review my Go project structure and tell me which directories should be renamed or moved to match the golang-standards conventions.

Frequently asked questions

What is project-layout?

A community-maintained reference guide showing the widely-adopted folder structure for Go projects, explaining what code belongs in directories like /cmd, /internal, /pkg, and /api.

What language is project-layout written in?

Mainly Makefile. The stack also includes Go, Makefile.

How hard is project-layout to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is project-layout for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub golang-standards on gitmyhub

Verify against the repo before relying on details.