Golang keep installation status for multiple installations process Im fairly new to Golang and I appreciate any feedback about how to make the code cleaner.
The code is called by go-routine and should update status (fail/success etc) of several installation process.
package avss

import (
    &quot;context&quot;
    &quot;sync&quot;

    &quot;helm.sh/helm/v3/pkg/release&quot;

    &quot;sigs.k8s.io/controller-runtime/pkg/client&quot;

    avmv1alpha1 &quot;github.vmp/avs/api/v1alpha1&quot;
)

func GetUpdateStatus(ctx context.Context, log logr.Logger, cr client.Object, status *avmv1alpha1.ComponentStatusWithAggregation, statusClient client.StatusClient) func(chartStatus *avmv1alpha1.InstallStatus) error {
    var conditionMutex sync.Mutex

    return func(chartStatus *avmv1alpha1.InstallStatus) error {

        // prevent status update by subroutines at the same time, lock the access to prevent concurrent modification
        conditionMutex.Lock()
        defer conditionMutex.Unlock()
        status.ChartStatus = updateStatus(chartStatus, status.ChartStatus)
        status.Status = overallStatus(status.ChartStatus)
        err := statusClient.Status().Update(ctx, cr)
        return err
    }
}

func overallStatus(chartsStatus []avmv1alpha1.InstallStatus) string {
    overallStatus := &quot;&quot;
    for _, status := range chartsStatus {
        switch status.ReleaseStatus {
        case release.StatusFailed.String():
            overallStatus = &quot;error&quot;
        case release.StatusDeployed.String():
            if overallStatus == &quot;&quot; {
                overallStatus = &quot;installed&quot;
            }
        default:
            if overallStatus != release.StatusFailed.String() {
                overallStatus = &quot;reconcile&quot;
            }
        }
    }
    return overallStatus
}

func updateStatus(newStatus *avmv1alpha1.ChartStatus, cStatus []avmv1alpha1.InstallStatus) []avmv1alpha1.ChartStatus {
    found := false
    for i, status := range cStatus {
        if status.Name == newStatus.Name {
            found = true
            cStatus[i] = *newStatus
        }
    }
    if !found {
        cStatus = append(cStatus, *newStatus)
    }
    return cStatus
}

https://play.golang.org/p/9C8xGV2116O
The code is working! however, I guess it can be improved as this is my first Go program which should be run in production :-)
If the code is perfect,   please let me know
Overall this looks like a pretty sensible file. Some minor points you might want to consider follow.
Imports
logr is not imported in the file. I presume this is https://github.com/go-logr/logr. It's passed into the first function but not used. Perhaps remove it from the signature?
Discrete strings
overallStatus returns one of four strings. You could define these strings as constants like Siva mentioned. A step further is to introduce a type that groups these strings together. This

ensures the function returns one of the strings defined, and
makes it clear what strings can be returned from the function by looking at the signature.

type status string

const (
    statusUnknown   status = &quot;&quot;
    statusError     status = &quot;error&quot;
    statusInstalled status = &quot;installed&quot;
    statusReconcile status = &quot;reconcile&quot;
)