Golang Development Directory Structure

Source: Internet
Author: User
Tags stop script
This is a creation in Article, where the information may have evolved or changed.

In the actual project found that everyone's directory structure is more messy, basic everyone has the style of each person, a project is constantly getting bigger, some new files or directories are constantly added, from which to find the information they need more and more expensive, a unified general directory structure is very necessary.

The following is from this project on GitHub (Https://github.com/golang-sta ... )

/cmd

Main function file (e.g. /cmd/myapp.go ) directory, under which each file will generate an executable file after compilation.

Do not put a lot of code under this directory, the code is as simple as possible.

/internal

The application's encapsulated code, an application-private code is put into the /internal/myapp/ directory, multiple applications are common to common code, and put into /internal/common directories like that.

/pkg

Some common code that can be used by other projects is placed under this directory

/vendor

Other third-party libraries that the project relies on, using glide tools to manage dependencies

/api

protocol files, Swagger/thrift/protobuf etc.

/web

Static files required by the Web service

/configs

Configuration file

/init

Service Start-Stop script

/scripts

Other scripts, compiling, installing, testing, analyzing, etc.

/build

Continuous Integration Catalog

Package configurations and scripts for Cloud (AMI), container (Docker), operating system (Deb, RPM, pkg) and so on are placed in the /build/package/ directory

/deployments

Deploy related configuration files and templates

/test

Other test catalogs, functional tests, performance tests, etc.

/docs

Design document

/tools

Common tools and scripts that can be referenced /internal or /pkg inside the library

/examples

Some examples of applications or common library use

/assets

Some other dependent static resources

Reprint Please specify source
This article link: http://hatlonely.github.io/20 ...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.