From b83c0ecfc867686512f4a25fde46e4628a990fa8 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Wed, 21 Jun 2023 12:54:45 +0200 Subject: [PATCH] code cleanup; switch to rm_chroot to remove builddir; new linter conf --- .golangci.yaml | 5 +++++ housekeeping.go | 2 +- utils.go | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index bb1b199..0d39c79 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -32,6 +32,8 @@ linters-settings: - '8' - '9' - '10' + - '100' + - '1000' ignored-functions: - strings.SplitN - os.OpenFile @@ -82,6 +84,9 @@ linters: - exhaustruct - forcetypeassert - godox + - nakedret + - tagalign + - maligned # remove for new projects - errname - goerr113 diff --git a/housekeeping.go b/housekeeping.go index 52a8a45..13eb2e6 100644 --- a/housekeeping.go +++ b/housekeeping.go @@ -36,7 +36,7 @@ func housekeeping(repo, march string, wg *sync.WaitGroup) error { buildManager.repoPurge[pkg.FullRepo] <- []*ProtoPackage{pkg} continue } else if err != nil { - log.Warningf("[HK] Problem fetching %s->%q from db: %v", fullRepo, path, err) + log.Warningf("[HK] error fetching %s->%q from db: %v", fullRepo, path, err) continue } diff --git a/utils.go b/utils.go index 99b534a..7df8246 100644 --- a/utils.go +++ b/utils.go @@ -132,7 +132,8 @@ func statusID2string(s dbpackage.Status) string { func cleanBuildDir(dir, chrootDir string) error { if stat, err := os.Stat(dir); err == nil && stat.IsDir() { - err = os.RemoveAll(dir) + rmCmd := exec.Command("sudo", "rm_chroot.py", dir) + _, err := rmCmd.CombinedOutput() if err != nil { return err }