You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: partition_validator.go
    path of file: ./repos/flyte/datacatalog/pkg/manager/impl/validators
    
    the code of the file until where you have to start completion: package validators

import (
	"fmt"

	"google.golang.org/grpc/codes"

	"github.com/flyteorg/flyte/datacatalo
    
func ValidatePartitions(datasetPartitionKeys []string, artifactPartitions []*datacatalog.Partition) error {
	if len(datasetPartitionKeys) != len(artifactPartitions) {
		return errors.NewDataCatalogErrorf(codes.InvalidArgument, "Partition key mismatch, dataset keys: %+v, artifact Partitions: %+v", datasetPartitionKeys, artifactPartitions)
	}

	// Not all datasets need to be partitioned
	if len(datasetPartitionKeys) == 0 {
		return nil
	}

	// compare the contents of the datasetkeys and artifact keys
	partitionErrors := make([]error, 0)
	keyMismatch := false

	partitionKeyMatches := make(map[string]bool, len(artifactPartitions))
	for _, datasetPartitionKey := range datasetPartitionKeys {
		partitionKeyMatches[datasetPartitionKey] = false
	}

	for idx, artifactPartition := range artifactPartitions {
		if artifactPartition == nil {
			partitionErrors = append(partitionErrors, NewMissingArgumentError(fmt.Sprintf("%v[%v]", partitionKeyName, idx)))
			continue
		}

		if err := ValidateEmptyStringField(partitionKeyName, artifactPartition.Key); err != nil {
			partitionErrors = append(partitionErrors, NewMissingArgumentError(fmt.Sprintf("%v[%v]", partitionKeyName, idx)))
		} else if err := ValidateEmptyStringField(partitionValueName, artifactPartition.Value); err != nil {
			partitionErrors = append(partitionErrors, NewMissingArgumentError(fmt.Sprintf("%v[%v]", partitionValueName, idx)))
		} else {
			_, ok := partitionKeyMatches[artifactPartition.Key]

			if ok {
				partitionKeyMatches[artifactPartition.Key] = true
			} else {
				keyMismatch = true
			}
		}
	}

	if keyMismatch {
		partitionErrors = append(partitionErrors, errors.NewDataCatalogErrorf(codes.InvalidArgument, "Artifact partition assignment does not match dataset partition keys: %v", partitionKeyMatches))
	}

	if len(partitionErrors) > 0 {
		return errors.NewCollectedErrors(codes.InvalidArgument, partitionErrors)
	}

	return nil
}