// DoerFunc calls f(req).
558234
func (f DoerFunc) Do(req *http.Request) (resp *http.Response, err error) {
	return f(req)
}
262954
func (n *Negroni) UseHandlerFunc(handlerFunc func(rw http.ResponseWriter, r *http.Request)) {
	n.UseHandler(http.HandlerFunc(handlerFunc))
}
40678
func TraceIDFunc(f IDFunc) TracerOption {
	return func(o *tracerOptions) *tracerOptions {
		if f == nil {
			panic("trace ID function cannot be nil")
		}
		o.traceIDFunc = f
		return o
	}
}
261670
func (e Equalities) AddFunc(eqFunc interface{}) error {
	fv := reflect.ValueOf(eqFunc)
	ft := fv.Type()
	if ft.Kind() != reflect.Func {
		return fmt.Errorf("expected func, got: %v", ft)
	}
	if ft.NumIn() != 2 {
		return fmt.Errorf("expected two 'in' params, got: %v", ft)
	}
	if ft.NumOut() != 1 {
		return fmt.Errorf("expected one 'out' param, got: %v", ft)
	}
	if ft.In(0) != ft.In(1) {
		return fmt.Errorf("expected arg 1 and 2 to have same type, but got %v", ft)
	}
	var forReturnType bool
	boolType := reflect.TypeOf(forReturnType)
	if ft.Out(0) != boolType {
		return fmt.Errorf("expected bool return, got: %v", ft)
	}
	e[ft.In(0)] = fv
	return nil
}
1026060
func (f *file) lintFuncDoc(fn *ast.FuncDecl) {
	if !ast.IsExported(fn.Name.Name) {
		// func is unexported
		return
	}
	kind := "function"
	name := fn.Name.Name
	if fn.Recv != nil && len(fn.Recv.List) > 0 {
		// method
		kind = "method"
		recv := receiverType(fn)
		if !ast.IsExported(recv) {
			// receiver is unexported
			return
		}
		if commonMethods[name] {
			return
		}
		switch name {
		case "Len", "Less", "Swap":
			if f.pkg.sortable[recv] {
				return
			}
		}
		name = recv + "." + name
	}
	if fn.Doc == nil {
		f.errorf(fn, 1, link(docCommentsLink), category("comments"), "exported %s %s should have comment or be unexported", kind, name)
		return
	}
	s := fn.Doc.Text()
	prefix := fn.Name.Name + " "
	if !strings.HasPrefix(s, prefix) {
		f.errorf(fn.Doc, 1, link(docCommentsLink), category("comments"), `comment on exported %s %s should be of the form "%s..."`, kind, name, prefix)
	}
}
908139
func (f *FetchRetrier) IsOffline(ctx context.Context) bool {
	f.Lock()
	defer f.Unlock()
	return f.offline
}
1205455
func (req *SrvReq) RespondRflush() {
	err := PackRflush(req.Rc)
	if err != nil {
		req.RespondError(err)
	} else {
		req.Respond()
	}
}
205266
func (b *Bundle) MustTfunc(pref string, prefs ...string) TranslateFunc {
	tfunc, err := b.Tfunc(pref, prefs...)
	if err != nil {
		panic(err)
	}
	return tfunc
}
1178273
func (r *Router) HandleFunc(event string, fn func(http.ResponseWriter, *http.Request)) {
	r.Handle(event, http.HandlerFunc(fn))
}
704948
func (h Handler) HandleFunc(path string, fn func(w http.ResponseWriter, r *http.Request)) {
	h.mux.HandleFunc(path, fn)
}
762551
func (r *Route) HandlerFunc(f func(context.Context, http.ResponseWriter, *http.Request) error) *Route {
	return r.Handler(HandlerFunc(f))
}
1140272
func (t *Tree) parseSubstrFunc(name string) (Node, error) {
	node := new(FuncNode)
	node.Param = name

	t.scanner.accept = acceptOneColon
	t.scanner.mode = scanIdent
	switch t.scanner.scan() {
	case tokenIdent:
		node.Name = t.scanner.string()
	default:
		return nil, ErrBadSubstitution
	}

	// scan arg[1]
	{
		param, err := t.parseParam(rejectColonClose, scanIdent)
		if err != nil {
			return nil, err
		}

		// param.Value = t.scanner.string()
		node.Args = append(node.Args, param)
	}

	// expect delimiter or close
	t.scanner.accept = acceptColon
	t.scanner.mode = scanIdent | scanRbrack
	switch t.scanner.scan() {
	case tokenRbrack:
		return node, nil
	case tokenIdent:
		// no-op
	default:
		return nil, ErrBadSubstitution
	}

	// scan arg[2]
	{
		param, err := t.parseParam(acceptNotClosing, scanIdent)
		if err != nil {
			return nil, err
		}
		node.Args = append(node.Args, param)
	}

	return node, t.consumeRbrack()
}
869225
func Doer(client *http.Client, config Config) httpcli.Doer {
	return httpcli.DoerFunc(func(req *http.Request) (*http.Response, error) {
		// TODO if we still have a valid token, try using it first
		token := jwt.New(jwt.SigningMethodRS256)
		token.Claims["uid"] = config.ID
		token.Claims["exp"] = time.Now().Add(time.Hour).Unix()
		// SignedString will treat secret as PEM-encoded key
		tokenStr, err := token.SignedString([]byte(config.PrivateKey))
		if err != nil {
			return nil, err
		}

		authReq := struct {
			UID   string `json:"uid"`
			Token string `json:"token,omitempty"`
		}{
			UID:   config.ID,
			Token: tokenStr,
		}

		b, err := json.Marshal(authReq)
		if err != nil {
			return nil, err
		}

		authBody := bytes.NewBuffer(b)
		resp, err := client.Post(config.LoginEndpoint, "application/json", authBody)
		if err != nil {
			return nil, err
		}
		defer errorutil.Ignore(resp.Body.Close)
		if resp.StatusCode != 200 {
			return nil, httpcli.ErrAuthFailed
		}

		var authResp struct {
			Token string `json:"token"`
		}
		err = json.NewDecoder(resp.Body).Decode(&authResp)
		if err != nil {
			return nil, err
		}

		if req.Header == nil {
			req.Header = make(http.Header)
		}
		req.Header.Set("Authorization", "token="+authResp.Token)

		return client.Do(req)
	})
}
999450
func (ra *RemoteAddr) HandlerFunc(w http.ResponseWriter, r *http.Request) {
	ra.handleActualRequest(w, r)
}
1089446
func (c *Corpus) IDFreq(id int) int {
	size := atomic.LoadInt64(&c.maxid)
	maxid := int(size)

	if id >= maxid {
		return 0
	}
	return c.frequencies[id]
}
825875
func FileHandlerFunc(filePath string) func(http.ResponseWriter, *http.Request) {
	return func(responseWriter http.ResponseWriter, request *http.Request) {
		http.ServeFile(responseWriter, request, filePath)
	}
}
336392
func (pcond *ReqProxyConds) DoFunc(f func(req *http.Request, ctx *ProxyCtx) (*http.Request, *http.Response)) {
	pcond.Do(FuncReqHandler(f))
}