// checkContextKeyType reports an error if the call expression calls
// context.WithValue with a key argument of basic type.
14650
func (f *file) checkContextKeyType(x *ast.CallExpr) {
	sel, ok := x.Fun.(*ast.SelectorExpr)
	if !ok {
		return
	}
	pkg, ok := sel.X.(*ast.Ident)
	if !ok || pkg.Name != "context" {
		return
	}
	if sel.Sel.Name != "WithValue" {
		return
	}

	// key is second argument to context.WithValue
	if len(x.Args) != 3 {
		return
	}
	key := f.pkg.typesInfo.Types[x.Args[1]]

	if ktyp, ok := key.Type.(*types.Basic); ok && ktyp.Kind() != types.Invalid {
		f.errorf(x, 1.0, category("context"), fmt.Sprintf("should not use basic type %s as key in context.WithValue", key.Type))
	}
}
773226
func (o *FlushInactiveOAuth2TokensParams) WithContext(ctx context.Context) *FlushInactiveOAuth2TokensParams {
	o.SetContext(ctx)
	return o
}
896076
func (o *GetOAuth2ClientParams) WithContext(ctx context.Context) *GetOAuth2ClientParams {
	o.SetContext(ctx)
	return o
}
1156748
func (call *IssueLinkTokenCall) WithContext(ctx context.Context) *IssueLinkTokenCall {
	call.ctx = ctx
	return call
}
630057
func GetContext(err error, key string) interface{} {
	if e, ok := err.(withContext); ok {
		return e.Get(key)
	}
	return ""
}
289008
func DialWithContext(ctx context.Context) DialOption {
	return DialOption{func(do *dialOptions) {
		do.context = ctx
	}}
}
991525
func EnumDescriptorFromContext(ctx context.Context) (*EnumDescriptor, bool) {
	val, ok := ctx.Value(enumContextKey).(*EnumDescriptor)
	return val, ok
}
1059590
func requiresContext(handlerType reflect.Type) bool {
	//if the method doesn't take arguments, no
	if handlerType.NumIn() == 0 {
		return false
	}

	//if the first argument is not a pointer, no
	a0 := handlerType.In(0)
	if a0.Kind() != reflect.Ptr {
		return false
	}
	//if the first argument is a context, yes
	if a0.Elem() == contextType {
		return true
	}

	return false
}
645946
func (entry *Entry) WithContext(ctx context.Context) *Entry {
	return &Entry{Logger: entry.Logger, Data: entry.Data, Time: entry.Time, err: entry.err, Context: ctx}
}
665151
func (call *GetNumberMessagesCall) WithContext(ctx context.Context) *GetNumberMessagesCall {
	call.ctx = ctx
	return call
}
621407
func (o *AddOneParams) WithContext(ctx context.Context) *AddOneParams {
	o.SetContext(ctx)
	return o
}
876258
func (call *GetLIFFAllCall) WithContext(ctx context.Context) *GetLIFFAllCall {
	call.ctx = ctx
	return call
}
598963
func (l *Logger) GetContext(key string) (interface{}, bool) {
	l.globalsL.RLock()
	defer l.globalsL.RUnlock()
	val, ok := l.globals[key]
	return val, ok
}
1260438
func (f *file) lintContextKeyTypes() {
	f.walk(func(node ast.Node) bool {
		switch node := node.(type) {
		case *ast.CallExpr:
			f.checkContextKeyType(node)
		}

		return true
	})
}
1197534
func (call *GetMessageQuotaCall) WithContext(ctx context.Context) *GetMessageQuotaCall {
	call.ctx = ctx
	return call
}
864327
func (call *AddLIFFCall) WithContext(ctx context.Context) *AddLIFFCall {
	call.ctx = ctx
	return call
}
943796
func (call *GetProfileCall) WithContext(ctx context.Context) *GetProfileCall {
	call.ctx = ctx
	return call
}