github.com/micro/go-micro/examples@v0.0.0-20210105173217-bf4ab679e18b/noproto/main.go (about) 1 package main 2 3 import ( 4 "context" 5 6 "github.com/micro/go-micro/v2" 7 ) 8 9 type Greeter struct{} 10 11 func (g *Greeter) Hello(ctx context.Context, name *string, msg *string) error { 12 *msg = "Hello " + *name 13 return nil 14 } 15 16 func main() { 17 // create new service 18 service := micro.NewService( 19 micro.Name("greeter"), 20 ) 21 22 // initialise command line 23 service.Init() 24 25 // set the handler 26 micro.RegisterHandler(service.Server(), new(Greeter)) 27 28 // run service 29 service.Run() 30 }