func toABC()

in mse-simple-demo/GoApp/service.go [92:124]


func toABC(ctx context.Context) (string, error) {
	w := sync.WaitGroup{}
	w.Add(3)
	var aResp, bResp, cResp string
	var aErr, bErr, cErr error
	go func() {
		aResp, aErr = toApp(ctx, "spring-cloud-a:20001", "/a")
		if aErr != nil {
			fmt.Printf("[toABC] to a error: %v\n", aErr)
			aResp = aErr.Error()
		}
		w.Done()
	}()
	go func() {
		bResp, bErr = toApp(ctx, "spring-cloud-b:20002", "/b")
		if bErr != nil {
			fmt.Printf("[toABC] to b error: %v\n", bErr)
			bResp = bErr.Error()
		}
		w.Done()
	}()
	go func() {
		cResp, cErr = toApp(ctx, "spring-cloud-c:20003", "/c")
		if cErr != nil {
			fmt.Printf("[toABC] to c error: %v\n", cErr)
			cResp = cErr.Error()
		}
		w.Done()
	}()
	w.Wait()

	return aResp + "\n" + bResp + "\n" + cResp, nil
}