Skip to content

phcp-tech/module-template-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

module-template-golang

A module template for golang.

Code Structure

  • adapter/
    Adaptation layer code for external interaction, such as RESTful API definition and command line definition.

  • configs/
    Configuration files.

  • docs/
    Document directory generated by swagger.

  • domain/ Domain model definition and implementation.

  • infra/
    Infrastructure code that implements external dependencies, such as database access object, etc.

  • pkg/
    Functional packages, such as util functions, injection functions, dto definitions, etc.

  • service/
    Service layer code implements the main business processes.

  • go.mod, go.sum
    Go module definition and dependency lock files.

  • main.go Main program, code entrance.

  • README.md
    Project documentation.

This template follows the standard Go project layout, making it easy to start new Go modules with best practices.

How to run?

1. Update dependency

  • go mod tidy

2. Generate inject files

  • wire ./...

3. Generate swagger files

  • swag init

visit http://localhost:8001/swagger/index.html

4. Build

  • go build

5. Run

  • ./template

About

A module template for golang.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages