Remove unneccessary conversions, further appeasing lint.

This commit is contained in:
David Anderson 2018-02-05 22:00:13 -08:00
parent 6061bfbc73
commit baf5793687
2 changed files with 7 additions and 7 deletions

View File

@ -88,8 +88,8 @@ func UnmarshalOptions(bs []byte) (Options, error) {
// UnmarshalOption de-serializes an Option
func UnmarshalOption(bs []byte) (*Option, error) {
optionLength := uint16(binary.BigEndian.Uint16(bs[2:4]))
optionID := uint16(binary.BigEndian.Uint16(bs[0:2]))
optionLength := binary.BigEndian.Uint16(bs[2:4])
optionID := binary.BigEndian.Uint16(bs[0:2])
switch optionID {
// parse client_id
// parse server_id
@ -134,8 +134,8 @@ func (o Options) humanReadableIaNa(opt Option) []string {
iaOptions := opt.Value[12:]
for len(iaOptions) > 0 {
l := uint16(binary.BigEndian.Uint16(iaOptions[2:4]))
id := uint16(binary.BigEndian.Uint16(iaOptions[0:2]))
l := binary.BigEndian.Uint16(iaOptions[2:4])
id := binary.BigEndian.Uint16(iaOptions[0:2])
switch id {
case OptIaAddr:
@ -250,7 +250,7 @@ func (o Options) UnmarshalOptionRequestOption() map[uint16]bool {
value := o[OptOro][0].Value
for i := 0; i < int(o[OptOro][0].Length)/2; i++ {
ret[uint16(binary.BigEndian.Uint16(value[i*2:(i+1)*2]))] = true
ret[binary.BigEndian.Uint16(value[i*2:(i+1)*2])] = true
}
return ret
}

View File

@ -27,7 +27,7 @@ func MakeStaticBootConfiguration(httpBootURL, ipxeBootURL string, preference uin
ret := &StaticBootConfiguration{HTTPBootURL: []byte(httpBootURL), IPxeBootURL: []byte(ipxeBootURL), UsePreference: usePreference}
if usePreference {
ret.Preference = make([]byte, 1)
ret.Preference[0] = byte(preference)
ret.Preference[0] = preference
}
ret.RecursiveDNS = dnsServerAddresses
return ret
@ -74,7 +74,7 @@ func MakeAPIBootConfiguration(url string, timeout time.Duration, preference uint
}
if usePreference {
ret.Preference = make([]byte, 1)
ret.Preference[0] = byte(preference)
ret.Preference[0] = preference
}
ret.RecursiveDNS = dnsServerAddresses