GoSLayer is a tool that helps you to create a golang project in seconds.
- layered base on a standard architecture layout (for chinese)
- followed by Package-Oriented-Design guideline
- creating a runnable Rest ful Web Service
$ go get -u github.com/danceyoung/goslayer
- cd any directory where you will creating your project:
$ goslayer
- Enter your project name (here is
goapp
) and then choose a web framework(gin or http handler, default is gin) - cd
goapp
:go mod init goapp;go run ./cmd/myapp
- Open another terminal, run
curl --location --request GET 'http://127.0.0.1:8080/goslayer/events'
, response data will output.
Creation process and your project structure might look like this:
GoSLayer is a tool that helps you to create a golang project in seconds.
• layered base on a standard architecture layout
• followed by Package-Oriented-Design guideline
link: https://github.com/danceyoung/goslayer
Please enter your project name: goapp
Please choose a web framework,
(1) use gin, (2) use handler buildin: 1
Creating your go project with GIN
The go project is created successfully.
goapp
├── cmd/
│ └── myapp/
│ └── router/
│ └── handler/
│ └── router.go
│ └── main.go
├── internal/
│ └── myapp/
│ └── event/
├── └── pkg/
│ └── middleware/
This tool is based on material taken from the following posts.
- Ardan Labs: Package-Oriented-Design,
- Github: golang standard project layout,
- Microsoft: Design Fundamentals - Layout Application Guideline
- Go面向包的设计和架构分层
todo:
redis
logger
unit test, integration test