Language: Go
Label: safe
CWE: CWE-366 \u2014 Race Condition within a Thread
If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.

Code:
func (ar *ActivityRepo) GetActivityTypeByObjID(ctx context.Context, objectID string, action string) (
	activityType, rank, hasRank int, err error) {
	objectType, err := obj.GetObjectTypeStrByObjectID(objectID)
	if err != nil {
		return
	}

	confKey := fmt.Sprintf("%s.%s", objectType, action)
	cfg, err := ar.configService.GetConfigByKey(ctx, confKey)
	if err != nil {
		return
	}
	activityType, rank = cfg.ID, cfg.GetIntValue()
	hasRank = 0
	if rank != 0 {
		hasRank = 1
	}
	return
}