6.6 cwgo 代码生成工具、git、docker

6.6 cwgo 代码生成工具、git、docker #

cwgo脚手架: 自动生成项目结构layout #

  • thrift版:

    1
    2
    3
    4
    5
    6
    
     cwgo server --type RPC --module github.com/cloudwego/biz-demp/gomall/demo/demo_thrift --service demo_thrift --idl ../../idl/echo.thrift
    
     go mod tidy
     go work use .
    
     go run .
    

  • makefile:一键代码生成

    1
    2
    3
    4
    5
    6
    
    .PHONY: gen-demo-proto
    gen-demo-proto:
    	@cd demo/demo_proto && cwgo server -I ../../idl --type RPC --module github.com/cloudwego/biz-demp/gomall/demo/demo_proto --service demo_proto --idl ../../idl/echo.proto
    .PHONY: gen-demo-thrift
    gen-demo-thrift:
    	@cd demo/demo_thrift && cwgo server -I ../../idl --type RPC --module github.com/cloudwego/biz-demp/gomall/demo/demo_thrift --service demo_thrift --idl ../../idl/echo.thrift
    
    • 运行makefile:
      1
      
      make gen-demo-thrift
      
  • IDL拓展