fix lint issues from staticcheck

Specifically this fixes failures: ST1005, S1028, S1011

See #6
This commit is contained in:
Clayton Craft
2021-09-04 22:41:34 -07:00
parent 9b4b1c3320
commit bcced6bc10

View File

@@ -112,7 +112,7 @@ func bootDeploy(workDir string, outDir string) error {
"-o", outDir, "-o", outDir,
"initramfs-extra") "initramfs-extra")
if !exists(cmd.Path) { if !exists(cmd.Path) {
return errors.New("boot-deploy command not found.") return errors.New("boot-deploy command not found")
} }
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
@@ -507,7 +507,7 @@ func getKernelReleaseFile() (string, error) {
files, _ := filepath.Glob("/usr/share/kernel/*/kernel.release") files, _ := filepath.Glob("/usr/share/kernel/*/kernel.release")
// only one kernel flavor supported // only one kernel flavor supported
if len(files) != 1 { if len(files) != 1 {
return "", errors.New(fmt.Sprintf("Only one kernel release/flavor is supported, found: %q", files)) return "", fmt.Errorf("only one kernel release/flavor is supported, found: %q", files)
} }
return files[0], nil return files[0], nil
@@ -676,9 +676,7 @@ func getModuleDeps(modName string, modDir string) ([]string, error) {
if modName != filepath.Base(stripExts(fields[0])) { if modName != filepath.Base(stripExts(fields[0])) {
continue continue
} }
for _, modPath := range fields { deps = append(deps, fields...)
deps = append(deps, modPath)
}
} }
if err := s.Err(); err != nil { if err := s.Err(); err != nil {
log.Print("Unable to get module + dependencies: ", modName) log.Print("Unable to get module + dependencies: ", modName)