//=============================================================================
183227
func (g *GpgCLI) Index(secret bool, query string) (ki *GpgKeyIndex, w Warnings, err error) {
	var k string
	if secret {
		k = "-K"
	} else {
		k = "-k"
	}
	args := []string{"--with-colons", "--fingerprint", k}
	if len(query) > 0 {
		args = append(args, query)
	}
	garg := RunGpg2Arg{
		Arguments: args,
		Stdout:    true,
	}
	res := g.Run2(garg)
	if res.Err != nil {
		err = res.Err
		return
	}
	if ki, w, err = ParseGpgIndexStream(g.G(), res.Stdout); err != nil {
		return
	}
	err = res.Wait()
	return
}
852352
func main() {
	app := iris.New()
	app.Logger().SetLevel("debug")
	app.Get("/", cache.Handler(10*time.Second), writeMarkdown)
	// saves its content on the first request and serves it instead of re-calculating the content.
	// After 10 seconds it will be cleared and resetted.

	app.Run(iris.Addr(":8080"))
}
810969
func (s *VPCService) GetStaticRouteByID(id string, opts ...OptionFunc) (*StaticRoute, int, error) {
	p := &ListStaticRoutesParams{}
	p.p = make(map[string]interface{})

	p.p["id"] = id

	for _, fn := range append(s.cs.options, opts...) {
		if err := fn(s.cs, p); err != nil {
			return nil, -1, err
		}
	}

	l, err := s.ListStaticRoutes(p)
	if err != nil {
		if strings.Contains(err.Error(), fmt.Sprintf(
			"Invalid parameter id value=%s due to incorrect long value format, "+
				"or entity does not exist", id)) {
			return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
		}
		return nil, -1, err
	}

	if l.Count == 0 {
		return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
	}

	if l.Count == 1 {
		return l.StaticRoutes[0], l.Count, nil
	}
	return nil, l.Count, fmt.Errorf("There is more then one result for StaticRoute UUID: %s!", id)
}
96540
func (c *Check) CheckReady(ctx context.Context) Response {
	response := Response{
		Name:   "Ready",
		Status: StatusPass,
		Checks: make(Responses, len(c.readyChecks)),
	}
	for i, c := range c.readyChecks {
		resp := c.Check(ctx)
		if resp.Status != StatusPass {
			response.Status = resp.Status
		}
		response.Checks[i] = resp
	}
	sort.Sort(response.Checks)
	return response
}
302007
func (s *UpdateByQueryService) Refresh(refresh string) *UpdateByQueryService {
	s.refresh = refresh
	return s
}
77144
func main() {
	runtime.GOMAXPROCS(8)
	server := redismq.NewServer("localhost", "6379", "", 9, "9999")
	server.Start()
	testQueue := redismq.CreateBufferedQueue("localhost", "6379", "", 9, "example", 200)
	err := testQueue.Start()
	if err != nil {
		panic(err)
	}
	go write(testQueue)

	go read(testQueue, "1")
	go read(testQueue, "2")
	go read(testQueue, "3")
	go read(testQueue, "4")
	go read(testQueue, "5")
	go read(testQueue, "6")
	go read(testQueue, "7")
	go read(testQueue, "8")

	select {}
}
42158
func (e Error) Error() string {
	if e.error == nil {
		return "<nil>"
	}
	return e.error.Error()
}
581722
func (b *UpdateService) Refresh(refresh string) *UpdateService {
	b.refresh = refresh
	return b
}
732502
func (ListEvents) Each(resp interface{}, callback IterateItemFunc) {
	items, ok := resp.(*ListEventsResponse)
	if !ok {
		callback(nil, fmt.Errorf("wrong type, ListEventsResponse was expected, got %T", resp))
		return
	}

	for i := range items.Event {
		if !callback(&items.Event[i], nil) {
			break
		}
	}
}
923497
func main() {
	request := []string{"Hello world"}
	reply := []string{}
	var err error

	endpoints := len(os.Args) - 1
	if endpoints == 0 {
		fmt.Printf("I: syntax: %s <endpoint> ...\n", os.Args[0])
	} else if endpoints == 1 {
		//  For one endpoint, we retry N times
		for retries := 0; retries < MAX_RETRIES; retries++ {
			endpoint := os.Args[1]
			reply, err = try_request(endpoint, request)
			if err == nil {
				break //  Successful
			}
			fmt.Printf("W: no response from %s, retrying...\n", endpoint)
		}
	} else {
		//  For multiple endpoints, try each at most once
		for endpoint_nbr := 0; endpoint_nbr < endpoints; endpoint_nbr++ {
			endpoint := os.Args[endpoint_nbr+1]
			reply, err = try_request(endpoint, request)
			if err == nil {
				break //  Successful
			}
			fmt.Println("W: no response from", endpoint)
		}
	}
	if len(reply) > 0 {
		fmt.Printf("Service is running OK: %q\n", reply)
	}
}
629933
func (this *Response) Close() {
	if this.Response.Body != nil {
		this.Response.Body.Close()
	}
}
1073740
func main() {
	cmd.RootCmd.DisableAutoGenTag = true
	identity := func(s string) string {
		return fmt.Sprintf(`{{< relref "docs/%s" >}}`, s)
	}
	emptyStr := func(s string) string { return "" }
	doc.GenMarkdownTreeCustom(cmd.RootCmd, "./", emptyStr, identity)
}
1255891
func (ListSecurityGroups) Each(resp interface{}, callback IterateItemFunc) {
	items, ok := resp.(*ListSecurityGroupsResponse)
	if !ok {
		callback(nil, fmt.Errorf("wrong type, ListSecurityGroupsResponse was expected, got %T", resp))
		return
	}

	for i := range items.SecurityGroup {
		if !callback(&items.SecurityGroup[i], nil) {
			break
		}
	}
}
140602
func main() {
	serverID := "abc123"
	var version string
	err := retro.DoWithRetry(func() error {
		var e error
		version, e = getServer(serverID)
		if e != nil {
			return e
		}
		fmt.Printf("Server version %s\n", version)
		return nil
	})
	if err != nil {
		fmt.Printf("FATAL: Failed to get server info %s\n", err.Error())
		os.Exit(1)
	}

	err = retro.DoWithRetry(func() error {
		return useServer(serverID, version)
	})
	if err != nil {
		fmt.Printf("FATAL: Failed to use server %s\n", err.Error())
		os.Exit(1)
	}

}
1320274
func (c RekeyClient) RekeyStatusFinish(ctx context.Context, sessionID int) (res Outcome, err error) {
	__arg := RekeyStatusFinishArg{SessionID: sessionID}
	err = c.Cli.Call(ctx, "keybase.1.rekey.rekeyStatusFinish", []interface{}{__arg}, &res)
	return
}
619116
func (s *ReindexService) WaitForCompletion(waitForCompletion bool) *ReindexService {
	s.waitForCompletion = &waitForCompletion
	return s
}
146697
func main() {
	env, err := plugins.NewEnvironment()
	env.RespondAndExitIfError(err)

	var linter DocumentLinter

	for _, model := range env.Request.Models {
		switch model.TypeUrl {
		case "openapi.v2.Document":
			documentv2 := &openapiv2.Document{}
			err = proto.Unmarshal(model.Value, documentv2)
			if err == nil {
				linter = NewDocumentLinterV2(documentv2)
				env.Response.Messages = linter.Run()
			}
		case "openapi.v3.Document":
			documentv3 := &openapiv3.Document{}
			err = proto.Unmarshal(model.Value, documentv3)
			if err == nil {
				linter = NewDocumentLinterV3(documentv3)
				env.Response.Messages = linter.Run()
			}
		}
	}

	env.RespondAndExit()
}