mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Fix some linter errors
This commit is contained in:
parent
2127f1b210
commit
417d7e4743
6 changed files with 66 additions and 65 deletions
|
@ -14,7 +14,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func checkAndCreateInstanceLock(path, name string) (pid int32, err error) {
|
func checkAndCreateInstanceLock(path, name string) (pid int32, err error) {
|
||||||
|
|
||||||
lockFilePath := filepath.Join(dataRoot.Path, path, fmt.Sprintf("%s-lock.pid", name))
|
lockFilePath := filepath.Join(dataRoot.Path, path, fmt.Sprintf("%s-lock.pid", name))
|
||||||
|
|
||||||
// read current pid file
|
// read current pid file
|
||||||
|
@ -86,7 +85,7 @@ func createInstanceLock(lockFilePath string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// create lock file
|
// create lock file
|
||||||
err = ioutil.WriteFile(lockFilePath, []byte(fmt.Sprintf("%d", os.Getpid())), 0666)
|
err = ioutil.WriteFile(lockFilePath, []byte(fmt.Sprintf("%d", os.Getpid())), 0666) //nolint:gosec
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ func getPmStartLogFile(ext string) *os.File {
|
||||||
}, info.Version(), ext)
|
}, info.Version(), ext)
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:deadcode,unused // false positive on linux, currently used by windows only
|
//nolint:unused // false positive on linux, currently used by windows only
|
||||||
func logControlError(cErr error) {
|
func logControlError(cErr error) {
|
||||||
// check if error present
|
// check if error present
|
||||||
if cErr == nil {
|
if cErr == nil {
|
||||||
|
|
|
@ -19,8 +19,8 @@ var recoverIPTablesCmd = &cobra.Command{
|
||||||
// we don't get the errno of the actual error and need to parse the
|
// we don't get the errno of the actual error and need to parse the
|
||||||
// output instead. Make sure it's always english by setting LC_ALL=C
|
// output instead. Make sure it's always english by setting LC_ALL=C
|
||||||
currentLocale := os.Getenv("LC_ALL")
|
currentLocale := os.Getenv("LC_ALL")
|
||||||
os.Setenv("LC_ALL", "C") // nolint:errcheck - we tried at least ...
|
os.Setenv("LC_ALL", "C")
|
||||||
defer os.Setenv("LC_ALL", currentLocale) // nolint:errcheck
|
defer os.Setenv("LC_ALL", currentLocale)
|
||||||
|
|
||||||
err := interception.DeactivateNfqueueFirewall()
|
err := interception.DeactivateNfqueueFirewall()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
|
@ -33,13 +33,13 @@ var (
|
||||||
childIsRunning = abool.NewBool(false)
|
childIsRunning = abool.NewBool(false)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Options for starting component
|
// Options for starting component.
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Name string
|
Name string
|
||||||
Identifier string // component identifier
|
Identifier string // component identifier
|
||||||
|
ShortIdentifier string // populated automatically
|
||||||
LockPathPrefix string
|
LockPathPrefix string
|
||||||
PIDFile bool
|
PIDFile bool
|
||||||
ShortIdentifier string // populated automatically
|
|
||||||
SuppressArgs bool // do not use any args
|
SuppressArgs bool // do not use any args
|
||||||
AllowDownload bool // allow download of component if it is not yet available
|
AllowDownload bool // allow download of component if it is not yet available
|
||||||
AllowHidingWindow bool // allow hiding the window of the subprocess
|
AllowHidingWindow bool // allow hiding the window of the subprocess
|
||||||
|
@ -313,7 +313,7 @@ func execute(opts *Options, args []string) (cont bool, err error) {
|
||||||
log.Printf("starting %s %s\n", binPath, strings.Join(args, " "))
|
log.Printf("starting %s %s\n", binPath, strings.Join(args, " "))
|
||||||
|
|
||||||
// create command
|
// create command
|
||||||
exc := exec.Command(binPath, args...) //nolint:gosec // everything is okay
|
exc := exec.Command(binPath, args...)
|
||||||
|
|
||||||
if !runningInConsole && opts.AllowHidingWindow {
|
if !runningInConsole && opts.AllowHidingWindow {
|
||||||
// Windows only:
|
// Windows only:
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
var (
|
var (
|
||||||
startupComplete = make(chan struct{}) // signal that the start procedure completed (is never closed, just signaled once)
|
startupComplete = make(chan struct{}) // signal that the start procedure completed (is never closed, just signaled once)
|
||||||
shuttingDown = make(chan struct{}) // signal that we are shutting down (will be closed, may not be closed directly, use initiateShutdown)
|
shuttingDown = make(chan struct{}) // signal that we are shutting down (will be closed, may not be closed directly, use initiateShutdown)
|
||||||
//nolint:deadcode,unused // false positive on linux, currently used by windows only
|
//nolint:unused // false positive on linux, currently used by windows only
|
||||||
shutdownError error // protected by shutdownLock
|
shutdownError error // protected by shutdownLock
|
||||||
shutdownLock sync.Mutex
|
shutdownLock sync.Mutex
|
||||||
)
|
)
|
||||||
|
|
|
@ -12,9 +12,10 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
var showShortVersion bool
|
var (
|
||||||
var showAllVersions bool
|
showShortVersion bool
|
||||||
var versionCmd = &cobra.Command{
|
showAllVersions bool
|
||||||
|
versionCmd = &cobra.Command{
|
||||||
Use: "version",
|
Use: "version",
|
||||||
Short: "Display various portmaster versions",
|
Short: "Display various portmaster versions",
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
|
@ -68,6 +69,7 @@ var versionCmd = &cobra.Command{
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flags := versionCmd.Flags()
|
flags := versionCmd.Flags()
|
||||||
|
|
Loading…
Add table
Reference in a new issue