github.com/little-bit-shy/go-xgz (project address)

go-xgz

Use the easiest Go micro-service framework to build your own micro-service in 1 minute. The current project is the Go micro-service scaffold

The development environment

Centos\Ubuntu

Directory description

Go - XGZ ├ ─... ├ ─ # business code ├ ─ internal │ ├ ─ # layer timing task registration │ ├ ─ cli │ ├ ─ # data communication layer │ ├ ─ dao │ ├ ─ # data interaction layer │ ├ ─ data │ ├ ─ # rely on injection layer │ ├ ─ di │ ├ ─ │ # service registry layer ├─ └ ├─ Service ├─ └─

Directions for use

Communication container: make bash build container: make build scaffold: make init clean dependency: make clean dependency update: make mod dependency check: make tidy project package: Dependency Injection: Make Write Run Scaffold: Make Run Zipkin: Make Zipkin: Make Zipkin: Make Jaeger: Make Jaeger

Initialize the scaffold

Development environment requirements: docker wget – qO – https://get.docker.com/ | sh

Git clone -b v1.0.0 –depth=1 http://github.com/little-bit-… Step 2: CD go-xgz && make init

Disallow interrupts during initialization Old project location is /data Old project package name github.com/little-bit-shy/go-xgz Current folder is data Initialize project package name (example: github.com/little-bit-shy/go-xgz) : current package name is valid to start refactoring project... go: creating new go.mod: module github.com/little-bit-shy/abc go: finding module for package github.com/olivere/elastic/v7 go: finding module for package github.com/go-playground/validator/v10 go: finding module for package github.com/shopspring/decimal go: finding module for package github.com/google/wire go: Found github.com/google/wire in nv0.5.0 go: Found github.com/olivere/elastic/v7 in github.com/olivere/elastic/v7 v7.0.22 go: Found github.com/shopspring/decimal in github.com/shopspring/decimal v1.2.0 go: Found github.com/go-playground/validator/v10 in v10.4.1 project initialization completed

Step 3: Make run

INFO 06/24-08:28:44.707 /data/ CMD /main.go:44 app start 2021/06/24 08:28:44 start watch filepath: 06/24. / configs/local INFO - 08:28:44. 711 / data/vendor/github.com/go-kratos/kratos/pkg/net/http/blademaster/server.go:97 blademaster: start http listen addr: [::]:8000 [warden] config is Deprecated, Argument will be ignored. Please use the -GRPC flag or GRPC env to configure Warden Server.info 06/24-08:28:44.712 /data/pkg/rpc/warden/server.go:329 warden: start grpc listen addr: [::]:9000

Step 4: curl http://127.0.0.1:8000/call_se…

{
    "code": 0,
    "message": "OK",
    "ttl": 1,
    "data": {
        "content": "who is xuguozhi"
    }
}

Step 5: curl http://127.0.0.1:8000/say? nam…

{ "code":0, "message":"OK", "ttl":1, "data":{ ...... }}

Step 6: Others

The curl curl curl http://127.0.0.1:8000/metrics http://127.0.0.1:8000/debug/pprof http://127.0.0.1:8000/metadata

Step 7: Link tracking

Browser open:http://127.0.0.1:9411