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

import (
	"context"
	"strconv"
)

// metadata common key
const (
	MetaWeight  = "weight"
	MetaCluster = "cluster"
	MetaZone    = "zone"
	MetaColor   = "color"
)

// Instance represents a server the client connects to.
type Instance struct {
	// Region is region.
	Region string `json:"region"`
	// Zone is IDC.
	Zone string `json:"zone"`
	// Env prod/pre„ÄÅuat/fat1
	Env string `json:"env"`
	// AppID is mapping servicetree appid.
	AppID string `json:"appid"`
	// Hostname is hostname from docker.
	Hostname string `json:"hostname"`
	// Addrs is the address of app instance
	// format: scheme://host
	Addrs []string `json:
    
func (insInf *InstancesInfo) UseScheduler(zone string) (inss []*Instance) {
	var scheduler struct {
		zone    []string
		weights []int64
	}
	var oriWeights []int64
	for _, sch := range insInf.Scheduler {
		if sch.Src == zone {
			for zone, schWeight := range sch.Dst {
				if zins, ok := insInf.Instances[zone]; ok {
					var totalWeight int64
					for _, ins := range zins {
						var weight int64
						if weight, _ = strconv.ParseInt(ins.Metadata[MetaWeight], 10, 64); weight <= 0 {
							weight = 10
						}
						totalWeight += weight
					}
					oriWeights = append(oriWeights, totalWeight)
					inss = append(inss, zins...)
				}
				scheduler.weights = append(scheduler.weights, schWeight)
				scheduler.zone = append(scheduler.zone, zone)
			}
		}
	}
	if len(inss) == 0 {
		var ok bool
		if inss, ok = insInf.Instances[zone]; ok {
			return
		}
		for _, v := range insInf.Instances {
			inss = append(inss, v...)
		}
		return
	}
	var comMulti int64 = 1
	for _, weight := range oriWeights {
		comMulti *= weight
	}
	var fixWeight = make(map[string]int64, len(scheduler.weights))
	for i, zone := range scheduler.zone {
		fixWeight[zone] = scheduler.weights[i] * comMulti / oriWeights[i]
	}
	for _, ins := range inss {
		var weight int64
		if weight, _ = strconv.ParseInt(ins.Metadata[MetaWeight], 10, 64); weight <= 0 {
			weight = 10
		}
		if fix, ok := fixWeight[ins.Zone]; ok {
			weight = weight * fix
		}
		ins.Metadata[MetaWeight] = strconv.FormatInt(weight, 10)
	}
	return
}