Fixed some lint issues.

pull/9319/head
Ali Rizvi-Santiago 6 years ago
parent ad7194c920
commit 0609909f1a

@ -408,7 +408,7 @@ func (d *VmwareDriver) GuestIP(state multistep.StateBag) (string, error) {
// If the mac address matches and this lease ends farther in the
// future than the last match we might have, then choose it.
if bytes.Compare(hwaddr, entry.ether) == 0 && curLeaseEnd.Before(lastLeaseEnd) {
if bytes.Equal(hwaddr, entry.ether) && curLeaseEnd.Before(lastLeaseEnd) {
curIp = lastIp
curLeaseEnd = lastLeaseEnd
}

@ -2225,7 +2225,8 @@ func consumeOpenClosePair(openByte, closeByte byte, in chan byte) ([]byte, chan
// Now just spin in a loop shipping bytes down the channel until we hit
// closeByte, or we're at the very end...whichever comes first.
for ok := true; by != closeByte; {
var ok bool
for by != closeByte {
by, ok = <-in
if !ok {
by = closeByte

@ -644,7 +644,7 @@ func TestParserDhcpdLeaseBytesDecoder(t *testing.T) {
if err != nil {
t.Errorf("unable to decode address: %s", err)
}
if bytes.Compare(result, expected_1) != 0 {
if !bytes.Equal(result, expected_1) {
t.Errorf("expected %v, got %v", expected_1, result)
}
@ -655,30 +655,30 @@ func TestParserDhcpdLeaseBytesDecoder(t *testing.T) {
if err != nil {
t.Errorf("unable to decode address: %s", err)
}
if bytes.Compare(result, expected_2) != 0 {
if !bytes.Equal(result, expected_2) {
t.Errorf("expected %v, got %v", expected_2, result)
}
failtest_1 := ""
result, err = decodeDhcpdLeaseBytes(failtest_1)
_, err = decodeDhcpdLeaseBytes(failtest_1)
if err == nil {
t.Errorf("expected decoding error: %s", err)
}
failtest_2 := "000000"
result, err = decodeDhcpdLeaseBytes(failtest_2)
_, err = decodeDhcpdLeaseBytes(failtest_2)
if err == nil {
t.Errorf("expected decoding error: %s", err)
}
failtest_3 := "000:00"
result, err = decodeDhcpdLeaseBytes(failtest_3)
_, err = decodeDhcpdLeaseBytes(failtest_3)
if err == nil {
t.Errorf("expected decoding error: %s", err)
}
failtest_4 := "00:00:"
result, err = decodeDhcpdLeaseBytes(failtest_4)
_, err = decodeDhcpdLeaseBytes(failtest_4)
if err == nil {
t.Errorf("expected decoding error: %s", err)
}

Loading…
Cancel
Save