// nolint: gocyclo
172646
func prettyPrintServerInfo(dockerCli command.Cli, info types.Info) []error {
	var errs []error

	fmt.Fprintln(dockerCli.Out(), " Containers:", info.Containers)
	fmt.Fprintln(dockerCli.Out(), "  Running:", info.ContainersRunning)
	fmt.Fprintln(dockerCli.Out(), "  Paused:", info.ContainersPaused)
	fmt.Fprintln(dockerCli.Out(), "  Stopped:", info.ContainersStopped)
	fmt.Fprintln(dockerCli.Out(), " Images:", info.Images)
	fprintlnNonEmpty(dockerCli.Out(), " Server Version:", info.ServerVersion)
	fprintlnNonEmpty(dockerCli.Out(), " Storage Driver:", info.Driver)
	if info.DriverStatus != nil {
		for _, pair := range info.DriverStatus {
			fmt.Fprintf(dockerCli.Out(), "  %s: %s\n", pair[0], pair[1])
		}
	}
	if info.SystemStatus != nil {
		for _, pair := range info.SystemStatus {
			fmt.Fprintf(dockerCli.Out(), " %s: %s\n", pair[0], pair[1])
		}
	}
	fprintlnNonEmpty(dockerCli.Out(), " Logging Driver:", info.LoggingDriver)
	fprintlnNonEmpty(dockerCli.Out(), " Cgroup Driver:", info.CgroupDriver)

	fmt.Fprintln(dockerCli.Out(), " Plugins:")
	fmt.Fprintln(dockerCli.Out(), "  Volume:", strings.Join(info.Plugins.Volume, " "))
	fmt.Fprintln(dockerCli.Out(), "  Network:", strings.Join(info.Plugins.Network, " "))

	if len(info.Plugins.Authorization) != 0 {
		fmt.Fprintln(dockerCli.Out(), "  Authorization:", strings.Join(info.Plugins.Authorization, " "))
	}

	fmt.Fprintln(dockerCli.Out(), "  Log:", strings.Join(info.Plugins.Log, " "))

	fmt.Fprintln(dockerCli.Out(), " Swarm:", info.Swarm.LocalNodeState)
	printSwarmInfo(dockerCli, info)

	if len(info.Runtimes) > 0 {
		fmt.Fprint(dockerCli.Out(), " Runtimes:")
		for name := range info.Runtimes {
			fmt.Fprintf(dockerCli.Out(), " %s", name)
		}
		fmt.Fprint(dockerCli.Out(), "\n")
		fmt.Fprintln(dockerCli.Out(), " Default Runtime:", info.DefaultRuntime)
	}

	if info.OSType == "linux" {
		fmt.Fprintln(dockerCli.Out(), " Init Binary:", info.InitBinary)

		for _, ci := range []struct {
			Name   string
			Commit types.Commit
		}{
			{"containerd", info.ContainerdCommit},
			{"runc", info.RuncCommit},
			{"init", info.InitCommit},
		} {
			fmt.Fprintf(dockerCli.Out(), " %s version: %s", ci.Name, ci.Commit.ID)
			if ci.Commit.ID != ci.Commit.Expected {
				fmt.Fprintf(dockerCli.Out(), " (expected: %s)", ci.Commit.Expected)
			}
			fmt.Fprint(dockerCli.Out(), "\n")
		}
		if len(info.SecurityOptions) != 0 {
			if kvs, err := types.DecodeSecurityOptions(info.SecurityOptions); err != nil {
				errs = append(errs, err)
			} else {
				fmt.Fprintln(dockerCli.Out(), " Security Options:")
				for _, so := range kvs {
					fmt.Fprintln(dockerCli.Out(), "  "+so.Name)
					for _, o := range so.Options {
						switch o.Key {
						case "profile":
							if o.Value != "default" {
								fmt.Fprintln(dockerCli.Err(), "  WARNING: You're not using the default seccomp profile")
							}
							fmt.Fprintln(dockerCli.Out(), "   Profile:", o.Value)
						}
					}
				}
			}
		}
	}

	// Isolation only has meaning on a Windows daemon.
	if info.OSType == "windows" {
		fmt.Fprintln(dockerCli.Out(), " Default Isolation:", info.Isolation)
	}

	fprintlnNonEmpty(dockerCli.Out(), " Kernel Version:", info.KernelVersion)
	fprintlnNonEmpty(dockerCli.Out(), " Operating System:", info.OperatingSystem)
	fprintlnNonEmpty(dockerCli.Out(), " OSType:", info.OSType)
	fprintlnNonEmpty(dockerCli.Out(), " Architecture:", info.Architecture)
	fmt.Fprintln(dockerCli.Out(), " CPUs:", info.NCPU)
	fmt.Fprintln(dockerCli.Out(), " Total Memory:", units.BytesSize(float64(info.MemTotal)))
	fprintlnNonEmpty(dockerCli.Out(), " Name:", info.Name)
	fprintlnNonEmpty(dockerCli.Out(), " ID:", info.ID)
	fmt.Fprintln(dockerCli.Out(), " Docker Root Dir:", info.DockerRootDir)
	fmt.Fprintln(dockerCli.Out(), " Debug Mode:", info.Debug)

	if info.Debug {
		fmt.Fprintln(dockerCli.Out(), "  File Descriptors:", info.NFd)
		fmt.Fprintln(dockerCli.Out(), "  Goroutines:", info.NGoroutines)
		fmt.Fprintln(dockerCli.Out(), "  System Time:", info.SystemTime)
		fmt.Fprintln(dockerCli.Out(), "  EventsListeners:", info.NEventsListener)
	}

	fprintlnNonEmpty(dockerCli.Out(), " HTTP Proxy:", info.HTTPProxy)
	fprintlnNonEmpty(dockerCli.Out(), " HTTPS Proxy:", info.HTTPSProxy)
	fprintlnNonEmpty(dockerCli.Out(), " No Proxy:", info.NoProxy)

	if info.IndexServerAddress != "" {
		u := dockerCli.ConfigFile().AuthConfigs[info.IndexServerAddress].Username
		if len(u) > 0 {
			fmt.Fprintln(dockerCli.Out(), " Username:", u)
		}
		fmt.Fprintln(dockerCli.Out(), " Registry:", info.IndexServerAddress)
	}

	if info.Labels != nil {
		fmt.Fprintln(dockerCli.Out(), " Labels:")
		for _, lbl := range info.Labels {
			fmt.Fprintln(dockerCli.Out(), "  "+lbl)
		}
	}

	fmt.Fprintln(dockerCli.Out(), " Experimental:", info.ExperimentalBuild)
	fprintlnNonEmpty(dockerCli.Out(), " Cluster Store:", info.ClusterStore)
	fprintlnNonEmpty(dockerCli.Out(), " Cluster Advertise:", info.ClusterAdvertise)

	if info.RegistryConfig != nil && (len(info.RegistryConfig.InsecureRegistryCIDRs) > 0 || len(info.RegistryConfig.IndexConfigs) > 0) {
		fmt.Fprintln(dockerCli.Out(), " Insecure Registries:")
		for _, registry := range info.RegistryConfig.IndexConfigs {
			if !registry.Secure {
				fmt.Fprintln(dockerCli.Out(), "  "+registry.Name)
			}
		}

		for _, registry := range info.RegistryConfig.InsecureRegistryCIDRs {
			mask, _ := registry.Mask.Size()
			fmt.Fprintf(dockerCli.Out(), "  %s/%d\n", registry.IP.String(), mask)
		}
	}

	if info.RegistryConfig != nil && len(info.RegistryConfig.Mirrors) > 0 {
		fmt.Fprintln(dockerCli.Out(), " Registry Mirrors:")
		for _, mirror := range info.RegistryConfig.Mirrors {
			fmt.Fprintln(dockerCli.Out(), "  "+mirror)
		}
	}

	fmt.Fprintln(dockerCli.Out(), " Live Restore Enabled:", info.LiveRestoreEnabled)
	if info.ProductLicense != "" {
		fmt.Fprintln(dockerCli.Out(), " Product License:", info.ProductLicense)
	}
	fmt.Fprint(dockerCli.Out(), "\n")

	printServerWarnings(dockerCli, info)
	return errs
}
1373183
func main() {
	statikFS, err := fs.New()
	if err != nil {
		log.Fatal(err)
	}

	http.Handle("/public/", http.StripPrefix("/public/", http.FileServer(statikFS)))
	http.ListenAndServe(":8080", nil)
}
255543
func PanicFunc(err error, f fn, message string, args ...interface{}) {
	if err != nil {
		f()
		logger.Printf(message+"\n", args...)
		panic(err)
	}
}
219129
func Cycle(i int, arg0 string, args ...string) string {
	if j := i % (len(args) + 1); j != 0 {
		return args[j-1]
	}
	return arg0
}
685045
func (grm *goRoutineMap) nothingPending() bool {
	nothingIsPending := true
	for _, operation := range grm.operations {
		if operation.operationPending {
			nothingIsPending = false
			break
		}
	}
	return nothingIsPending
}
1095454
func (m *mater) Go(g1, g2 *IGenome) (IGenome, IGenome) {

	newG1 := NewGenome(*(*g1).GetBits())
	newG2 := NewGenome(*(*g2).GetBits())
	for _, config := range m.materConfig {
		if rand.Float32() < config.P {
			if config.UseElite {
				newG1, newG2 = config.F(&newG1, m.elite)
			} else {
				newG1, newG2 = config.F(&newG1, &newG2)
			}
		}
	}

	return newG1, newG2
}
819710
func (g *group) Go(f func()) {
	g.wg.Add(1)
	go func() {
		defer g.wg.Done()
		f()
	}()
}
876056
func main() {
	CheckArgs("<url>")
	url := os.Args[1]

	// Create a custom http(s) client with your config
	customClient := &http.Client{
		// accept any certificate (might be useful for testing)
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		},

		// 15 second timeout
		Timeout: 15 * time.Second,

		// don't follow redirect
		CheckRedirect: func(req *http.Request, via []*http.Request) error {
			return http.ErrUseLastResponse
		},
	}

	// Override http(s) default protocol to use our custom client
	client.InstallProtocol("https", githttp.NewClient(customClient))

	// Clone repository using the new client if the protocol is https://
	Info("git clone %s", url)

	r, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{URL: url})
	CheckIfError(err)

	// Retrieve the branch pointed by HEAD
	Info("git rev-parse HEAD")

	head, err := r.Head()
	CheckIfError(err)
	fmt.Println(head.Hash())
}
1166831
func gocairoWriteFunc(key C.int, data unsafe.Pointer, clength C.uint) bool {
	writeClosure := goPointers.get(key).(writeClosure)
	length := uint(clength)
	slice := ((*[1 << 30]byte)(data))[:length:length]
	_, writeClosure.err = writeClosure.w.Write(slice)
	return writeClosure.err == nil
}
824267
func (l *Slog) GoPanic(r interface{}, stack []byte, cont bool) {
	var msg string
	l = l.copy()
	l.Log.di(fnLevelDi)
	switch v := r.(type) {
	case string:
		msg = v + "\n"
	case fmt.Stringer:
		msg = v.String() + "\n"
	default:
		msg = fmt.Sprintln(r)
	}
	l.Log.Message(msg + "\n{" + string(stack) + "}")
	l.Log.Priority = PanicPrio
	l.commit()
	if !cont {
		l.Writter.Close()
		l.Exiter(1)
	}
}
465392
func (c *Callbacks) OnCMsgDOTACombatLogEntry(fn func(*dota.CMsgDOTACombatLogEntry) error) {
	c.onCMsgDOTACombatLogEntry = append(c.onCMsgDOTACombatLogEntry, fn)
}
905145
func (c *Callbacks) OnCMsgClearDecalsForSkeletonInstanceEvent(fn func(*dota.CMsgClearDecalsForSkeletonInstanceEvent) error) {
	c.onCMsgClearDecalsForSkeletonInstanceEvent = append(c.onCMsgClearDecalsForSkeletonInstanceEvent, fn)
}
397101
func (db *baseDB) RunInTransaction(fn func(*Tx) error) error {
	tx, err := db.Begin()
	if err != nil {
		return err
	}
	return tx.RunInTransaction(fn)
}
1286521
func main() {
	flag.Parse()

	key := os.Getenv("BFX_API_KEY")
	secret := os.Getenv("BFX_API_SECRET")
	c := rest.NewClientWithURL(*api).Credentials(key, secret)

	available, err := c.Platform.Status()
	if err != nil {
		log.Fatalf("getting status: %s", err)
	}

	if !available {
		log.Fatalf("API not available")
	}

	if *orderid != "" {
		ordid, err := strconv.ParseInt(*orderid, 10, 64)
		if err != nil {
			log.Fatal(err)
		}
		os, err := c.Orders.OrderTrades(bitfinex.TradingPrefix+bitfinex.BTCUSD, ordid)
		if err != nil {
			log.Fatalf("getting order trades: %s", err)
		}

		log.Printf("order trades: %#v\n", os)
	} else {
		os, err := c.Orders.History(bitfinex.TradingPrefix + bitfinex.BTCUSD)
		if err != nil {
			log.Fatalf("getting orders: %s", err)
		}

		log.Printf("orders: %#v\n", os)
	}
}
855419
func main() {
	if len(os.Args) != 4 {
		fmt.Fprintf(os.Stderr, "expected 3 arguments, got %d\n", len(os.Args)-1)
		exit.Exit(1)
	}

	// No error checking here, it's a contrived example after all.
	a, _ := strconv.Atoi(os.Args[2])
	b, _ := strconv.Atoi(os.Args[3])

	var op func(int, int) int
	switch os.Args[1] {
	case "add":
		op = add
	case "sub":
		op = sub
	default:
		fmt.Fprintf(os.Stderr, "unknown operation: %s\n", os.Args[1])
		exit.Exit(1)
	}

	fmt.Println(op(a, b))
}
1095767
func main() {
	defer gock.Off()

	gock.New("http://httpbin.org").
		Get("/*").
		Reply(204).
		SetHeader("Server", "gock")

	cli := gentleman.New()

	cli.UseHandler("before dial", func(ctx *context.Context, h context.Handler) {
		gock.InterceptClient(ctx.Client)
		h.Next(ctx)
	})

	res, err := cli.Request().URL("http://httpbin.org/get").Send()
	if err != nil {
		fmt.Errorf("Error: %s", err)
	}

	fmt.Printf("Status: %d\n", res.StatusCode)
	fmt.Printf("Server header: %s\n", res.Header.Get("Server"))
}
15826
func (d *DRV2605LDriver) Go() (err error) {
	err = d.connection.WriteByteData(drv2605RegGo, 1)
	return err
}