// Setup should be called before starting input
774274
func (t *PosixParser) Setup() error {
	// Set NonBlocking mode because if syscall.Read block this goroutine, it cannot receive data from stopCh.
	if err := syscall.SetNonblock(t.fd, true); err != nil {
		return err
	}
	if err := term.SetRaw(t.fd); err != nil {
		return err
	}
	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
}
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
}
1339525
func (n *natsStreamingRequester) Setup() error {
	conn, err := stan.Connect("test-cluster", fmt.Sprintf("%s-%d", n.clientID, time.Now().UnixNano()), stan.NatsURL(n.url))
	if err != nil {
		return err
	}
	n.msgChan = make(chan []byte)
	sub, err := conn.Subscribe(n.subject, func(msg *stan.Msg) {
		n.msgChan <- msg.Data
	})
	if err != nil {
		conn.Close()
		return err
	}
	n.conn = conn
	n.sub = sub
	n.msg = make([]byte, n.payloadSize)
	for i := 0; i < n.payloadSize; i++ {
		n.msg[i] = 'A' + uint8(rand.Intn(26))
	}
	return nil
}
771138
func (n *nsqRequester) Setup() error {
	config := nsq.NewConfig()
	producer, err := nsq.NewProducer(n.url, config)
	if err != nil {
		return err
	}
	consumer, err := nsq.NewConsumer(n.topic, n.channel, config)
	if err != nil {
		return err
	}
	n.msgChan = make(chan []byte)
	consumer.AddConcurrentHandlers(nsq.HandlerFunc(func(m *nsq.Message) error {
		m.Finish()
		n.msgChan <- m.Body
		return nil
	}), 1)
	if err := consumer.ConnectToNSQD(n.url); err != nil {
		producer.Stop()
		return err
	}
	n.producer = producer
	n.consumer = consumer
	n.msg = make([]byte, n.payloadSize)
	for i := 0; i < n.payloadSize; i++ {
		n.msg[i] = 'A' + uint8(rand.Intn(26))
	}
	return nil
}
574480
func (s *Skein) setup(stateSize, outputSize int) {
	s.cipherStateWords = stateSize / 64

	s.hashSize = outputSize
	s.outputBytes = (outputSize + 7) / 8

	// Figure out which cipher we need based on
	// the state size
	s.cipher, _ = threefish.NewSize(stateSize)

	// Allocate buffers
	s.inputBuffer = make([]byte, s.cipherStateWords*8)
	s.cipherInput = make([]uint64, s.cipherStateWords)
	s.state = make([]uint64, s.cipherStateWords)

	// Allocate tweak
	s.ubiParameters = newUbiTweak()
}
863072
func setup(c *caddy.Controller) error {
	rules, err := parsePushRules(c)

	if err != nil {
		return err
	}

	cfg := httpserver.GetConfig(c)
	cfg.AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		return Middleware{Next: next, Rules: rules, Root: http.Dir(cfg.Root), indexPages: cfg.IndexPages}
	})

	return nil
}
92966
func (term *Terminal) setup(buf *Buffer, in io.Reader) (*bufio.Reader, error) {
	cols, _, err := TerminalSize(buf.Out)
	if err != nil {
		return nil, err
	}

	buf.Cols = cols
	input := bufio.NewReader(in)

	err = buf.Refresh()
	if err != nil {
		return nil, err
	}

	return input, nil
}
405940
func (o *OrganizerModern) Setup(f func()) {
	o.setup = append(o.setup, f)
}
490770
func setup(c *caddy.Controller) error {
	ctx := log.LoggerNewContext(context.Background())

	apiAAA, err := buildApiAAAHandler(ctx)

	if err != nil {
		return err
	}

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

	return nil
}
741109
func (consumer *Consumer) Setup(sarama.ConsumerGroupSession) error {
	// Mark the consumer as ready
	close(consumer.ready)
	return nil
}
373421
func (p *paginationDefinitions) setup() {
	for n, e := range p.Pagination {
		if e.InputTokens == nil || e.OutputTokens == nil {
			continue
		}
		paginator := e

		switch t := paginator.InputTokens.(type) {
		case string:
			paginator.InputTokens = []string{t}
		case []interface{}:
			toks := []string{}
			for _, e := range t {
				s := e.(string)
				toks = append(toks, s)
			}
			paginator.InputTokens = toks
		}
		switch t := paginator.OutputTokens.(type) {
		case string:
			paginator.OutputTokens = []string{t}
		case []interface{}:
			toks := []string{}
			for _, e := range t {
				s := e.(string)
				toks = append(toks, s)
			}
			paginator.OutputTokens = toks
		}

		if o, ok := p.Operations[n]; ok {
			o.Paginator = &paginator
		} else {
			panic("unknown operation for paginator " + n)
		}
	}
}
476412
func setup(c *caddy.Controller) error {
	rules, err := headersParse(c)
	if err != nil {
		return err
	}

	httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		return Headers{Next: next, Rules: rules}
	})

	return nil
}
1056188
func (ed *emptyDir) SetUp(fsGroup *int64) error {
	return ed.SetUpAt(ed.GetPath(), fsGroup)
}
1311758
func (m *FileSource) Setup(ss *schema.Schema) error {
	m.ss = ss
	if err := m.init(); err != nil {
		return err
	}
	if m.lastLoad.Before(time.Now().Add(-schemaRefreshInterval)) {
		m.lastLoad = time.Now()
	}
	m.partitionCt = uint64(m.ss.Conf.PartitionCt)

	m.partitionFunc = SipPartitioner
	return nil
}
197015
func setup(c *caddy.Controller) error {
	configs, err := gzipParse(c)
	if err != nil {
		return err
	}

	httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		return Gzip{Next: next, Configs: configs}
	})

	return nil
}
854441
func (b *awsElasticBlockStoreMounter) SetUp(fsGroup *int64) error {
	return b.SetUpAt(b.GetPath(), fsGroup)
}