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: mutate.go
    path of file: ./repos/ko/vendor/github.com/google/go-containerregistry/cmd/crane/cmd
    
    the code of the file until where you have to start completion: // Copyright 2021 Google LLC All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package cmd

import (
	"errors"
	"fmt"
	"strings"

	"github.com/google/go-containerregistry/pkg/crane"
	"github.com/google/go-containerregistry/pkg/name"
	v1 "github.com/google/go-containerregistry/pkg/v1"
	"github.com/google/go-containerregistry/pkg/v1/mutate"
	"github.c
    
func setEnvVars(cfg *v1.ConfigFile, envVars keyToValue) error {
	eMap := envVars.Map()
	newEnv := make([]string, 0, len(cfg.Config.Env))
	isWindows := cfg.OS == "windows"

	// Keep the old values.
	for _, old := range cfg.Config.Env {
		oldKey, _, ok := strings.Cut(old, "=")
		if !ok {
			return fmt.Errorf("invalid key value pair in config: %s", old)
		}

		if v, ok := eMap[oldKey]; ok {
			// Override in place to keep ordering of original env.
			newEnv = append(newEnv, oldKey+"="+v)

			// Remove this from eMap so we don't add it twice.
			delete(eMap, oldKey)
		} else {
			newEnv = append(newEnv, old)
		}
	}

	// Append the new values.
	for _, e := range envVars.values {
		k, v := e.key, e.value

		if _, ok := eMap[k]; !ok {
			// If we come across a value not in eMap, it means we replaced the
			// old env in-place and deleted it from eMap, so we can skip adding.
			continue
		}

		if isWindows {
			k = strings.ToUpper(k)
		}

		newEnv = append(newEnv, fmt.Sprintf("%s=%s", k, v))
	}

	cfg.Config.Env = newEnv
	return nil
}