Fix linter errors
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user