diff --git a/source/internal/pci_utils.go b/source/internal/pci_utils.go index 3d9e54a33..a2794aa32 100644 --- a/source/internal/pci_utils.go +++ b/source/internal/pci_utils.go @@ -56,9 +56,8 @@ func readPciDevInfo(devPath string, deviceAttrSpec map[string]bool) (PciDeviceIn if err != nil { if must { return info, fmt.Errorf("Failed to read device %s: %s", attr, err) - } else { - continue } + continue } info[attr] = attrVal diff --git a/source/internal/usb_utils.go b/source/internal/usb_utils.go index 4df1e5c82..9bafdf93b 100644 --- a/source/internal/usb_utils.go +++ b/source/internal/usb_utils.go @@ -60,7 +60,7 @@ func readUsbDevInfo(devPath string, deviceAttrSpec map[string]bool) (UsbClassMap classmap := UsbClassMap{} info := UsbDeviceInfo{} - for attr, _ := range deviceAttrSpec { + for attr := range deviceAttrSpec { attrVal, _ := readSingleUsbAttribute(devPath, attr) if len(attrVal) > 0 { info[attr] = attrVal diff --git a/source/kernel/kernel.go b/source/kernel/kernel.go index 0e028b53f..e2b9a34e0 100644 --- a/source/kernel/kernel.go +++ b/source/kernel/kernel.go @@ -140,7 +140,7 @@ func readKconfigGzip(filename string) ([]byte, error) { func parseKconfig() (map[string]string, error) { kconfig := map[string]string{} raw := []byte(nil) - err := error(nil) + var err error // First, try kconfig specified in the config file if len(Config.KconfigFile) > 0 { diff --git a/source/source.go b/source/source.go index be0ae486e..d4165070d 100644 --- a/source/source.go +++ b/source/source.go @@ -24,7 +24,7 @@ type FeatureValue interface { type BoolFeatureValue bool func (b BoolFeatureValue) String() string { - if b == true { + if b { return "true" } return "false"