// BuildContext creates a build.Context which uses the overlay FS and the InitializeParams.BuildContext overrides.
420111
func (h *LangHandler) BuildContext(ctx context.Context) *build.Context {
	var bctx *build.Context
	if override := h.init.BuildContext; override != nil {
		bctx = &build.Context{
			GOOS:        override.GOOS,
			GOARCH:      override.GOARCH,
			GOPATH:      override.GOPATH,
			GOROOT:      override.GOROOT,
			CgoEnabled:  override.CgoEnabled,
			UseAllFiles: override.UseAllFiles,
			Compiler:    override.Compiler,
			BuildTags:   override.BuildTags,

			// Enable analysis of all go version build tags that
			// our compiler should understand.
			ReleaseTags: build.Default.ReleaseTags,
		}
	} else {
		// make a copy since we will mutate it
		copy := build.Default
		bctx = &copy
	}

	h.Mu.Lock()
	fs := h.FS
	h.Mu.Unlock()

	util.PrepareContext(bctx, ctx, fs)
	return bctx
}
240680
func (builder *UpdateMapCommandBuilder) WithContext(context []byte) *UpdateMapCommandBuilder {
	builder.protobuf.Context = context
	return builder
}
1235036
func (w *Ware) CreateContext() *context {
	c := &context{inject.New(), w.handlers, w.action, nil, 0}
	c.SetParent(w)
	c.MapTo(c, (*Context)(nil))
	return c
}
1270282
func NSBuildParentContext(el *etree.Element) (NSContext, error) {
	parent := el.Parent()
	if parent == nil {
		return DefaultNSContext, nil
	}

	ctx, err := NSBuildParentContext(parent)

	if err != nil {
		return ctx, err
	}

	return ctx.SubContext(parent)
}
931944
func (fa *Factory) ConstructWithContextAndOption(ctx context.Context, ptr interface{}, opt map[string]interface{}) error {
	pt := reflect.TypeOf(ptr)
	if pt.Kind() != reflect.Ptr {
		return errors.New("ptr should be pointer type.")
	}
	pt = pt.Elem()
	if pt.Name() != fa.modelName() {
		return errors.New("ptr type should be " + fa.modelName())
	}

	inst := reflect.ValueOf(ptr).Elem()
	_, err := fa.build(ctx, &inst, pt, opt, nil)
	return err
}
337113
func (c *Client) WithContext(ctx context.Context) *Client {
	newC := *c
	newC.ctx = ctx
	return &newC
}
1008918
func wrapContext(ctx context.Context, f *FS) context.Context {
	ctx = context.WithValue(ctx, libfs.CtxAppIDKey, f)
	logTags := make(logger.CtxLogTags)
	logTags[CtxIDKey] = CtxOpID
	ctx = logger.NewContextWithLogTags(ctx, logTags)
	return ctx
}
1340159
func (c *ValidateConfigCall) Context(ctx context.Context) *ValidateConfigCall {
	c.ctx_ = ctx
	return c
}
79476
func (c *AppversionListCall) Context(ctx context.Context) *AppversionListCall {
	c.ctx_ = ctx
	return c
}
380016
func (s *MessageRequest) SetContext(v map[string]*string) *MessageRequest {
	s.Context = v
	return s
}
583883
func (c *ServerGetBootstrapCall) Context(ctx context.Context) *ServerGetBootstrapCall {
	c.ctx_ = ctx
	return c
}
891110
func WithContext(ctx context.Context, fnctx Context) context.Context {
	return context.WithValue(ctx, ctxKey, fnctx)
}
963031
func NewCachingContext(baseDir string, funcs template.FuncMap) Context {
	return &cachingContext{
		baseDir: baseDir,
		mut:     new(sync.Mutex),
		cache:   make(map[filesMapKey]*template.Template),
		funcs:   funcs,
	}
}
212595
func (o *PatchConfigParams) WithContext(ctx context.Context) *PatchConfigParams {
	o.SetContext(ctx)
	return o
}
749221
func (c *FixBuildsCall) Context(ctx context.Context) *FixBuildsCall {
	c.ctx_ = ctx
	return c
}
621407
func (o *AddOneParams) WithContext(ctx context.Context) *AddOneParams {
	o.SetContext(ctx)
	return o
}
546670
func (o *CreateOAuth2ClientParams) WithContext(ctx context.Context) *CreateOAuth2ClientParams {
	o.SetContext(ctx)
	return o
}