Question about - SampleBranchWorkflow (Go)

// SampleBranchWorkflow is a Temporal Workflow Definition
// This Workflow Definition shows how to call multiple Activities in parallel.
// The number of branches is controlled by a passed in parameter.

Good day

I have the following question

i want to process 10 -…n files that i have uploaded to the server. I have 10 - …n entries in each file

  1. 1Activity - count lines in a file
  2. 2Activity - Processing 10 - …n values in each file

I am getting 10 - …n files in the handler, what should i do next?

What would be the correct solution, run the for loop inside activity2 or run the SampleBranchWorkflow?

will it be correct if totalBranches in my example will be the number of files?

func SampleBranchWorkflow(ctx workflow.Context, totalBranches int) (result []string, err error) {
	logger := workflow.GetLogger(ctx)
	logger.Info("SampleBranchWorkflow begin")

	ao := workflow.ActivityOptions{
		StartToCloseTimeout: 10 * time.Second,
	}
	ctx = workflow.WithActivityOptions(ctx, ao)

	var futures []workflow.Future
	for i := 1; i <= totalBranches; i++ {
		activityInput := fmt.Sprintf("branch %d of %d.", i, totalBranches)
		future := workflow.ExecuteActivity(ctx, SampleActivity, activityInput)
		futures = append(futures, future)
	}
	logger.Info("Activities started")

	// accumulate results
	for _, future := range futures {
		var singleResult string
		err = future.Get(ctx, &singleResult)
		logger.Info("Activity returned with result", "resutl", singleResult)
		if err != nil {
			return
		}
		result = append(result, singleResult)
	}

	logger.Info("SampleBranchWorkflow end")
	return
}