func (hc *HardwareCharacteristics) parseField(s string) (rest string, err error) {
	eq := strings.IndexByte(s, '=')
	if eq <= 0 {
		return s, errors.Errorf("malformed characteristic %q", s)
	}
	name, rest := s[:eq], s[eq+1:]

	switch name {
	case "tags":
		// Tags is a multi-valued field (comma separated)
		var values []string
		values, rest, err = parseMulti(rest)
		if err != nil {
			return rest, errors.Errorf("%s: %v", name, err)
		}
		err = hc.setTags(values)
	default:
		// All other fields are single-valued
		var value string
		value, rest, err = parseSingle(rest, " ")
		if err != nil {
			return rest, errors.Errorf("%s: %v", name, err)
		}
		switch name {
		case "arch":
			err = hc.setArch(value)
		case "cores":
			err = hc.setCpuCores(value)
		case "cpu-power":
			err = hc.setCpuPower(value)
		case "mem":
			err = hc.setMem(value)
		case "root-disk":
			err = hc.setRootDisk(value)
		case "root-disk-source":
			err = hc.setRootDiskSource(value)
		case "availability-zone":
			err = hc.setAvailabilityZone(value)
		default:
			return rest, errors.Errorf("unknown characteristic %q", name)
		}
	}
	if err != nil {
		return rest, errors.Errorf("bad %q characteristic: %v", name, err)
	}
	return rest, nil
}
// parseField parses a single name=value (or name="value") field into the
// corresponding field of the receiver.
parseField parses a single name=value (or name="value") field into the
corresponding field of the receiver.
// parseField parses a single name = value ( or name = " value " ) field into the // corresponding field of the receiver .
func (hc *HardwareCharacteristics) parseField(s string) (rest string, err error) {
	eq := strings.IndexByte(s, '=')
	if eq <= 0 {
		return s, errors.Errorf("malformed characteristic %q", s)
	}
	name, rest := s[:eq], s[eq+1:]
	switch name {
	case "tags":
		var values []string
		values, rest, err = parseMulti(rest)
		if err != nil {
			return rest, errors.Errorf("%s: %v", name, err)
		}
		err = hc.setTags(values)
	default:
		var value string
		value, rest, err = parseSingle(rest, " ")
		if err != nil {
			return rest, errors.Errorf("%s: %v", name, err)
		}
		switch name {
		case "arch":
			err = hc.setArch(value)
		case "cores":
			err = hc.setCpuCores(value)
		case "cpu-power":
			err = hc.setCpuPower(value)
		case "mem":
			err = hc.setMem(value)
		case "root-disk":
			err = hc.setRootDisk(value)
		case "root-disk-source":
			err = hc.setRootDiskSource(value)
		case "availability-zone":
			err = hc.setAvailabilityZone(value)
		default:
			return rest, errors.Errorf("unknown characteristic %q", name)
		}
	}
	if err != nil {
		return rest, errors.Errorf("bad %q characteristic: %v", name, err)
	}
	return rest, nil
}
func ( hc * HardwareCharacteristics ) parseField ( s string ) ( rest string , err error ) { eq := strings . IndexByte ( s , '=' ) if eq <= 0 { return s , errors . Errorf ( " " , s ) } name , rest := s [ : eq ] , s [ eq + 1 : ] switch name { case " " : var values [ ] string values , rest , err = parseMulti ( rest ) if err != nil { return rest , errors . Errorf ( " " , name , err ) } err = hc . setTags ( values ) default : var value string value , rest , err = parseSingle ( rest , " " ) if err != nil { return rest , errors . Errorf ( " " , name , err ) } switch name { case " " : err = hc . setArch ( value ) case " " : err = hc . setCpuCores ( value ) case " " : err = hc . setCpuPower ( value ) case " " : err = hc . setMem ( value ) case " " : err = hc . setRootDisk ( value ) case " " : err = hc . setRootDiskSource ( value ) case " " : err = hc . setAvailabilityZone ( value ) default : return rest , errors . Errorf ( " " , name ) } } if err != nil { return rest , errors . Errorf ( " " , name , err ) } return rest , nil }
parseField parses a single name=value (or name="value") field into the
corresponding field of the receiver.
parseField parses a single name = value ( or name = " value " ) field into the corresponding field of the receiver .
// Tags is a multi-valued field (comma separated) // All other fields are single-valued