// setup returns a new instance of a pprof handler. It accepts no arguments or options.
962862
func setup(c *caddy.Controller) error {
	found := false

	for c.Next() {
		if found {
			return c.Err("pprof can only be specified once")
		}
		if len(c.RemainingArgs()) != 0 {
			return c.ArgErr()
		}
		if c.NextBlock() {
			return c.ArgErr()
		}
		found = true
	}

	httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		return &Handler{Next: next, Mux: NewMux()}
	})

	return nil
}
869285
func setup(c *caddy.Controller) error {
	handler, err := errorsParse(c)

	if err != nil {
		return err
	}

	handler.Log.Attach(c)

	httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		handler.Next = next
		return handler
	})

	return nil
}
11868
func (r *redisRequester) Setup() error {
	conn, err := redis.Dial("tcp", r.url)
	if err != nil {
		return err
	}
	r.conn = conn
	return nil
}
67889
func (f *flexVolumeMounter) SetUp(fsGroup *int64) error {
	return f.SetUpAt(f.GetPath(), fsGroup)
}
699026
func setup(c *caddy.Controller) error {
	paths, err := internalParse(c)
	if err != nil {
		return err
	}

	// Append Internal paths to Caddy config HiddenFiles to ensure
	// files do not appear in Browse
	config := httpserver.GetConfig(c)
	config.HiddenFiles = append(config.HiddenFiles, paths...)

	config.AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		return Internal{Next: next, Paths: paths}
	})

	return nil
}
181519
func setup(c *caddy.Controller) error {
	resource, err := expVarParse(c)
	if err != nil {
		return err
	}

	// publish any extra information/metrics we may want to capture
	publishExtraVars()

	ev := ExpVar{Resource: resource}

	httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		ev.Next = next
		return ev
	})

	return nil
}
1207127
func Setup() error {
	//ensure the modules are loaded
	cmd := exec.Command(modprobeCmd, w1gpioMod)
	if err := cmd.Run(); err != nil {
		return err
	}
	cmd = exec.Command(modprobeCmd, w1thermMod)
	if err := cmd.Run(); err != nil {
		return err
	}

	//check that the 1 wire master device is present
	fis, err := ioutil.ReadDir(basePath)
	if err != nil {
		return err
	}
	masterPresent := false
	for i := range fis {
		if strings.HasPrefix(fis[i].Name(), masterPrefix) {
			masterPresent = true
			break
		}
	}
	if !masterPresent {
		return errNoBus
	}
	//good to go
	return nil
}
1352391
func (r *redisPubSubRequester) Setup() error {
	pubConn, err := redis.Dial("tcp", r.url)
	if err != nil {
		return err
	}
	subConn, err := redis.Dial("tcp", r.url)
	if err != nil {
		return err
	}
	subscribeConn := &redis.PubSubConn{subConn}
	if err := subscribeConn.Subscribe(r.channel); err != nil {
		subscribeConn.Close()
		return err
	}
	// Receive subscription message.
	switch recv := subscribeConn.Receive().(type) {
	case error:
		return recv
	}
	r.publishConn = pubConn
	r.subscribeConn = subscribeConn
	r.msg = string(make([]byte, r.payloadSize))
	return nil
}
1077834
func Setup(conf config.Config) error {
	downlinkLockDuration = conf.NetworkServer.Scheduler.ClassC.DownlinkLockDuration
	schedulerInterval = conf.NetworkServer.Scheduler.SchedulerInterval
	installationMargin = conf.NetworkServer.NetworkSettings.InstallationMargin
	downlinkTXPower = conf.NetworkServer.NetworkSettings.DownlinkTXPower

	return nil
}
928862
func (p *WindowsParser) Setup() error {
	t, err := tty.Open()
	if err != nil {
		return err
	}
	p.tty = t
	return nil
}
51816
func (mgr *mspManagerImpl) Setup(msps []MSP) error {
	if mgr.up {
		mspLogger.Infof("MSP manager already up")
		return nil
	}

	mspLogger.Debugf("Setting up the MSP manager (%d msps)", len(msps))

	// create the map that assigns MSP IDs to their manager instance - once
	mgr.mspsMap = make(map[string]MSP)

	// create the map that sorts MSPs by their provider types
	mgr.mspsByProviders = make(map[ProviderType][]MSP)

	for _, msp := range msps {
		// add the MSP to the map of active MSPs
		mspID, err := msp.GetIdentifier()
		if err != nil {
			return errors.WithMessage(err, "could not extract msp identifier")
		}
		mgr.mspsMap[mspID] = msp
		providerType := msp.GetType()
		mgr.mspsByProviders[providerType] = append(mgr.mspsByProviders[providerType], msp)
	}

	mgr.up = true

	mspLogger.Debugf("MSP manager setup complete, setup %d msps", len(msps))

	return nil
}
36939
func (a *API) Setup() {
	a.setServiceAliaseName()
	a.setMetadataEndpointsKey()
	a.writeShapeNames()
	a.resolveReferences()

	if !a.NoRemoveUnusedShapes {
		a.removeUnusedShapes()
	}

	a.fixStutterNames()
	a.renameExportable()
	a.applyShapeNameAliases()
	a.createInputOutputShapes()
	a.renameAPIPayloadShapes()
	a.renameCollidingFields()
	a.updateTopLevelShapeReferences()
	a.setupEventStreams()
	a.findEndpointDiscoveryOp()
	a.customizationPasses()

	if !a.NoRemoveUnusedShapes {
		a.removeUnusedShapes()
	}

	if !a.NoValidataShapeMethods {
		a.addShapeValidations()
	}

	a.initialized = true
}
752985
func (msp *bccspmsp) Setup(conf1 *m.MSPConfig) error {
	if conf1 == nil {
		return errors.New("Setup error: nil conf reference")
	}

	// given that it's an msp of type fabric, extract the MSPConfig instance
	conf := &m.FabricMSPConfig{}
	err := proto.Unmarshal(conf1.Config, conf)
	if err != nil {
		return errors.Wrap(err, "failed unmarshalling fabric msp config")
	}

	// set the name for this msp
	msp.name = conf.Name
	mspLogger.Debugf("Setting up MSP instance %s", msp.name)

	// setup
	return msp.internalSetupFunc(conf)
}
381482
func setup(c *caddy.Controller) error {
	httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		return PoolHandler{Next: next, refreshLauncher: &sync.Once{}}
	})

	return nil
}
488360
func (t *Tools) Setup() {
	var gocmd string
	if t.vgo {
		gocmd = "vgo"
	} else {
		gocmd = "go"
	}

	// go clean
	if t.Clean.Status {
		t.Clean.name = "Clean"
		t.Clean.isTool = true
		t.Clean.cmd = replace([]string{gocmd, "clean"}, t.Clean.Method)
		t.Clean.Args = split([]string{}, t.Clean.Args)
	}
	// go generate
	if t.Generate.Status {
		t.Generate.dir = true
		t.Generate.isTool = true
		t.Generate.name = "Generate"
		t.Generate.cmd = replace([]string{gocmd, "generate"}, t.Generate.Method)
		t.Generate.Args = split([]string{}, t.Generate.Args)
	}
	// go fmt
	if t.Fmt.Status {
		if len(t.Fmt.Args) == 0 {
			t.Fmt.Args = []string{"-s", "-w", "-e"}
		}
		t.Fmt.name = "Fmt"
		t.Fmt.isTool = true
		t.Fmt.cmd = replace([]string{"gofmt"}, t.Fmt.Method)
		t.Fmt.Args = split([]string{}, t.Fmt.Args)
	}
	// go vet
	if t.Vet.Status {
		t.Vet.dir = true
		t.Vet.name = "Vet"
		t.Vet.isTool = true
		t.Vet.cmd = replace([]string{gocmd, "vet"}, t.Vet.Method)
		t.Vet.Args = split([]string{}, t.Vet.Args)
	}
	// go test
	if t.Test.Status {
		t.Test.dir = true
		t.Test.isTool = true
		t.Test.name = "Test"
		t.Test.cmd = replace([]string{gocmd, "test"}, t.Test.Method)
		t.Test.Args = split([]string{}, t.Test.Args)
	}
	// go install
	t.Install.name = "Install"
	t.Install.cmd = replace([]string{gocmd, "install"}, t.Install.Method)
	t.Install.Args = split([]string{}, t.Install.Args)
	// go build
	if t.Build.Status {
		t.Build.name = "Build"
		t.Build.cmd = replace([]string{gocmd, "build"}, t.Build.Method)
		t.Build.Args = split([]string{}, t.Build.Args)
	}
}
685849
func Setup(opts r.ConnectOpts) error {
	// Initialize a new setup connection
	ss, err := r.Connect(opts)
	if err != nil {
		return err
	}

	// Create databases
	for _, d := range databaseNames {
		r.DBCreate(d).Exec(ss)

		r.DB(d).TableCreate("accounts").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("name").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("alt_email").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("type").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("status").Exec(ss)

		r.DB(d).TableCreate("addresses").Exec(ss)
		r.DB(d).Table("addresses").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("addresses").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("addresses").IndexCreate("date_modified").Exec(ss)

		r.DB(d).TableCreate("contacts").Exec(ss)
		r.DB(d).Table("contacts").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("contacts").IndexCreate("name").Exec(ss)
		r.DB(d).Table("contacts").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("contacts").IndexCreate("date_modified").Exec(ss)

		r.DB(d).TableCreate("emails").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("thread").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("kind").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("from").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("message_id").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("to", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("emails").IndexCreate("cc", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("emails").IndexCreate("bcc", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("emails").IndexCreateFunc("messageIDOwner", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("message_id"),
				row.Field("owner"),
			}
		}).Exec(ss)
		r.DB(d).Table("emails").IndexCreateFunc("threadStatus", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("thread"),
				row.Field("status"),
			}
		}).Exec(ss)

		r.DB(d).TableCreate("files").Exec(ss)
		r.DB(d).Table("files").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("files").IndexCreate("name").Exec(ss)
		r.DB(d).Table("files").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("files").IndexCreate("date_modified").Exec(ss)

		r.DB(d).TableCreate("keys").Exec(ss)
		r.DB(d).Table("keys").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("keys").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("keys").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("keys").IndexCreate("key_id").Exec(ss)

		r.DB(d).TableCreate("labels").Exec(ss)
		r.DB(d).Table("labels").IndexCreate("name").Exec(ss)
		r.DB(d).Table("labels").IndexCreate("builtin").Exec(ss)
		r.DB(d).Table("labels").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("labels").IndexCreateFunc("nameOwnerBuiltin", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("name"),
				row.Field("owner"),
				row.Field("builtin"),
			}
		}).Exec(ss)

		r.DB(d).TableCreate("threads").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("name").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("emails", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("threads").IndexCreate("labels", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("threads").IndexCreate("members", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("threads").IndexCreate("subject_hash").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("secure").Exec(ss)
		r.DB(d).Table("threads").IndexCreateFunc("subjectOwner", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("subject_hash"),
				row.Field("owner"),
			}
		}).Exec(ss)

		r.DB(d).TableCreate("tokens").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("name").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("type").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("expiry_date").Exec(ss)

		r.DB(d).TableCreate("webhooks").Exec(ss)
		r.DB(d).Table("webhooks").IndexCreate("target").Exec(ss)
		r.DB(d).Table("webhooks").IndexCreate("type").Exec(ss)
		r.DB(d).Table("webhooks").IndexCreateFunc("targetType", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("target"),
				row.Field("type"),
			}
		}).Exec(ss)
	}

	return ss.Close()
}
984255
func setup(ctx *cli.Context) (err error) {
	setting.Debug = ctx.GlobalBool("debug")
	log.NonColor = ctx.GlobalBool("noterm")
	log.Verbose = ctx.Bool("verbose")

	log.Info("App Version: %s", ctx.App.Version)

	setting.HomeDir, err = base.HomeDir()
	if err != nil {
		return fmt.Errorf("Fail to get home directory: %v", err)
	}
	setting.HomeDir = strings.Replace(setting.HomeDir, "\\", "/", -1)

	setting.InstallRepoPath = path.Join(setting.HomeDir, ".gopm/repos")
	if runtime.GOOS == "windows" {
		setting.IsWindows = true
	}
	os.MkdirAll(setting.InstallRepoPath, os.ModePerm)
	log.Info("Local repository path: %s", setting.InstallRepoPath)

	if !setting.LibraryMode || len(setting.WorkDir) == 0 {
		setting.WorkDir, err = os.Getwd()
		if err != nil {
			return fmt.Errorf("Fail to get work directory: %v", err)
		}
		setting.WorkDir = strings.Replace(setting.WorkDir, "\\", "/", -1)
	}
	setting.DefaultGopmfile = path.Join(setting.WorkDir, setting.GOPMFILE)
	setting.DefaultVendor = path.Join(setting.WorkDir, setting.VENDOR)
	setting.DefaultVendorSrc = path.Join(setting.DefaultVendor, "src")

	if !ctx.Bool("remote") {
		if ctx.Bool("local") {
			// gf, _, _, err := genGopmfile(ctx)
			// if err != nil {
			// 	return err
			// }
			// setting.InstallGopath = gf.MustValue("project", "local_gopath")
			// if ctx.Command.Name != "gen" {
			// 	if com.IsDir(setting.InstallGopath) {
			// 		log.Log("Indicated local GOPATH: %s", setting.InstallGopath)
			// 		setting.InstallGopath += "/src"
			// 	} else {
			// 		if setting.LibraryMode {
			// 			return fmt.Errorf("Local GOPATH does not exist or is not a directory: %s",
			// 				setting.InstallGopath)
			// 		}
			// 		log.Error("", "Invalid local GOPATH path")
			// 		log.Error("", "Local GOPATH does not exist or is not a directory:")
			// 		log.Error("", "\t"+setting.InstallGopath)
			// 		log.Help("Try 'go help gopath' to get more information")
			// 	}
			// }

		} else {
			// Get GOPATH.
			setting.InstallGopath = base.GetGOPATHs()[0]
			if base.IsDir(setting.InstallGopath) {
				log.Info("Indicated GOPATH: %s", setting.InstallGopath)
				setting.InstallGopath += "/src"
				setting.HasGOPATHSetting = true
			} else {
				if ctx.Bool("gopath") {
					return fmt.Errorf("Local GOPATH does not exist or is not a directory: %s",
						setting.InstallGopath)
				} else {
					// It's OK that no GOPATH setting
					// when user does not specify to use.
					log.Warn("No GOPATH setting available")
				}
			}
		}
	}

	setting.ConfigFile = path.Join(setting.HomeDir, ".gopm/data/gopm.ini")
	if err = setting.LoadConfig(); err != nil {
		return err
	}

	setting.PkgNameListFile = path.Join(setting.HomeDir, ".gopm/data/pkgname.list")
	if err = setting.LoadPkgNameList(); err != nil {
		return err
	}

	setting.LocalNodesFile = path.Join(setting.HomeDir, ".gopm/data/localnodes.list")
	if err = setting.LoadLocalNodes(); err != nil {
		return err
	}
	return nil
}