Table of Contents generated with DocToc
The template is used to create golang project. All golang projects must follow the conventions in the template. Calling for exceptions must be brought up in the engineering team.
The template doesn't have API docs. For web service, please include API docs here, whether it's auto-generated or hand-written. For auto-generated API docs, you can also give instructions on the build process.
The template follows project convention doc.
The template project is in alpha status.
Below we describe the conventions or tools specific to golang project.
├── .github
│ ├── ISSUE_TEMPLATE.md
│ └── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── .golangci.yml
├── CHANGELOG.md
├── Makefile
├── OWNERS
├── README.md
├── build
│ ├── admin
│ │ └── Dockerfile
│ └── controller
│ └── Dockerfile
├── cmd
│ ├── admin
│ │ └── admin.go
│ └── controller
│ └── controller.go
├── docs
│ └── README.md
├── hack
│ ├── README.md
│ ├── deployment.yaml
│ └── script.sh
├── pkg
│ ├── apis
│ │ └── v1
│ │ └── README.md
│ ├── utils
│ │ └── net
│ │ └── net.go
│ └── version
│ └── version.go
├── release
│ ├── template-admin.yaml
│ └── template-controller.yaml
├── test
│ ├── README.md
│ └── test_make.sh
├── third_party
│ └── README.md
└── vendor
└── README.md
A brief description of the layout:
.github
has two template files for creating PR and issue. Please see the files for more details..gitignore
varies per project, but all projects need to ignorebin
directory..golangci.yml
is the golangci-lint config file.Makefile
is used to build the project. You need to tweak the variables based on your project.CHANGELOG.md
contains auto-generated changelog information.OWNERS
contains owners of the project.README.md
is a detailed description of the project.bin
is to hold build outputs.cmd
contains main packages, each subdirectory ofcmd
is a main package.build
contains scripts, yaml files, dockerfiles, etc, to build and package the project.docs
for project documentations.hack
contains scripts used to manage this repository, e.g. codegen, installation, verification, etc.pkg
places most of project business logic and locateapi
package.release
chart for production deployment.test
holds all tests (except unit tests), e.g. integration, e2e tests.third_party
for all third party libraries and tools, e.g. swagger ui, protocol buf, etc.vendor
contains all vendored code.
- Makefile MUST NOT change well-defined command semantics, see Makefile for details.
- Every project MUST use
dep
for vendor management and MUST checkinvendor
direcotry. cmd
andbuild
MUST have the same set of subdirectories for main targets- For example,
cmd/admin,cmd/controller
andbuild/admin,build/controller
. - Dockerfile MUST be put under
build
directory even if you have only one Dockerfile.
- For example,