Fix linter errors

This commit is contained in:
Daniel
2022-09-29 14:31:00 +02:00
parent b552e3f7a5
commit fd83534698
9 changed files with 13 additions and 18 deletions

View File

@@ -3,7 +3,6 @@ package main
import (
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
@@ -17,7 +16,7 @@ func checkAndCreateInstanceLock(path, name string) (pid int32, err error) {
lockFilePath := filepath.Join(dataRoot.Path, path, fmt.Sprintf("%s-lock.pid", name))
// read current pid file
data, err := ioutil.ReadFile(lockFilePath)
data, err := os.ReadFile(lockFilePath)
if err != nil {
if os.IsNotExist(err) {
// create new lock
@@ -78,7 +77,7 @@ func createInstanceLock(lockFilePath string) error {
// create lock file
// TODO: Investigate required permissions.
err = ioutil.WriteFile(lockFilePath, []byte(fmt.Sprintf("%d", os.Getpid())), 0o0666) //nolint:gosec
err = os.WriteFile(lockFilePath, []byte(fmt.Sprintf("%d", os.Getpid())), 0o0666) //nolint:gosec
if err != nil {
return err
}

View File

@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"time"
@@ -124,7 +123,7 @@ func writeAsJSON(path string, data any) error {
}
// Write to disk.
err = ioutil.WriteFile(path, jsonData, 0o0644) //nolint:gosec
err = os.WriteFile(path, jsonData, 0o0644) //nolint:gosec
if err != nil {
return err
}