package main import ( "github.com/gin-gonic/gin" "github.com/micro/plugins/v5/registry/consul" "go-micro.dev/v5/registry" "go-micro.dev/v5/web" "myschools.me/suguo/go-micro-demo/handler" ) func main() { consulReg := consul.NewRegistry( registry.Addrs("127.0.0.1:8500"), ) ginRouter := gin.New() v1 := ginRouter.Group(`/v1`) { v1.GET(`/hello`, handler.HelloWorld) } service := web.NewService( web.Name("hello"), web.Handler(ginRouter), web.Address(":8080"), web.Registry(consulReg), ) service.Init() service.Run() }