Skip to content

rickliujh/kickstart-gogrpc

Repository files navigation

kickstart-gogrpc

Boilerplate of GRPC server for go

TODOs

  • sqlc
  • migrate
  • logr
  • Otle
  • AAA
  • Error handler (middleware)

Decisions

No pre-commit hooks

The boilerplate do not provide pre-commit hooks of all sorts. Allow fast local commits is a major upside of DVCS. Clean commit can be achieved during pre-push or during pre-merge at PR level with CI scan.

See: Reddit Discussion

Guides

Build

Two type of build:

  1. make build-dev: static link but with debug info reserved
  2. make build-prod: static link, omit the DWARF symbol, omit the symbol table -ldflags="-w -s"

Dockerfile

Choose the type of build

docker build -t kickstart-go:v0.0.1 --build-arg BUILD_TYPE=prod .

Allowed value: one of [prod, dev]

Specify name of the binary being built

docker build -t kickstart-go:v0.0.1 --build-arg APP_NAME=my-app .

Note

In the final image the binary will always be called app and located at /. To change the name of the binary in the final image you need:

  1. change the destination of the copy path
COPY --from=builder /go/src/app/bin/${APP_NAME} /my-app
  1. change the endpoint
ENTRYPOINT ["/my-app"]

Specify the image that will run the binary

docker build -t kickstart-go:v0.0.1 --build-arg RUN_IMG=golang:alpine .

Default value: scratch

Logging

Logging in Go with Slog

References

About

Boilerplate of GRPC server for go

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages