// Used to initialize the package resolver
182456
func (c *CommandConfig) InitPackageResolver() {
	c.Vendored = utils.DirExists(filepath.Join(c.AppPath, "vendor"))
	if c.Index == NEW && c.New.Vendored {
		c.Vendored = true
	}

	utils.Logger.Info("InitPackageResolver", "useVendor", c.Vendored, "path", c.AppPath)

	var (
		depPath string
		err     error
	)

	if c.Vendored {
		utils.Logger.Info("Vendor folder detected, scanning for deps in path")
		depPath, err = exec.LookPath("dep")
		if err != nil {
			// Do not halt build unless a new package needs to be imported
			utils.Logger.Fatal("Build: `dep` executable not found in PATH, but vendor folder detected." +
				"Packages can only be added automatically to the vendor folder using the `dep` tool. " +
				"You can install the `dep` tool by doing a `go get -u github.com/golang/dep/cmd/dep`")
		}
	}

	// This should get called when needed
	c.PackageResolver = func(pkgName string) error {
		//useVendor := utils.DirExists(filepath.Join(c.AppPath, "vendor"))

		var getCmd *exec.Cmd
		utils.Logger.Info("Request for package ", "package", pkgName, "use vendor", c.Vendored)
		if c.Vendored {
			utils.Logger.Info("Using dependency manager to import package", "package", pkgName)

			if depPath == "" {
				utils.Logger.Error("Build: Vendor folder found, but the `dep` tool was not found, " +
					"if you use a different vendoring (package management) tool please add the following packages by hand, " +
					"or install the `dep` tool into your gopath by doing a `go get -u github.com/golang/dep/cmd/dep`. " +
					"For more information and usage of the tool please see http://github.com/golang/dep")
				utils.Logger.Error("Missing package", "package", pkgName)
				return fmt.Errorf("Missing package %s", pkgName)
			}
			// Check to see if the package exists locally
			_, err := build.Import(pkgName, c.AppPath, build.FindOnly)
			if err != nil {
				getCmd = exec.Command(depPath, "ensure", "-add", pkgName)
			} else {
				getCmd = exec.Command(depPath, "ensure", "-update", pkgName)
			}


		} else {
			utils.Logger.Info("No vendor folder detected, not using dependency manager to import package", "package", pkgName)
			getCmd = exec.Command(c.GoCmd, "get", "-u", pkgName)
		}

		utils.CmdInit(getCmd, c.AppPath)
		utils.Logger.Info("Go get command ", "exec", getCmd.Path, "dir", getCmd.Dir, "args", getCmd.Args, "env", getCmd.Env, "package", pkgName)
		output, err := getCmd.CombinedOutput()
		if err != nil {
			fmt.Printf("Error stack %v\n", logger.NewCallStack())
			utils.Logger.Error("Failed to import package", "error", err, "gopath", build.Default.GOPATH, "GO-ROOT", build.Default.GOROOT, "output", string(output))
		}
		return err
	}
}
999591
func New(version string, config records.Config) *Resolver {
	generatorOptions := []records.Option{
		records.WithConfig(config),
	}
	recordGenerator := records.NewRecordGenerator(generatorOptions...)
	r := &Resolver{
		version: version,
		config:  config,
		ready:   make(chan struct{}),
		rs:      recordGenerator,
		// rand.Sources aren't safe for concurrent use, except the global one.
		// See: https://github.com/golang/go/issues/3611
		rng:              rand.New(&lockedSource{src: rand.NewSource(time.Now().UnixNano())}),
		masters:          append([]string{""}, config.Masters...),
		generatorOptions: generatorOptions,
	}

	timeout := 5 * time.Second
	if config.Timeout != 0 {
		timeout = time.Duration(config.Timeout) * time.Second
	}

	r.zoneFwds = make(map[string]exchanger.Forwarder)
	if config.ExternalOn {
		for zone, resolvers := range config.ZoneResolvers {
			r.zoneFwds[zone] = exchanger.NewForwarder(resolvers, exchangers(timeout, "udp", "tcp"))
		}
		r.defaultFwd = exchanger.NewForwarder(
			config.Resolvers, exchangers(timeout, "udp", "tcp"))
	} else {
		r.defaultFwd = exchanger.NewForwarder(
			make([]string, 0), exchangers(timeout, "udp", "tcp"))
	}

	return r
}
734125
func (r *Resolver) ResolvePackage(ctx context.Context, pkg, ver string) (pin common.Pin, err error) {
	if err = common.ValidatePackageName(pkg); err != nil {
		return
	}
	if err = common.ValidateInstanceVersion(ver); err != nil {
		return
	}

	// If a version looks like IID already just use it as a pin right away.
	if common.ValidateInstanceID(ver, common.AnyHash) == nil {
		pin = common.Pin{PackageName: pkg, InstanceID: ver}
	} else {
		pin, err = r.resolveVersion(ctx, pkg, ver)
		if err != nil {
			return
		}
	}

	if r.VerifyPresence {
		err = r.verifyPin(ctx, pin)
	}

	if err == nil && r.Visitor != nil {
		r.Visitor(pkg, ver, pin.InstanceID)
	}

	return
}
1187384
func (g *Generator) init() {
	g.filedInit = []string{}
	g.imports = map[string]bool{}
	g.pooledObjects = map[string]string{}
	g.structTypes = map[string]string{}
	g.sliceTypes = map[string]string{}
	g.poolInit = map[string]string{}
	g.addImport(gojayPackage)
	// if we want pools, add the sync package right away
	if g.options.PoolObjects {
		g.addImport("sync")
	}
}
843666
func (sr *StaticResolver) Resolve(ctx context.Context) (string, connect.CertURI, error) {
	return sr.Addr, sr.CertURI, nil
}
153110
func NewResolver(cmd *cobra.Command, c api.ControlClient) *Resolver {
	return &Resolver{
		cmd:   cmd,
		c:     c,
		ctx:   Context(cmd),
		cache: make(map[string]string),
	}
}
270688
func init() {
	zeroArg = make([]reflect.Value, 0)
	zeroArgInterf = make([]interface{}, 0)
	trueInterf = true
	falseInterf = false
	nilInterf = nil
}
723112
func init() {
	GoStructRegistry = GoStructRegistryType{
		Registry: make(map[string]*RegisteredType),
		Builtin:  make(map[string]*RegisteredType),
		Userdef:  make(map[string]*RegisteredType),
	}

	gsr := &GoStructRegistry

	// add go builtin types
	// ====================

	// empty array
	gsr.RegisterBuiltin("[]", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return &SexpArray{}, nil
	}})

	// scope, as used by the package operation
	gsr.RegisterBuiltin("packageScope", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		pkg := env.NewScope()
		pkg.Name = "prototype"
		pkg.IsPackage = true
		return pkg, nil
	}})

	gsr.RegisterBuiltin("packageScopeStack", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		pkg := env.NewStack(0)
		pkg.Name = "prototypePackageScopeStack"
		pkg.IsPackage = true
		return pkg, nil
	}})

	gsr.RegisterBuiltin("arraySelector", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return &SexpArraySelector{}, nil
	}})

	gsr.RegisterBuiltin("hashSelector", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return &SexpHashSelector{}, nil
	}})

	gsr.RegisterBuiltin("comment",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return SexpNull, nil
		}})
	gsr.RegisterBuiltin("byte",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return new(byte), nil
		}})
	gsr.RegisterBuiltin("uint8",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return new(byte), nil
		}})

	gsr.RegisterBuiltin("int",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return new(int), nil
		}})
	gsr.RegisterBuiltin("uint16",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return new(uint16), nil
		}})
	gsr.RegisterBuiltin("uint32",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return new(uint32), nil
		}})
	gsr.RegisterBuiltin("uint64",
		&RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
			return new(uint64), nil
		}})
	gsr.RegisterBuiltin("int8", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(int8), nil
	}})
	gsr.RegisterBuiltin("int16", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(int16), nil
	}})
	gsr.RegisterBuiltin("int32", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(int32), nil
	}})
	gsr.RegisterBuiltin("rune", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(int32), nil
	}})
	gsr.RegisterBuiltin("int64", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(int64), nil
	}})
	gsr.RegisterBuiltin("float32", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(float32), nil
	}})

	gsr.RegisterBuiltin("float64", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(float64), nil
	}})

	gsr.RegisterBuiltin("complex64", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(complex64), nil
	}})

	gsr.RegisterBuiltin("complex128", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(complex128), nil
	}})

	gsr.RegisterBuiltin("bool", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(bool), nil
	}})

	gsr.RegisterBuiltin("string", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(string), nil
	}})

	gsr.RegisterBuiltin("time.Time", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(time.Time), nil
	}})

	// add Sexp types

	gsr.RegisterBuiltin("symbol", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return &SexpSymbol{}, nil
	}})

	/* either:

	gsr.RegisterBuiltin("time.Time", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		return new(time.Time), nil
	}})
	*/

	// PairRT *RegisteredType
	// RawRT *RegisteredType
	// ReflectRT *RegisteredType
	// ErrorRT *RegisteredType
	gsr.RegisterBuiltin("error", &RegisteredType{GenDefMap: false, Factory: func(env *Zlisp, h *SexpHash) (interface{}, error) {
		var err error
		return &err, nil
	}})

	// SentinelRT *RegisteredType
	// ClosureRT *RegisteredType
}
1236628
func NewUniterResolver(cfg ResolverConfig) resolver.Resolver {
	return &uniterResolver{
		config:                cfg,
		retryHookTimerStarted: false,
	}
}
377806
func (r *IDResolver) Resolve(ctx context.Context, t interface{}, id string) (string, error) {
	if r.noResolve {
		return id, nil
	}
	if name, ok := r.cache[id]; ok {
		return name, nil
	}
	name, err := r.get(ctx, t, id)
	if err != nil {
		return "", err
	}
	r.cache[id] = name
	return name, nil
}
773889
func NewResolver(address string, proxyDNS bool, resolverKey string, backend DNSBackend) Resolver {
	return &resolver{
		backend:       backend,
		proxyDNS:      proxyDNS,
		listenAddress: address,
		resolverKey:   resolverKey,
		err:           fmt.Errorf("setup not done yet"),
		startCh:       make(chan struct{}, 1),
	}
}
871220
func (e *DefaultEndorsement) Init(dependencies ...Dependency) error {
	for _, dep := range dependencies {
		sIDFetcher, isSigningIdentityFetcher := dep.(SigningIdentityFetcher)
		if !isSigningIdentityFetcher {
			continue
		}
		e.SigningIdentityFetcher = sIDFetcher
		return nil
	}
	return errors.New("could not find SigningIdentityFetcher in dependencies")
}
1263585
func (p *PhysicalMergeJoin) ResolveIndices() (err error) {
	err = p.physicalSchemaProducer.ResolveIndices()
	if err != nil {
		return err
	}
	lSchema := p.children[0].Schema()
	rSchema := p.children[1].Schema()
	for i, col := range p.LeftKeys {
		newKey, err := col.ResolveIndices(lSchema)
		if err != nil {
			return err
		}
		p.LeftKeys[i] = newKey.(*expression.Column)
	}
	for i, col := range p.RightKeys {
		newKey, err := col.ResolveIndices(rSchema)
		if err != nil {
			return err
		}
		p.RightKeys[i] = newKey.(*expression.Column)
	}
	for i, expr := range p.LeftConditions {
		p.LeftConditions[i], err = expr.ResolveIndices(lSchema)
		if err != nil {
			return err
		}
	}
	for i, expr := range p.RightConditions {
		p.RightConditions[i], err = expr.ResolveIndices(rSchema)
		if err != nil {
			return err
		}
	}
	for i, expr := range p.OtherConditions {
		p.OtherConditions[i], err = expr.ResolveIndices(expression.MergeSchema(lSchema, rSchema))
		if err != nil {
			return err
		}
	}
	return
}
870487
func init() {
	docsProvider := func() map[string]interface{} {
		docs := make(map[string]interface{})

		docs["formats"] = DefaultFormats
		docs["layouts"] = createLayoutExamples()
		return docs
	}

	docshelper.AddDocProvider("output", docsProvider)
}
1212645
func (i *ComponentInput) Resolve() error {
	if i.Resolver == nil {
		return ErrNoMatch{Value: i.Value, Qualifier: "no resolver defined"}
	}
	match, err := i.Resolver.Resolve(i.Value)
	if err != nil {
		return err
	}
	i.Value = match.Value
	i.Argument = match.Argument
	i.ResolvedMatch = match
	return nil
}
699065
func resolvePackageName(packageName string, kernelRelease string) string {
	packageName = strings.Replace(packageName, "${KERNEL_RELEASE}", kernelRelease, -1)
	return packageName
}
1160205
func init() {
	graphdriver.Register("windowsfilter", InitFilter)
	// DOCKER_WINDOWSFILTER_NOREEXEC allows for inline processing which makes
	// debugging issues in the re-exec codepath significantly easier.
	if os.Getenv("DOCKER_WINDOWSFILTER_NOREEXEC") != "" {
		logrus.Warnf("WindowsGraphDriver is set to not re-exec. This is intended for debugging purposes only.")
		noreexec = true
	} else {
		reexec.Register("docker-windows-write-layer", writeLayerReexec)
	}
}