// args is the binary serializable request body. trailer is optional data
// following it, such as for BEP 41.
343160
func (c *udpAnnounce) request(action Action, args interface{}, options []byte) (*bytes.Buffer, error) {
	tid := newTransactionId()
	if err := errors.Wrap(
		c.write(
			&RequestHeader{
				ConnectionId:  c.connectionId,
				Action:        action,
				TransactionId: tid,
			}, args, options),
		"writing request",
	); err != nil {
		return nil, err
	}
	c.socket.SetReadDeadline(time.Now().Add(timeout(c.contiguousTimeouts)))
	b := make([]byte, 0x800) // 2KiB
	for {
		var (
			n        int
			readErr  error
			readDone = make(chan struct{})
		)
		go func() {
			defer close(readDone)
			n, readErr = c.socket.Read(b)
		}()
		ctx := c.a.Context
		if ctx == nil {
			ctx = context.Background()
		}
		select {
		case <-ctx.Done():
			return nil, ctx.Err()
		case <-readDone:
		}
		if opE, ok := readErr.(*net.OpError); ok && opE.Timeout() {
			c.contiguousTimeouts++
		}
		if readErr != nil {
			return nil, errors.Wrap(readErr, "reading from socket")
		}
		buf := bytes.NewBuffer(b[:n])
		var h ResponseHeader
		err := binary.Read(buf, binary.BigEndian, &h)
		switch err {
		default:
			panic(err)
		case io.ErrUnexpectedEOF, io.EOF:
			continue
		case nil:
		}
		if h.TransactionId != tid {
			continue
		}
		c.contiguousTimeouts = 0
		if h.Action == ActionError {
			err = errors.New(buf.String())
		}
		return buf, err
	}
}
622869
func (m *Master) GrowArgs(args url.Values) error {
	u := url.URL{
		Scheme:   "http",
		Host:     m.Url,
		Path:     "/vol/grow",
		RawQuery: args.Encode(),
	}
	resp, err := http.Get(u.String())
	resp.Body.Close()

	return err
}
498237
func (ag *ArgGroup) ArgString() string {
	args := make([]string, len(ag.grp))
	for i, arg := range ag.grp {
		args[i] = arg.ArgString()
	}
	return strings.Join(args, "|")
}
9285
func ArgsFrom(conf string, positions ...string) ([]string, error) {
	if _, err := os.Stat(conf); err != nil {
		return nil, err
	}
	return parse(conf, positions...)
}
947916
func (a *AskPassCredentialHelper) args(prompt string) []string {
	if len(prompt) == 0 {
		return nil
	}
	return []string{prompt}
}
889356
func (a *Arg) ArgString() string {
	return fmt.Sprintf("%v=%v", encoder.Replace(a.key), encoder.Replace(a.val))
}
1069017
func validateArgs() error {
	if flag.NArg() > 0 {
		return fmt.Errorf("%s does not take parameters (did you mean -input?)", os.Args[0])
	}

	if args.bambooOut && args.xunitnetOut {
		return fmt.Errorf("-bamboo and -xunitnet are mutually exclusive")
	}

	return nil
}
790805
func (p *Ping) args(url string) []string {
	if len(p.Arguments) > 0 {
		return p.Arguments
	}

	args := []string{"-n", strconv.Itoa(p.Count)}

	if p.Timeout > 0 {
		args = append(args, "-w", strconv.FormatFloat(p.Timeout*1000, 'f', 0, 64))
	}

	args = append(args, url)

	return args
}
127969
func GetArgs(line string, options ...GetArgsOption) (args []string) {
	scanner := getScanner(line, options...)
	args, _, _ = scanner.GetTokensN(0)
	return
}
118752
func (o *Application) SetArgs(v []string) *Application {
	if o.Args = v; o.Args == nil {
		o.nullFields = append(o.nullFields, "Args")
	}
	return o
}
1037425
func WrapArguments(args ...interface{}) []reflect.Value {
	funcArgs := []reflect.Value{}

	for _, arg := range args {
		value, wrapped := arg.(reflect.Value)

		if wrapped {
			funcArgs = append(funcArgs, value)
			continue
		}

		funcArgs = append(funcArgs, reflect.ValueOf(arg))
	}

	return funcArgs
}
1193003
func (f *FlagSet) Arg(i int) string {
	if i < 0 || i >= len(f.args) {
		return ""
	}
	return f.args[i]
}
374288
func (launcher *Launcher) GetArgs() []string {
	launcher.Mutex.RLock()
	args := launcher.args
	launcher.Mutex.RUnlock()
	return args
}
900547
func (s *Application) SetArgs(v []*string) *Application {
	s.Args = v
	return s
}
487428
func NoArgs(cmd *Command, args []string) error {
	if len(args) > 0 {
		return fmt.Errorf("unknown command %q for %q", args[0], cmd.CommandPath())
	}
	return nil
}
664296
func (s *SupportedProductConfig) SetArgs(v []*string) *SupportedProductConfig {
	s.Args = v
	return s
}
60451
func ArgsArg(r, o int) ArgSpec {
	return ArgSpec(C._go_MRB_ARGS_ARG(C.int(r), C.int(o)))
}