From 72bf9cf815378ca32ffd1ddd71261304eccac9d4 Mon Sep 17 00:00:00 2001 From: Silke Hofstra Date: Fri, 1 Sep 2023 20:38:55 +0200 Subject: [PATCH] Enable and appease the staticcheck linter --- .golangci.yaml | 1 - config/load.go | 3 +-- triggers/config.go | 3 +-- util/chroot.go | 4 ++-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 09993a2..e3be6d3 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -10,7 +10,6 @@ linters: - gochecknoglobals - gochecknoinits - revive - - staticcheck - stylecheck - wrapcheck # Disabled permanently diff --git a/config/load.go b/config/load.go index 5d0f393..c6178a1 100644 --- a/config/load.go +++ b/config/load.go @@ -16,7 +16,6 @@ package config import ( "fmt" - "io/ioutil" "os" "os/user" "path/filepath" @@ -31,7 +30,7 @@ import ( func Load(path string) (tm triggers.Map, err error) { tm = make(triggers.Map) - entries, err := ioutil.ReadDir(path) + entries, err := os.ReadDir(path) if err != nil { log.Debugf("Skipped directory '%s':\n", path) diff --git a/triggers/config.go b/triggers/config.go index 1e61549..415bef3 100644 --- a/triggers/config.go +++ b/triggers/config.go @@ -17,7 +17,6 @@ package triggers import ( "errors" "fmt" - "io/ioutil" "os" "path/filepath" @@ -31,7 +30,7 @@ func (t *Trigger) Load(path string) error { return err } // Read the configuration into the program - cfg, err := ioutil.ReadFile(filepath.Clean(path)) + cfg, err := os.ReadFile(filepath.Clean(path)) if err != nil { return fmt.Errorf("unable to read config file located at %q: %w", path, err) } diff --git a/util/chroot.go b/util/chroot.go index a3fab94..982fe6d 100644 --- a/util/chroot.go +++ b/util/chroot.go @@ -15,7 +15,7 @@ package util import ( - "io/ioutil" + "io" "os" "path/filepath" "strconv" @@ -46,7 +46,7 @@ func IsChroot() bool { goto FALLBACK } - raw, err = ioutil.ReadAll(mounts) + raw, err = io.ReadAll(mounts) if err != nil { log.Warnf("Failed to read '/proc/mounts', reason: %s\n", err) goto FALLBACK