go-template

module
v0.0.0-...-22d23f5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2024 License: MIT

README

Go template

A "business" go template that can be used to quickly initializing a new service. The example contains guidelines on how and where to write the code.

Initializing

Here we have used gonew tool to initialize the template.

Installing gonew

More about gonew here.

go install golang.org/x/tools/cmd/gonew@latest
Initializing the project
gonew github.com/Melenium2/go-template <new go.mod name>

For example

gonew github.com/Melenium2/go-template \
  github.com/Melenium2/myservice

As a result the myservice folder will be created in the current directory. The project will be initialized with specified module name.

# bash
> ls

- ...
- myservice
- ...
// go.mod
module github.com/Melenium2/myservice

go 1.21

Directories

Path Synopsis
api
Package api contains OpenAPI/Swagger specs, JSON schema files, protocol definition files.
Package api contains OpenAPI/Swagger specs, JSON schema files, protocol definition files.
grpc/proto
Package proto contains internal and external API definitions in protobuf format.
Package proto contains internal and external API definitions in protobuf format.
cmd
Package cmd is main entrypoint for application.
Package cmd is main entrypoint for application.
Package db contains content that scripts for database.
Package db contains content that scripts for database.
Package deployments contains IaaS, PaaS, system and container orchestration deployment configurations and templates (docker-compose, kubernetes/helm, mesos, terraform, bosh).
Package deployments contains IaaS, PaaS, system and container orchestration deployment configurations and templates (docker-compose, kubernetes/helm, mesos, terraform, bosh).
Package internal contains main application code and dependencies.
Package internal contains main application code and dependencies.
api
Package api contains use cases/commands/queries that application expose to external users.
Package api contains use cases/commands/queries that application expose to external users.
api/command
Package command contains APi that combine different application domains into one use case.
Package command contains APi that combine different application domains into one use case.
api/query
Package query contains APi that query to application domains.
Package query contains APi that query to application domains.
common
Package common contains helper packages that copies across all the projects.
Package common contains helper packages that copies across all the projects.
container
Package container contains source code for initializing all dependencies of out application.
Package container contains source code for initializing all dependencies of out application.
domain
Package domain contains all the business domains that implements by current application.
Package domain contains all the business domains that implements by current application.
gateway
Package gateway contains integration code with infrastructure dependencies like databases, message broker or external services.
Package gateway contains integration code with infrastructure dependencies like databases, message broker or external services.
integrations
Package integrations contains source code for integration with other systems that not included in our list of application.
Package integrations contains source code for integration with other systems that not included in our list of application.
ui
Package ui contains expose API of our application.
Package ui contains expose API of our application.
ui/events
Package events should contain code for handling events from message broker.
Package events should contain code for handling events from message broker.
ui/grpc
Package grpc contains all gRPC servers that expose our Application.
Package grpc contains all gRPC servers that expose our Application.
ui/http
Package http contains all http handlers that expose our Application.
Package http contains all http handlers that expose our Application.
pkg
Package pkg contains code that can be imported by other applications.
Package pkg contains code that can be imported by other applications.
Package test contains for setup database for integration tests.
Package test contains for setup database for integration tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL