mirror of
https://github.com/safing/portmaster
synced 2025-09-01 10:09:11 +00:00
Fix linter errors
This commit is contained in:
parent
b552e3f7a5
commit
fd83534698
9 changed files with 13 additions and 18 deletions
|
@ -5,7 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -72,7 +72,7 @@ func broadcastNotify(ctx context.Context, t *modules.Task) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to get broadcast notifications update: %w", err)
|
||||
}
|
||||
broadcastsData, err := ioutil.ReadFile(broadcastsResource.Path())
|
||||
broadcastsData, err := os.ReadFile(broadcastsResource.Path())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load broadcast notifications update: %w", err)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
@ -42,7 +41,7 @@ func GetWFPState() (*SimplifiedWFPState, error) {
|
|||
}
|
||||
|
||||
// Get tmp file contents.
|
||||
output, err := ioutil.ReadFile(tmpFile)
|
||||
output, err := os.ReadFile(tmpFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read wfp state to tmp file: %w", err)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package filterlists
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
|
@ -212,7 +212,7 @@ func updateListIndex() error {
|
|||
}
|
||||
|
||||
// Update list index from updates.
|
||||
blob, err := ioutil.ReadFile(listIndexUpdate.Path())
|
||||
blob, err := os.ReadFile(listIndexUpdate.Path())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
|
@ -76,7 +75,7 @@ func (ch *ChartHandler) parseRequest(req *http.Request) (*QueryActiveConnectionC
|
|||
}
|
||||
|
||||
var requestPayload QueryActiveConnectionChartPayload
|
||||
blob, err := ioutil.ReadAll(body)
|
||||
blob, err := io.ReadAll(body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read body" + err.Error())
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
@ -120,7 +119,7 @@ func (qh *QueryHandler) parseRequest(req *http.Request) (*QueryRequestPayload, e
|
|||
}
|
||||
|
||||
var requestPayload QueryRequestPayload
|
||||
blob, err := ioutil.ReadAll(body)
|
||||
blob, err := io.ReadAll(body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read body" + err.Error())
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ func findSocketFromPid(pid int, socketName string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// readDirNames only reads the directory names. Using ioutil.ReadDir() would call `lstat` on every
|
||||
// readDirNames only reads the directory names. Using os.ReadDir() would call `lstat` on every
|
||||
// resulting directory name, which we don't need. This function will be called a lot, so we should
|
||||
// refrain from unnecessary work.
|
||||
func readDirNames(dir string) (names []string) {
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"crypto/tls"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
@ -95,7 +95,7 @@ func (hr *HTTPSResolver) Query(ctx context.Context, q *Query) (*RRCache, error)
|
|||
}()
|
||||
|
||||
// Try to read the result
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue