Skip to main content

Setting up development environment

1. Setting up development environment:

  • Export GOPATH to VSCode/IDE on Linux/MacOS
export GOPATH="$HOME/go"
PATH="$GOPATH/bin:$PATH"
  • Install development libraries:
make init

or

go install github.com/go-kratos/kratos/cmd/kratos/v2@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@latest
go install github.com/go-kratos/kratos/cmd/protoc-gen-go-errors/v2@latest
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest
go install github.com/google/gnostic/cmd/protoc-gen-openapi@latest
go install github.com/google/wire/cmd/wire@latest
go install github.com/envoyproxy/protoc-gen-validate@latest
go install github.com/nicksnyder/go-i18n/v2/goi18n@latest
go install github.com/go-kratos/grpc-gateway/v2@latest
go install github.com/favadi/protoc-go-inject-tag@latest

2. Generate using make

  • Generate GRPC server

    make grpc
  • Generate HTTP server

    make http
  • Generate dependencies using Wire

    make wire
  • Generate Validation rules

    make validate
  • Generate Swagger template

    make swagger
  • Generate configuration Model

    make config
  • General external .proto files

    make ext
  • General all internal rules

    make all
  • Install dependent package

    make mod
  • Show make help

    make help