Skip to content

Viky-Developer/Go-Basic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-Basic

Go - The Ultimate Folder Structure

Organizing your Go (Golang) project's folder structure can help improve code readability, maintainability, and scalability. While there is no one-size-fits-all structure, here's a common folder structure for a Go project:

project-root/

├── cmd/
│   ├── your-app-name/
│   │   ├── main.go         # Application entry point
│   │   └── ...             # Other application-specific files
│   └── another-app/
│       ├── main.go         # Another application entry point
│       └── ...
├── internal/                # Private application and package code
│   ├── config/
│   │   ├── config.go       # Configuration logic
│   │   └── ...
│   ├── database/
│   │   ├── database.go     # Database setup and access
│   │   └── ...
│   └── ...
├── pkg/                     # Public, reusable packages
│   ├── mypackage/
│   │   ├── mypackage.go    # Public package code
│   │   └── ...
│   └── ...
├── api/                     # API-related code (e.g., REST or gRPC)
│   ├── handler/
│   │   ├── handler.go      # HTTP request handlers
│   │   └── ...
│   ├── middleware/
│   │   ├── middleware.go  # Middleware for HTTP requests
│   │   └── ...
│   └── ...
├── web/                     # Front-end web application assets
│   ├── static/
│   │   ├── css/
│   │   ├── js/
│   │   └── ...
│   └── templates/
│       ├── index.html
│       └── ...
├── scripts/                 # Build, deployment, and maintenance scripts
│   ├── build.sh
│   ├── deploy.sh
│   └── ...
├── configs/                 # Configuration files for different environments
│   ├── development.yaml
│   ├── production.yaml
│   └── ...
├── tests/                   # Unit and integration tests
│   ├── unit/
│   │   ├── ...
│   └── integration/
│       ├── ...
├── docs/                    # Project documentation
├── .gitignore               # Gitignore file
├── go.mod                   # Go module file
├── go.sum                   # Go module dependencies file
└── README.md                # Project README

Clone the repository:

git clone https://github.com/Viky-Developer/Go-Basic.git

Reload dependencies:

$ go mod  tidy

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages