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: key_value.go
    path of file: ./repos/syft/syft/pkg
    
    the code of the file until where you have to start completion: package pkg

import (
	"encoding/json"
	"fmt"
	"sort"
)

type KeyValue struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type KeyValues []KeyValue

func (k KeyValues) Get(key string) (string, bool) {
	for _, kv := range k {
		if kv.Key == key {
			return kv.Value, true
		}
	}

	return "", false
}

func (k KeyValues) MustGet(key string) string {
	for _, kv :=
    
func (k *KeyValues) UnmarshalJSON(b []byte) error {
	var kvs []KeyValue
	if err := json.Unmarshal(b, &kvs); err != nil {
		var legacyMap map[string]string
		if err := json.Unmarshal(b, &legacyMap); err != nil {
			return fmt.Errorf("unable to unmarshal KeyValues: %w", err)
		}
		var keys []string
		for k := range legacyMap {
			keys = append(keys, k)
		}
		sort.Strings(keys)
		for _, k := range keys {
			kvs = append(kvs, KeyValue{Key: k, Value: legacyMap[k]})
		}
	}
	*k = kvs
	return nil
}