forked from Silverfish/proton-bridge
Other: Fix all linter errors
This commit is contained in:
committed by
James Houlahan
parent
b36972ce71
commit
7c62312220
@ -43,7 +43,7 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// Visible flags
|
||||
// Visible flags.
|
||||
const (
|
||||
flagCPUProfile = "cpu-prof"
|
||||
flagCPUProfileShort = "p"
|
||||
@ -63,7 +63,7 @@ const (
|
||||
flagLogSMTP = "log-smtp"
|
||||
)
|
||||
|
||||
// Hidden flags
|
||||
// Hidden flags.
|
||||
const (
|
||||
flagLauncher = "launcher"
|
||||
flagNoWindow = "no-window"
|
||||
@ -130,7 +130,7 @@ func New() *cli.App {
|
||||
return app
|
||||
}
|
||||
|
||||
func run(c *cli.Context) error {
|
||||
func run(c *cli.Context) error { //nolint:funlen
|
||||
// Get the current bridge version.
|
||||
version, err := semver.NewVersion(constants.Version)
|
||||
if err != nil {
|
||||
@ -255,7 +255,11 @@ func withLocations(fn func(*locations.Locations) error) error {
|
||||
|
||||
// Create a new locations object that will be used to provide paths to store files.
|
||||
locations := locations.New(provider, constants.ConfigName)
|
||||
defer locations.Clean()
|
||||
defer func() {
|
||||
if err := locations.Clean(); err != nil {
|
||||
logrus.WithError(err).Error("Failed to clean locations")
|
||||
}
|
||||
}()
|
||||
|
||||
return fn(locations)
|
||||
}
|
||||
|
||||
@ -42,13 +42,13 @@ import (
|
||||
const vaultSecretName = "bridge-vault-key"
|
||||
|
||||
// withBridge creates creates and tears down the bridge.
|
||||
func withBridge(
|
||||
func withBridge( //nolint:funlen
|
||||
c *cli.Context,
|
||||
exe string,
|
||||
locations *locations.Locations,
|
||||
version *semver.Version,
|
||||
identifier *useragent.UserAgent,
|
||||
reporter *sentry.Reporter,
|
||||
_ *sentry.Reporter,
|
||||
vault *vault.Vault,
|
||||
cookieJar http.CookieJar,
|
||||
fn func(*bridge.Bridge, <-chan events.Event) error,
|
||||
@ -65,10 +65,7 @@ func withBridge(
|
||||
proxyDialer := dialer.NewProxyTLSDialer(pinningDialer, constants.APIHost)
|
||||
|
||||
// Create the autostarter.
|
||||
autostarter, err := newAutostarter(exe)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not create autostarter: %w", err)
|
||||
}
|
||||
autostarter := newAutostarter(exe)
|
||||
|
||||
// Create the update installer.
|
||||
updater, err := newUpdater(locations)
|
||||
@ -112,12 +109,12 @@ func withBridge(
|
||||
return fn(bridge, eventCh)
|
||||
}
|
||||
|
||||
func newAutostarter(exe string) (*autostart.App, error) {
|
||||
func newAutostarter(exe string) *autostart.App {
|
||||
return &autostart.App{
|
||||
Name: constants.FullAppName,
|
||||
DisplayName: constants.FullAppName,
|
||||
Exec: []string{exe, "--" + flagNoWindow},
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func newUpdater(locations *locations.Locations) (*updater.Updater, error) {
|
||||
|
||||
@ -52,7 +52,7 @@ func withVault(locations *locations.Locations, fn func(*vault.Vault, bool, bool)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Add teardown actions (e.g. to close the vault).
|
||||
// GODT-1950: Add teardown actions (e.g. to close the vault).
|
||||
|
||||
return fn(encVault, insecure, corrupt)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user