router/hc.go
func BuildHealthCheck(routerName string) func() error {
	return func() error {
		routerConfig, err := config.Get("routers")
		if err != nil {
			return hc.ErrDisabledComponent
		}
		routers, _ := routerConfig.(map[interface{}]interface{})
		checkCount := 0
		for ifaceName := range routers {
			name := ifaceName.(string)
			if name != routerName {
				namedRouter := routers[name].(map[interface{}]interface{})
				if tp, _ := namedRouter["type"].(string); tp != routerName {
					continue
				}
			}
			checkCount++
			err := healthCheck(name)
			if err != nil {
				return err
			}
		}
		if checkCount == 0 {
			return hc.ErrDisabledComponent
		}
		return nil
	}
}
func BuildHealthCheck(routerName string) func() error {
	return func() error {
		routerConfig, err := config.Get("routers")
		if err != nil {
			return hc.ErrDisabledComponent
		}
		routers, _ := routerConfig.(map[interface{}]interface{})
		checkCount := 0
		for ifaceName := range routers {
			name := ifaceName.(string)
			if name != routerName {
				namedRouter := routers[name].(map[interface{}]interface{})
				if tp, _ := namedRouter["type"].(string); tp != routerName {
					continue
				}
			}
			checkCount++
			err := healthCheck(name)
			if err != nil {
				return err
			}
		}
		if checkCount == 0 {
			return hc.ErrDisabledComponent
		}
		return nil
	}
}
// BuildHealthCheck creates a healthcheck function for the given routerName.
//
// It will call the HealthCheck() method in the router (only if it's also a
// HealthChecker), for each instance of it (including the "main" instance and
// all custom routers).