git.zd.zone/hrpc/hrpc@v0.0.12/client/client.go (about) 1 package client 2 3 // clients have all the registered clients 4 var clients []func() error 5 6 // Register can be used to register a client to the framework. 7 // It is usually used by the protobuf protocol file. 8 // If you really need it, please check your demands. 9 func Register(fn func() error) { 10 clients = append(clients, fn) 11 } 12 13 // Load will load all registered client from the `clients` slice. 14 // If any error exists, an error will be returned. 15 func Load() error { 16 for _, c := range clients { 17 if err := c(); err != nil { 18 return err 19 } 20 } 21 return nil 22 }