func()

in cmd/dhcpv4/flags.go [45:82]


func (s *optionCodeSliceValue) Set(value string) error {
	values, err := readAsCSV(value)
	if err != nil {
		return err
	}

	var buf []byte

	var optcodes dhcpv4.OptionCodeList

	for _, v := range values {
		var optcode uint64

		optcode, err = strconv.ParseUint(v, 10, 8)
		if err != nil {
			//nolint:wrapcheck
			return err
		}

		buf = append(buf, byte(optcode))
	}

	err = optcodes.FromBytes(buf)
	if err != nil {
		//nolint:wrapcheck
		return err
	}

	if !s.changed {
		s.value = optcodes
	} else {
		s.value.Add(optcodes...)
	}

	s.changed = true

	return nil
}