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: kv.go
    path of file: ./repos/fabio/registry/consul
    
    the code of the file until where you have to start completion: package consul

import (
	"log"
	"strings"
	"time"

	"github.com/hashicorp/consul/api"
)

// watchKV monitors a key in the KV store for changes.
// The intended use case is to add additional route commands to the routing table.
func watchKV(client *api.Client, path string, config chan string, separator bool, requireConsistent bool, allowStale bool) {
	var lastIndex uint64
	var lastValue str
    
func listKeys(client *api.Client, path string, waitIndex uint64, requireConsistent bool, allowStale bool) ([]string, uint64, error) {
	q := &api.QueryOptions{RequireConsistent: requireConsistent, AllowStale: allowStale, WaitIndex: waitIndex}
	kvpairs, meta, err := client.KV().List(path, q)
	if err != nil {
		return nil, 0, err
	}
	if len(kvpairs) == 0 {
		return nil, meta.LastIndex, nil
	}
	var keys []string
	for _, kvpair := range kvpairs {
		keys = append(keys, kvpair.Key)
	}
	return keys, meta.LastIndex, nil
}