About this project

This repository provides a set of common historical and emerging project layout patterns for Go applications. It is explicitly NOT an official standard defined by the core Go team, but rather a community effort to document conventions observed in the Go ecosystem. The layout defines key directories: - /cmd: Main applications; each subdirectory matches an executable name, containing minimal main functions that import code from /internal and /pkg. - /internal: Private application and library code enforced by the Go compiler itself (since Go 1.4) to prevent external imports. Can be nested at any level. - /pkg: Library code intended for external use. Communicates that code is safe for others to import, though /internal is the compiler-enforced alternative for private packages. - /vendor: Application dependencies managed via Go Modules (go mod vendor). - /api: OpenAPI/Swagger specs, JSON schema files, protocol definitions. - /web: Static web assets, server-side templates, SPAs. - /configs: Configuration file templates or default configs. - /init: System init (systemd, upstart, sysv) and process manager configs. - /scripts: Build, install, analysis scripts to keep root Makefile simple. - /build: Packaging (AMI, Docker, deb, rpm) and CI configurations. - /deployments: IaaS/PaaS, container orchestration deployment configs (docker-compose, kubernetes/helm, terraform). - /test: Additional external test apps and test data. - /docs, /tools, /examples, /third_party, /githooks, /assets, /website: Supporting directories for documentation, tools, examples, external helpers, git hooks, assets, and website data. The README explicitly advises against using a /src directory (a Java convention) and recommends starting simple (single main.go and go.mod) for small projects or proofs of concept, adopting more structure as projects grow. It recommends Go Modules (production-ready since Go 1.14), gofmt, and staticcheck for formatting and linting. The README is available in 18+ languages including Chinese, Japanese, Korean, French, Spanish, Russian, Hindi, Bengali, and others.