chore: upgraded golangci-lint v1.52.2 and fixed all issues.

This commit is contained in:
Xavier Michelon
2023-05-04 21:24:17 +02:00
parent bd47303074
commit b51d85e768
26 changed files with 105 additions and 128 deletions

View File

@ -48,16 +48,13 @@ linters:
disable-all: true disable-all: true
enable: enable:
- deadcode # Finds unused code [fast: true, auto-fix: false]
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: true, auto-fix: false] - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: true, auto-fix: false]
- gosimple # Linter for Go source code that specializes in simplifying a code [fast: true, auto-fix: false] - gosimple # Linter for Go source code that specializes in simplifying a code [fast: true, auto-fix: false]
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: true, auto-fix: false] - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: true, auto-fix: false]
- ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false] - ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: true, auto-fix: false] - staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: true, auto-fix: false]
- structcheck # Finds unused struct fields [fast: true, auto-fix: false]
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: true, auto-fix: false] - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: true, auto-fix: false]
- unused # Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false] - unused # Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
- varcheck # Finds unused global variables and constants [fast: true, auto-fix: false]
- bodyclose # checks whether HTTP response body is closed successfully [fast: true, auto-fix: false] - bodyclose # checks whether HTTP response body is closed successfully [fast: true, auto-fix: false]
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false] - depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false] - dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
@ -119,3 +116,8 @@ linters:
# - testpackage # linter that makes you use a separate _test package [fast: true, auto-fix: false] # - testpackage # linter that makes you use a separate _test package [fast: true, auto-fix: false]
# - thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers [fast: false, auto-fix: false] # - thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers [fast: false, auto-fix: false]
# - wrapcheck # Checks that errors returned from external packages are wrapped [fast: false, auto-fix: false] # - wrapcheck # Checks that errors returned from external packages are wrapped [fast: false, auto-fix: false]
# Deprecated:
# - structcheck # Finds unused struct fields [fast: true, auto-fix: false] deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
# - deadcode # Finds unused code [fast: true, auto-fix: false] deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
# - varcheck # Finds unused global variables and constants [fast: true, auto-fix: false] deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.

View File

@ -183,7 +183,7 @@ ${RESOURCE_FILE}: ./dist/info.rc ./dist/${SRC_ICO} .FORCE
## Dev dependencies ## Dev dependencies
.PHONY: install-devel-tools install-linter install-go-mod-outdated install-git-hooks .PHONY: install-devel-tools install-linter install-go-mod-outdated install-git-hooks
LINTVER:="v1.50.0" LINTVER:="v1.52.2"
LINTSRC:="https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh" LINTSRC:="https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh"
install-dev-dependencies: install-devel-tools install-linter install-go-mod-outdated install-dev-dependencies: install-devel-tools install-linter install-go-mod-outdated

View File

@ -58,11 +58,7 @@ func moveFile(from, to string) error {
return err return err
} }
if err := os.Rename(from, to); err != nil { return os.Rename(from, to)
return err
}
return nil
} }
func copyDir(from, to string) error { func copyDir(from, to string) error {

View File

@ -144,13 +144,13 @@ func (testUpdater *TestUpdater) SetLatestVersion(version, minAuto *semver.Versio
} }
} }
func (testUpdater *TestUpdater) GetVersionInfo(ctx context.Context, downloader updater.Downloader, channel updater.Channel) (updater.VersionInfo, error) { func (testUpdater *TestUpdater) GetVersionInfo(_ context.Context, _ updater.Downloader, _ updater.Channel) (updater.VersionInfo, error) {
testUpdater.lock.RLock() testUpdater.lock.RLock()
defer testUpdater.lock.RUnlock() defer testUpdater.lock.RUnlock()
return testUpdater.latest, nil return testUpdater.latest, nil
} }
func (testUpdater *TestUpdater) InstallUpdate(ctx context.Context, downloader updater.Downloader, update updater.VersionInfo) error { func (testUpdater *TestUpdater) InstallUpdate(_ context.Context, _ updater.Downloader, _ updater.VersionInfo) error {
return nil return nil
} }

View File

@ -72,7 +72,7 @@ func (s *smtpSession) Logout() error {
return nil return nil
} }
func (s *smtpSession) Mail(from string, opts *smtp.MailOptions) error { func (s *smtpSession) Mail(from string, _ *smtp.MailOptions) error {
s.from = from s.from = from
return nil return nil
} }

View File

@ -709,6 +709,6 @@ func TestBridge_User_Refresh(t *testing.T) {
} }
// getErr returns the error that was passed to it. // getErr returns the error that was passed to it.
func getErr[T any](val T, err error) error { func getErr[T any](_ T, err error) error {
return err return err
} }

View File

@ -107,7 +107,6 @@ const (
// certPEMToDER converts a certificate in PEM format to DER format, which is the format required by Apple's Security framework. // certPEMToDER converts a certificate in PEM format to DER format, which is the format required by Apple's Security framework.
func certPEMToDER(certPEM []byte) ([]byte, error) { func certPEMToDER(certPEM []byte) ([]byte, error) {
block, left := pem.Decode(certPEM) block, left := pem.Decode(certPEM)
if block == nil { if block == nil {
return []byte{}, errors.New("invalid PEM certificate") return []byte{}, errors.New("invalid PEM certificate")
@ -127,7 +126,7 @@ func installCert(certPEM []byte) error {
} }
p := C.CBytes(certDER) p := C.CBytes(certDER)
defer C.free(unsafe.Pointer(p)) defer C.free(unsafe.Pointer(p)) //nolint:unconvert
errCode := C.installTrustedCert((*C.char)(p), (C.ulonglong)(len(certDER))) errCode := C.installTrustedCert((*C.char)(p), (C.ulonglong)(len(certDER)))
switch errCode { switch errCode {
@ -147,7 +146,7 @@ func uninstallCert(certPEM []byte) error {
} }
p := C.CBytes(certDER) p := C.CBytes(certDER)
defer C.free(unsafe.Pointer(p)) defer C.free(unsafe.Pointer(p)) //nolint:unconvert
if errCode := C.removeTrustedCert((*C.char)(p), (C.ulonglong)(len(certDER))); errCode != 0 { if errCode := C.removeTrustedCert((*C.char)(p), (C.ulonglong)(len(certDER))); errCode != 0 {
return fmt.Errorf("could not install certificate from keychain (error %v)", errCode) return fmt.Errorf("could not install certificate from keychain (error %v)", errCode)

View File

@ -26,7 +26,7 @@ import (
) )
// This test implies human interactions to enter password and is disabled by default. // This test implies human interactions to enter password and is disabled by default.
func _TestTrustedCertsDarwin(t *testing.T) { func _TestTrustedCertsDarwin(t *testing.T) { //nolint:unused
template, err := NewTLSTemplate() template, err := NewTLSTemplate()
require.NoError(t, err) require.NoError(t, err)

View File

@ -305,11 +305,11 @@ func (f *frontendCLI) configureAppleMail(c *ishell.Context) {
f.Printf("Apple Mail configured for %v with address %v\n", user.Username, user.Addresses[0]) f.Printf("Apple Mail configured for %v with address %v\n", user.Username, user.Addresses[0])
} }
func (f *frontendCLI) badEventSynchronize(c *ishell.Context) { func (f *frontendCLI) badEventSynchronize(_ *ishell.Context) {
f.badEventFeedback(true) f.badEventFeedback(true)
} }
func (f *frontendCLI) badEventLogout(c *ishell.Context) { func (f *frontendCLI) badEventLogout(_ *ishell.Context) {
f.badEventFeedback(false) f.badEventFeedback(false)
} }

View File

@ -31,7 +31,7 @@ import (
"github.com/abiosoft/ishell" "github.com/abiosoft/ishell"
) )
func (f *frontendCLI) printLogDir(c *ishell.Context) { func (f *frontendCLI) printLogDir(_ *ishell.Context) {
if path, err := f.bridge.GetLogsPath(); err != nil { if path, err := f.bridge.GetLogsPath(); err != nil {
f.Println("Failed to determine location of log files") f.Println("Failed to determine location of log files")
} else { } else {
@ -39,17 +39,17 @@ func (f *frontendCLI) printLogDir(c *ishell.Context) {
} }
} }
func (f *frontendCLI) printManual(c *ishell.Context) { func (f *frontendCLI) printManual(_ *ishell.Context) {
f.Println("More instructions about the Bridge can be found at\n\n https://proton.me/mail/bridge") f.Println("More instructions about the Bridge can be found at\n\n https://proton.me/mail/bridge")
} }
func (f *frontendCLI) printCredits(c *ishell.Context) { func (f *frontendCLI) printCredits(_ *ishell.Context) {
for _, pkg := range strings.Split(bridge.Credits, ";") { for _, pkg := range strings.Split(bridge.Credits, ";") {
f.Println(pkg) f.Println(pkg)
} }
} }
func (f *frontendCLI) changeIMAPSecurity(c *ishell.Context) { func (f *frontendCLI) changeIMAPSecurity(_ *ishell.Context) {
f.ShowPrompt(false) f.ShowPrompt(false)
defer f.ShowPrompt(true) defer f.ShowPrompt(true)
@ -68,7 +68,7 @@ func (f *frontendCLI) changeIMAPSecurity(c *ishell.Context) {
} }
} }
func (f *frontendCLI) changeSMTPSecurity(c *ishell.Context) { func (f *frontendCLI) changeSMTPSecurity(_ *ishell.Context) {
f.ShowPrompt(false) f.ShowPrompt(false)
defer f.ShowPrompt(true) defer f.ShowPrompt(true)
@ -131,7 +131,7 @@ func (f *frontendCLI) changeSMTPPort(c *ishell.Context) {
} }
} }
func (f *frontendCLI) allowProxy(c *ishell.Context) { func (f *frontendCLI) allowProxy(_ *ishell.Context) {
if f.bridge.GetProxyAllowed() { if f.bridge.GetProxyAllowed() {
f.Println("Bridge is already set to use alternative routing to connect to Proton if it is being blocked.") f.Println("Bridge is already set to use alternative routing to connect to Proton if it is being blocked.")
return return
@ -147,7 +147,7 @@ func (f *frontendCLI) allowProxy(c *ishell.Context) {
} }
} }
func (f *frontendCLI) disallowProxy(c *ishell.Context) { func (f *frontendCLI) disallowProxy(_ *ishell.Context) {
if !f.bridge.GetProxyAllowed() { if !f.bridge.GetProxyAllowed() {
f.Println("Bridge is already set to NOT use alternative routing to connect to Proton if it is being blocked.") f.Println("Bridge is already set to NOT use alternative routing to connect to Proton if it is being blocked.")
return return
@ -163,7 +163,7 @@ func (f *frontendCLI) disallowProxy(c *ishell.Context) {
} }
} }
func (f *frontendCLI) hideAllMail(c *ishell.Context) { func (f *frontendCLI) hideAllMail(_ *ishell.Context) {
if !f.bridge.GetShowAllMail() { if !f.bridge.GetShowAllMail() {
f.Println("All Mail folder is not listed in your local client.") f.Println("All Mail folder is not listed in your local client.")
return return
@ -179,7 +179,7 @@ func (f *frontendCLI) hideAllMail(c *ishell.Context) {
} }
} }
func (f *frontendCLI) showAllMail(c *ishell.Context) { func (f *frontendCLI) showAllMail(_ *ishell.Context) {
if f.bridge.GetShowAllMail() { if f.bridge.GetShowAllMail() {
f.Println("All Mail folder is listed in your local client.") f.Println("All Mail folder is listed in your local client.")
return return

View File

@ -23,7 +23,7 @@ import (
"github.com/abiosoft/ishell" "github.com/abiosoft/ishell"
) )
func (f *frontendCLI) checkUpdates(c *ishell.Context) { func (f *frontendCLI) checkUpdates(_ *ishell.Context) {
updateCh, done := f.bridge.GetEvents(events.UpdateAvailable{}, events.UpdateNotAvailable{}) updateCh, done := f.bridge.GetEvents(events.UpdateAvailable{}, events.UpdateNotAvailable{})
defer done() defer done()
@ -38,7 +38,7 @@ func (f *frontendCLI) checkUpdates(c *ishell.Context) {
} }
} }
func (f *frontendCLI) enableAutoUpdates(c *ishell.Context) { func (f *frontendCLI) enableAutoUpdates(_ *ishell.Context) {
if f.bridge.GetAutoUpdate() { if f.bridge.GetAutoUpdate() {
f.Println("Bridge is already set to automatically install updates.") f.Println("Bridge is already set to automatically install updates.")
return return
@ -54,7 +54,7 @@ func (f *frontendCLI) enableAutoUpdates(c *ishell.Context) {
} }
} }
func (f *frontendCLI) disableAutoUpdates(c *ishell.Context) { func (f *frontendCLI) disableAutoUpdates(_ *ishell.Context) {
if !f.bridge.GetAutoUpdate() { if !f.bridge.GetAutoUpdate() {
f.Println("Bridge is already set to NOT automatically install updates.") f.Println("Bridge is already set to NOT automatically install updates.")
return return
@ -70,7 +70,7 @@ func (f *frontendCLI) disableAutoUpdates(c *ishell.Context) {
} }
} }
func (f *frontendCLI) selectEarlyChannel(c *ishell.Context) { func (f *frontendCLI) selectEarlyChannel(_ *ishell.Context) {
if f.bridge.GetUpdateChannel() == updater.EarlyChannel { if f.bridge.GetUpdateChannel() == updater.EarlyChannel {
f.Println("Bridge is already on the early-access update channel.") f.Println("Bridge is already on the early-access update channel.")
return return
@ -86,7 +86,7 @@ func (f *frontendCLI) selectEarlyChannel(c *ishell.Context) {
} }
} }
func (f *frontendCLI) selectStableChannel(c *ishell.Context) { func (f *frontendCLI) selectStableChannel(_ *ishell.Context) {
if f.bridge.GetUpdateChannel() == updater.StableChannel { if f.bridge.GetUpdateChannel() == updater.StableChannel {
f.Println("Bridge is already on the stable update channel.") f.Println("Bridge is already on the stable update channel.")
return return

View File

@ -47,7 +47,7 @@ import (
) )
// CheckTokens implements the CheckToken gRPC service call. // CheckTokens implements the CheckToken gRPC service call.
func (s *Service) CheckTokens(ctx context.Context, clientConfigPath *wrapperspb.StringValue) (*wrapperspb.StringValue, error) { func (s *Service) CheckTokens(_ context.Context, clientConfigPath *wrapperspb.StringValue) (*wrapperspb.StringValue, error) {
s.log.Debug("CheckTokens") s.log.Debug("CheckTokens")
path := clientConfigPath.Value path := clientConfigPath.Value
@ -65,7 +65,7 @@ func (s *Service) CheckTokens(ctx context.Context, clientConfigPath *wrapperspb.
return &wrapperspb.StringValue{Value: clientConfig.Token}, nil return &wrapperspb.StringValue{Value: clientConfig.Token}, nil
} }
func (s *Service) AddLogEntry(ctx context.Context, request *AddLogEntryRequest) (*emptypb.Empty, error) { func (s *Service) AddLogEntry(_ context.Context, request *AddLogEntryRequest) (*emptypb.Empty, error) {
entry := s.log entry := s.log
if len(request.Package) > 0 { if len(request.Package) > 0 {
@ -93,7 +93,7 @@ func (s *Service) AddLogEntry(ctx context.Context, request *AddLogEntryRequest)
} }
// GuiReady implement the GuiReady gRPC service call. // GuiReady implement the GuiReady gRPC service call.
func (s *Service) GuiReady(ctx context.Context, _ *emptypb.Empty) (*GuiReadyResponse, error) { func (s *Service) GuiReady(_ context.Context, _ *emptypb.Empty) (*GuiReadyResponse, error) {
s.log.Debug("GuiReady") s.log.Debug("GuiReady")
s.initializationDone.Do(s.initializing.Done) s.initializationDone.Do(s.initializing.Done)
@ -107,7 +107,7 @@ func (s *Service) GuiReady(ctx context.Context, _ *emptypb.Empty) (*GuiReadyResp
} }
// Quit implement the Quit gRPC service call. // Quit implement the Quit gRPC service call.
func (s *Service) Quit(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) { func (s *Service) Quit(_ context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) {
s.log.Debug("Quit") s.log.Debug("Quit")
return &emptypb.Empty{}, s.quit() return &emptypb.Empty{}, s.quit()
} }
@ -143,13 +143,13 @@ func (s *Service) Restart(ctx context.Context, empty *emptypb.Empty) (*emptypb.E
return s.Quit(ctx, empty) return s.Quit(ctx, empty)
} }
func (s *Service) ShowOnStartup(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.BoolValue, error) { func (s *Service) ShowOnStartup(_ context.Context, _ *emptypb.Empty) (*wrapperspb.BoolValue, error) {
s.log.Debug("ShowOnStartup") s.log.Debug("ShowOnStartup")
return wrapperspb.Bool(s.showOnStartup), nil return wrapperspb.Bool(s.showOnStartup), nil
} }
func (s *Service) SetIsAutostartOn(ctx context.Context, isOn *wrapperspb.BoolValue) (*emptypb.Empty, error) { func (s *Service) SetIsAutostartOn(_ context.Context, isOn *wrapperspb.BoolValue) (*emptypb.Empty, error) {
s.log.WithField("show", isOn.Value).Debug("SetIsAutostartOn") s.log.WithField("show", isOn.Value).Debug("SetIsAutostartOn")
defer func() { _ = s.SendEvent(NewToggleAutostartFinishedEvent()) }() defer func() { _ = s.SendEvent(NewToggleAutostartFinishedEvent()) }()
@ -169,13 +169,13 @@ func (s *Service) SetIsAutostartOn(ctx context.Context, isOn *wrapperspb.BoolVal
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) IsAutostartOn(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.BoolValue, error) { func (s *Service) IsAutostartOn(_ context.Context, _ *emptypb.Empty) (*wrapperspb.BoolValue, error) {
s.log.Debug("IsAutostartOn") s.log.Debug("IsAutostartOn")
return wrapperspb.Bool(s.bridge.GetAutostart()), nil return wrapperspb.Bool(s.bridge.GetAutostart()), nil
} }
func (s *Service) SetIsBetaEnabled(ctx context.Context, isEnabled *wrapperspb.BoolValue) (*emptypb.Empty, error) { func (s *Service) SetIsBetaEnabled(_ context.Context, isEnabled *wrapperspb.BoolValue) (*emptypb.Empty, error) {
s.log.WithField("isEnabled", isEnabled.Value).Debug("SetIsBetaEnabled") s.log.WithField("isEnabled", isEnabled.Value).Debug("SetIsBetaEnabled")
channel := updater.StableChannel channel := updater.StableChannel
@ -191,13 +191,13 @@ func (s *Service) SetIsBetaEnabled(ctx context.Context, isEnabled *wrapperspb.Bo
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) IsBetaEnabled(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.BoolValue, error) { func (s *Service) IsBetaEnabled(_ context.Context, _ *emptypb.Empty) (*wrapperspb.BoolValue, error) {
s.log.Debug("IsBetaEnabled") s.log.Debug("IsBetaEnabled")
return wrapperspb.Bool(s.bridge.GetUpdateChannel() == updater.EarlyChannel), nil return wrapperspb.Bool(s.bridge.GetUpdateChannel() == updater.EarlyChannel), nil
} }
func (s *Service) SetIsAllMailVisible(ctx context.Context, isVisible *wrapperspb.BoolValue) (*emptypb.Empty, error) { func (s *Service) SetIsAllMailVisible(_ context.Context, isVisible *wrapperspb.BoolValue) (*emptypb.Empty, error) {
s.log.WithField("isVisible", isVisible.Value).Debug("SetIsAllMailVisible") s.log.WithField("isVisible", isVisible.Value).Debug("SetIsAllMailVisible")
if err := s.bridge.SetShowAllMail(isVisible.Value); err != nil { if err := s.bridge.SetShowAllMail(isVisible.Value); err != nil {
@ -208,7 +208,7 @@ func (s *Service) SetIsAllMailVisible(ctx context.Context, isVisible *wrapperspb
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) IsAllMailVisible(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.BoolValue, error) { func (s *Service) IsAllMailVisible(_ context.Context, _ *emptypb.Empty) (*wrapperspb.BoolValue, error) {
s.log.Debug("IsAllMailVisible") s.log.Debug("IsAllMailVisible")
return wrapperspb.Bool(s.bridge.GetShowAllMail()), nil return wrapperspb.Bool(s.bridge.GetShowAllMail()), nil
@ -231,13 +231,13 @@ func (s *Service) IsTelemetryDisabled(_ context.Context, _ *emptypb.Empty) (*wra
return wrapperspb.Bool(s.bridge.GetTelemetryDisabled()), nil return wrapperspb.Bool(s.bridge.GetTelemetryDisabled()), nil
} }
func (s *Service) GoOs(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) { func (s *Service) GoOs(_ context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) {
s.log.Debug("GoOs") // TO-DO We can probably get rid of this and use QSysInfo::product name s.log.Debug("GoOs") // TO-DO We can probably get rid of this and use QSysInfo::product name
return wrapperspb.String(runtime.GOOS), nil return wrapperspb.String(runtime.GOOS), nil
} }
func (s *Service) TriggerReset(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) { func (s *Service) TriggerReset(_ context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) {
s.log.Debug("TriggerReset") s.log.Debug("TriggerReset")
go func() { go func() {
@ -248,13 +248,13 @@ func (s *Service) TriggerReset(ctx context.Context, _ *emptypb.Empty) (*emptypb.
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) Version(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) { func (s *Service) Version(_ context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) {
s.log.Debug("Version") s.log.Debug("Version")
return wrapperspb.String(s.bridge.GetCurrentVersion().Original()), nil return wrapperspb.String(s.bridge.GetCurrentVersion().Original()), nil
} }
func (s *Service) LogsPath(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) { func (s *Service) LogsPath(_ context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) {
s.log.Debug("LogsPath") s.log.Debug("LogsPath")
path, err := s.bridge.GetLogsPath() path, err := s.bridge.GetLogsPath()
@ -265,7 +265,7 @@ func (s *Service) LogsPath(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.S
return wrapperspb.String(path), nil return wrapperspb.String(path), nil
} }
func (s *Service) LicensePath(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) { func (s *Service) LicensePath(_ context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) {
s.log.Debug("LicensePath") s.log.Debug("LicensePath")
return wrapperspb.String(s.bridge.GetLicenseFilePath()), nil return wrapperspb.String(s.bridge.GetLicenseFilePath()), nil
@ -275,7 +275,7 @@ func (s *Service) DependencyLicensesLink(_ context.Context, _ *emptypb.Empty) (*
return wrapperspb.String(s.bridge.GetDependencyLicensesLink()), nil return wrapperspb.String(s.bridge.GetDependencyLicensesLink()), nil
} }
func (s *Service) ReleaseNotesPageLink(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) { func (s *Service) ReleaseNotesPageLink(_ context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) {
s.latestLock.RLock() s.latestLock.RLock()
defer s.latestLock.RUnlock() defer s.latestLock.RUnlock()
@ -289,7 +289,7 @@ func (s *Service) LandingPageLink(_ context.Context, _ *emptypb.Empty) (*wrapper
return wrapperspb.String(s.latest.LandingPage), nil return wrapperspb.String(s.latest.LandingPage), nil
} }
func (s *Service) SetColorSchemeName(ctx context.Context, name *wrapperspb.StringValue) (*emptypb.Empty, error) { func (s *Service) SetColorSchemeName(_ context.Context, name *wrapperspb.StringValue) (*emptypb.Empty, error) {
s.log.WithField("ColorSchemeName", name.Value).Debug("SetColorSchemeName") s.log.WithField("ColorSchemeName", name.Value).Debug("SetColorSchemeName")
if !theme.IsAvailable(theme.Theme(name.Value)) { if !theme.IsAvailable(theme.Theme(name.Value)) {
@ -305,7 +305,7 @@ func (s *Service) SetColorSchemeName(ctx context.Context, name *wrapperspb.Strin
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) ColorSchemeName(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) { func (s *Service) ColorSchemeName(_ context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) {
s.log.Debug("ColorSchemeName") s.log.Debug("ColorSchemeName")
current := s.bridge.GetColorScheme() current := s.bridge.GetColorScheme()
@ -320,13 +320,13 @@ func (s *Service) ColorSchemeName(ctx context.Context, _ *emptypb.Empty) (*wrapp
return wrapperspb.String(current), nil return wrapperspb.String(current), nil
} }
func (s *Service) CurrentEmailClient(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) { func (s *Service) CurrentEmailClient(_ context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) {
s.log.Debug("CurrentEmailClient") s.log.Debug("CurrentEmailClient")
return wrapperspb.String(s.bridge.GetCurrentUserAgent()), nil return wrapperspb.String(s.bridge.GetCurrentUserAgent()), nil
} }
func (s *Service) ReportBug(ctx context.Context, report *ReportBugRequest) (*emptypb.Empty, error) { func (s *Service) ReportBug(_ context.Context, report *ReportBugRequest) (*emptypb.Empty, error) {
s.log.WithFields(logrus.Fields{ s.log.WithFields(logrus.Fields{
"osType": report.OsType, "osType": report.OsType,
"osVersion": report.OsVersion, "osVersion": report.OsVersion,
@ -382,7 +382,7 @@ func (s *Service) ExportTLSCertificates(_ context.Context, folderPath *wrappersp
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) ForceLauncher(ctx context.Context, launcher *wrapperspb.StringValue) (*emptypb.Empty, error) { func (s *Service) ForceLauncher(_ context.Context, launcher *wrapperspb.StringValue) (*emptypb.Empty, error) {
s.log.WithField("launcher", launcher.Value).Debug("ForceLauncher") s.log.WithField("launcher", launcher.Value).Debug("ForceLauncher")
s.restarter.Override(launcher.Value) s.restarter.Override(launcher.Value)
@ -390,7 +390,7 @@ func (s *Service) ForceLauncher(ctx context.Context, launcher *wrapperspb.String
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) SetMainExecutable(ctx context.Context, exe *wrapperspb.StringValue) (*emptypb.Empty, error) { func (s *Service) SetMainExecutable(_ context.Context, exe *wrapperspb.StringValue) (*emptypb.Empty, error) {
s.log.WithField("executable", exe.Value).Debug("SetMainExecutable") s.log.WithField("executable", exe.Value).Debug("SetMainExecutable")
s.restarter.AddFlags("--wait", exe.Value) s.restarter.AddFlags("--wait", exe.Value)
@ -398,7 +398,7 @@ func (s *Service) SetMainExecutable(ctx context.Context, exe *wrapperspb.StringV
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) Login(ctx context.Context, login *LoginRequest) (*emptypb.Empty, error) { func (s *Service) Login(_ context.Context, login *LoginRequest) (*emptypb.Empty, error) {
s.log.WithField("username", login.Username).Debug("Login") s.log.WithField("username", login.Username).Debug("Login")
go func() { go func() {
@ -454,7 +454,7 @@ func (s *Service) Login(ctx context.Context, login *LoginRequest) (*emptypb.Empt
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) Login2FA(ctx context.Context, login *LoginRequest) (*emptypb.Empty, error) { func (s *Service) Login2FA(_ context.Context, login *LoginRequest) (*emptypb.Empty, error) {
s.log.WithField("username", login.Username).Debug("Login2FA") s.log.WithField("username", login.Username).Debug("Login2FA")
go func() { go func() {
@ -499,7 +499,7 @@ func (s *Service) Login2FA(ctx context.Context, login *LoginRequest) (*emptypb.E
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) Login2Passwords(ctx context.Context, login *LoginRequest) (*emptypb.Empty, error) { func (s *Service) Login2Passwords(_ context.Context, login *LoginRequest) (*emptypb.Empty, error) {
s.log.WithField("username", login.Username).Debug("Login2Passwords") s.log.WithField("username", login.Username).Debug("Login2Passwords")
go func() { go func() {
@ -521,7 +521,7 @@ func (s *Service) Login2Passwords(ctx context.Context, login *LoginRequest) (*em
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) LoginAbort(ctx context.Context, loginAbort *LoginAbortRequest) (*emptypb.Empty, error) { func (s *Service) LoginAbort(_ context.Context, loginAbort *LoginAbortRequest) (*emptypb.Empty, error) {
s.log.WithField("username", loginAbort.Username).Debug("LoginAbort") s.log.WithField("username", loginAbort.Username).Debug("LoginAbort")
go func() { go func() {
@ -565,7 +565,7 @@ func (s *Service) CheckUpdate(context.Context, *emptypb.Empty) (*emptypb.Empty,
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) InstallUpdate(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) { func (s *Service) InstallUpdate(_ context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) {
s.log.Debug("InstallUpdate") s.log.Debug("InstallUpdate")
go func() { go func() {
@ -579,7 +579,7 @@ func (s *Service) InstallUpdate(ctx context.Context, _ *emptypb.Empty) (*emptypb
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) SetIsAutomaticUpdateOn(ctx context.Context, isOn *wrapperspb.BoolValue) (*emptypb.Empty, error) { func (s *Service) SetIsAutomaticUpdateOn(_ context.Context, isOn *wrapperspb.BoolValue) (*emptypb.Empty, error) {
s.log.WithField("isOn", isOn.Value).Debug("SetIsAutomaticUpdateOn") s.log.WithField("isOn", isOn.Value).Debug("SetIsAutomaticUpdateOn")
if currentlyOn := s.bridge.GetAutoUpdate(); currentlyOn == isOn.Value { if currentlyOn := s.bridge.GetAutoUpdate(); currentlyOn == isOn.Value {
@ -594,19 +594,19 @@ func (s *Service) SetIsAutomaticUpdateOn(ctx context.Context, isOn *wrapperspb.B
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) IsAutomaticUpdateOn(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.BoolValue, error) { func (s *Service) IsAutomaticUpdateOn(_ context.Context, _ *emptypb.Empty) (*wrapperspb.BoolValue, error) {
s.log.Debug("IsAutomaticUpdateOn") s.log.Debug("IsAutomaticUpdateOn")
return wrapperspb.Bool(s.bridge.GetAutoUpdate()), nil return wrapperspb.Bool(s.bridge.GetAutoUpdate()), nil
} }
func (s *Service) DiskCachePath(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) { func (s *Service) DiskCachePath(_ context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) {
s.log.Debug("DiskCachePath") s.log.Debug("DiskCachePath")
return wrapperspb.String(s.bridge.GetGluonCacheDir()), nil return wrapperspb.String(s.bridge.GetGluonCacheDir()), nil
} }
func (s *Service) SetDiskCachePath(ctx context.Context, newPath *wrapperspb.StringValue) (*emptypb.Empty, error) { func (s *Service) SetDiskCachePath(_ context.Context, newPath *wrapperspb.StringValue) (*emptypb.Empty, error) {
s.log.WithField("path", newPath.Value).Debug("setDiskCachePath") s.log.WithField("path", newPath.Value).Debug("setDiskCachePath")
go func() { go func() {
@ -637,7 +637,7 @@ func (s *Service) SetDiskCachePath(ctx context.Context, newPath *wrapperspb.Stri
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) SetIsDoHEnabled(ctx context.Context, isEnabled *wrapperspb.BoolValue) (*emptypb.Empty, error) { func (s *Service) SetIsDoHEnabled(_ context.Context, isEnabled *wrapperspb.BoolValue) (*emptypb.Empty, error) {
s.log.WithField("isEnabled", isEnabled.Value).Debug("SetIsDohEnabled") s.log.WithField("isEnabled", isEnabled.Value).Debug("SetIsDohEnabled")
if err := s.bridge.SetProxyAllowed(isEnabled.Value); err != nil { if err := s.bridge.SetProxyAllowed(isEnabled.Value); err != nil {
@ -648,7 +648,7 @@ func (s *Service) SetIsDoHEnabled(ctx context.Context, isEnabled *wrapperspb.Boo
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) IsDoHEnabled(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.BoolValue, error) { func (s *Service) IsDoHEnabled(_ context.Context, _ *emptypb.Empty) (*wrapperspb.BoolValue, error) {
s.log.Debug("IsDohEnabled") s.log.Debug("IsDohEnabled")
return wrapperspb.Bool(s.bridge.GetProxyAllowed()), nil return wrapperspb.Bool(s.bridge.GetProxyAllowed()), nil
@ -715,19 +715,19 @@ func (s *Service) SetMailServerSettings(_ context.Context, settings *ImapSmtpSet
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) Hostname(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) { func (s *Service) Hostname(_ context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) {
s.log.Debug("Hostname") s.log.Debug("Hostname")
return wrapperspb.String(constants.Host), nil return wrapperspb.String(constants.Host), nil
} }
func (s *Service) IsPortFree(ctx context.Context, port *wrapperspb.Int32Value) (*wrapperspb.BoolValue, error) { func (s *Service) IsPortFree(_ context.Context, port *wrapperspb.Int32Value) (*wrapperspb.BoolValue, error) {
s.log.Debug("IsPortFree") s.log.Debug("IsPortFree")
return wrapperspb.Bool(ports.IsPortFree(int(port.Value))), nil return wrapperspb.Bool(ports.IsPortFree(int(port.Value))), nil
} }
func (s *Service) AvailableKeychains(ctx context.Context, _ *emptypb.Empty) (*AvailableKeychainsResponse, error) { func (s *Service) AvailableKeychains(_ context.Context, _ *emptypb.Empty) (*AvailableKeychainsResponse, error) {
s.log.Debug("AvailableKeychains") s.log.Debug("AvailableKeychains")
return &AvailableKeychainsResponse{Keychains: maps.Keys(keychain.Helpers)}, nil return &AvailableKeychainsResponse{Keychains: maps.Keys(keychain.Helpers)}, nil
@ -757,7 +757,7 @@ func (s *Service) SetCurrentKeychain(ctx context.Context, keychain *wrapperspb.S
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) CurrentKeychain(ctx context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) { func (s *Service) CurrentKeychain(_ context.Context, _ *emptypb.Empty) (*wrapperspb.StringValue, error) {
s.log.Debug("CurrentKeychain") s.log.Debug("CurrentKeychain")
helper, err := s.bridge.GetKeychainApp() helper, err := s.bridge.GetKeychainApp()

View File

@ -28,7 +28,7 @@ import (
"google.golang.org/protobuf/types/known/wrapperspb" "google.golang.org/protobuf/types/known/wrapperspb"
) )
func (s *Service) GetUserList(ctx context.Context, _ *emptypb.Empty) (*UserListResponse, error) { func (s *Service) GetUserList(_ context.Context, _ *emptypb.Empty) (*UserListResponse, error) {
s.log.Debug("GetUserList") s.log.Debug("GetUserList")
userIDs := s.bridge.GetUserIDs() userIDs := s.bridge.GetUserIDs()
@ -51,7 +51,7 @@ func (s *Service) GetUserList(ctx context.Context, _ *emptypb.Empty) (*UserListR
return &UserListResponse{Users: userList}, nil return &UserListResponse{Users: userList}, nil
} }
func (s *Service) GetUser(ctx context.Context, userID *wrapperspb.StringValue) (*User, error) { func (s *Service) GetUser(_ context.Context, userID *wrapperspb.StringValue) (*User, error) {
s.log.WithField("userID", userID).Debug("GetUser") s.log.WithField("userID", userID).Debug("GetUser")
user, err := s.bridge.GetUserInfo(userID.Value) user, err := s.bridge.GetUserInfo(userID.Value)
@ -62,7 +62,7 @@ func (s *Service) GetUser(ctx context.Context, userID *wrapperspb.StringValue) (
return grpcUserFromInfo(user), nil return grpcUserFromInfo(user), nil
} }
func (s *Service) SetUserSplitMode(ctx context.Context, splitMode *UserSplitModeRequest) (*emptypb.Empty, error) { func (s *Service) SetUserSplitMode(_ context.Context, splitMode *UserSplitModeRequest) (*emptypb.Empty, error) {
s.log.WithField("UserID", splitMode.UserID).WithField("Active", splitMode.Active).Debug("SetUserSplitMode") s.log.WithField("UserID", splitMode.UserID).WithField("Active", splitMode.Active).Debug("SetUserSplitMode")
user, err := s.bridge.GetUserInfo(splitMode.UserID) user, err := s.bridge.GetUserInfo(splitMode.UserID)
@ -96,7 +96,7 @@ func (s *Service) SetUserSplitMode(ctx context.Context, splitMode *UserSplitMode
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) SendBadEventUserFeedback(ctx context.Context, feedback *UserBadEventFeedbackRequest) (*emptypb.Empty, error) { func (s *Service) SendBadEventUserFeedback(_ context.Context, feedback *UserBadEventFeedbackRequest) (*emptypb.Empty, error) {
l := s.log.WithField("UserID", feedback.UserID).WithField("doResync", feedback.DoResync) l := s.log.WithField("UserID", feedback.UserID).WithField("doResync", feedback.DoResync)
l.Debug("SendBadEventUserFeedback") l.Debug("SendBadEventUserFeedback")
@ -114,7 +114,7 @@ func (s *Service) SendBadEventUserFeedback(ctx context.Context, feedback *UserBa
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) LogoutUser(ctx context.Context, userID *wrapperspb.StringValue) (*emptypb.Empty, error) { func (s *Service) LogoutUser(_ context.Context, userID *wrapperspb.StringValue) (*emptypb.Empty, error) {
s.log.WithField("UserID", userID.Value).Debug("LogoutUser") s.log.WithField("UserID", userID.Value).Debug("LogoutUser")
if _, err := s.bridge.GetUserInfo(userID.Value); err != nil { if _, err := s.bridge.GetUserInfo(userID.Value); err != nil {
@ -132,7 +132,7 @@ func (s *Service) LogoutUser(ctx context.Context, userID *wrapperspb.StringValue
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) RemoveUser(ctx context.Context, userID *wrapperspb.StringValue) (*emptypb.Empty, error) { func (s *Service) RemoveUser(_ context.Context, userID *wrapperspb.StringValue) (*emptypb.Empty, error) {
s.log.WithField("UserID", userID.Value).Debug("RemoveUser") s.log.WithField("UserID", userID.Value).Debug("RemoveUser")
go func() { go func() {
@ -147,7 +147,7 @@ func (s *Service) RemoveUser(ctx context.Context, userID *wrapperspb.StringValue
return &emptypb.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *Service) ConfigureUserAppleMail(ctx context.Context, request *ConfigureAppleMailRequest) (*emptypb.Empty, error) { func (s *Service) ConfigureUserAppleMail(_ context.Context, request *ConfigureAppleMailRequest) (*emptypb.Empty, error) {
s.log.WithField("UserID", request.UserID).WithField("Address", request.Address).Debug("ConfigureUserAppleMail") s.log.WithField("UserID", request.UserID).WithField("Address", request.Address).Debug("ConfigureUserAppleMail")
sslWasEnabled := s.bridge.GetSMTPSSL() sslWasEnabled := s.bridge.GetSMTPSSL()

View File

@ -203,7 +203,7 @@ func SkipDuringUnwind() {
} }
// EnhanceSentryEvent swaps type with value and removes panic handlers from the stacktrace. // EnhanceSentryEvent swaps type with value and removes panic handlers from the stacktrace.
func EnhanceSentryEvent(event *sentry.Event, hint *sentry.EventHint) *sentry.Event { func EnhanceSentryEvent(event *sentry.Event, _ *sentry.EventHint) *sentry.Event {
for idx, exception := range event.Exception { for idx, exception := range event.Exception {
exception.Type, exception.Value = exception.Value, exception.Type exception.Type, exception.Value = exception.Value, exception.Type
if exception.Stacktrace != nil { if exception.Stacktrace != nil {

View File

@ -62,6 +62,6 @@ func (i *InstallerDarwin) InstallUpdate(_ *semver.Version, r io.Reader) error {
return syncFolders(oldBundle, newBundle) return syncFolders(oldBundle, newBundle)
} }
func (i *InstallerDarwin) IsAlreadyInstalled(version *semver.Version) bool { func (i *InstallerDarwin) IsAlreadyInstalled(_ *semver.Version) bool {
return false return false
} }

View File

@ -394,7 +394,7 @@ func (user *User) handleLabelEvents(ctx context.Context, labelEvents []proton.La
return nil return nil
} }
func (user *User) handleCreateLabelEvent(ctx context.Context, event proton.LabelEvent) ([]imap.Update, error) { //nolint:unparam func (user *User) handleCreateLabelEvent(_ context.Context, event proton.LabelEvent) ([]imap.Update, error) { //nolint:unparam
return safe.LockRetErr(func() ([]imap.Update, error) { return safe.LockRetErr(func() ([]imap.Update, error) {
var updates []imap.Update var updates []imap.Update
@ -480,7 +480,7 @@ func (user *User) handleUpdateLabelEvent(ctx context.Context, event proton.Label
}, user.apiLabelsLock, user.updateChLock) }, user.apiLabelsLock, user.updateChLock)
} }
func (user *User) handleDeleteLabelEvent(ctx context.Context, event proton.LabelEvent) ([]imap.Update, error) { //nolint:unparam func (user *User) handleDeleteLabelEvent(_ context.Context, event proton.LabelEvent) ([]imap.Update, error) { //nolint:unparam
return safe.LockRetErr(func() ([]imap.Update, error) { return safe.LockRetErr(func() ([]imap.Update, error) {
var updates []imap.Update var updates []imap.Update
@ -643,7 +643,7 @@ func (user *User) handleCreateMessageEvent(ctx context.Context, message proton.M
}, user.apiUserLock, user.apiAddrsLock, user.apiLabelsLock, user.updateChLock) }, user.apiUserLock, user.apiAddrsLock, user.apiLabelsLock, user.updateChLock)
} }
func (user *User) handleUpdateMessageEvent(ctx context.Context, message proton.MessageMetadata) ([]imap.Update, error) { //nolint:unparam func (user *User) handleUpdateMessageEvent(_ context.Context, message proton.MessageMetadata) ([]imap.Update, error) { //nolint:unparam
return safe.RLockRetErr(func() ([]imap.Update, error) { return safe.RLockRetErr(func() ([]imap.Update, error) {
user.log.WithFields(logrus.Fields{ user.log.WithFields(logrus.Fields{
"messageID": message.ID, "messageID": message.ID,
@ -680,7 +680,7 @@ func (user *User) handleUpdateMessageEvent(ctx context.Context, message proton.M
}, user.apiLabelsLock, user.updateChLock) }, user.apiLabelsLock, user.updateChLock)
} }
func (user *User) handleDeleteMessageEvent(ctx context.Context, event proton.MessageEvent) ([]imap.Update, error) { //nolint:unparam func (user *User) handleDeleteMessageEvent(_ context.Context, event proton.MessageEvent) ([]imap.Update, error) {
return safe.RLockRetErr(func() ([]imap.Update, error) { return safe.RLockRetErr(func() ([]imap.Update, error) {
user.log.WithField("messageID", event.ID).Info("Handling message deleted event") user.log.WithField("messageID", event.ID).Info("Handling message deleted event")
@ -696,7 +696,7 @@ func (user *User) handleDeleteMessageEvent(ctx context.Context, event proton.Mes
}, user.updateChLock) }, user.updateChLock)
} }
func (user *User) handleUpdateDraftEvent(ctx context.Context, event proton.MessageEvent) ([]imap.Update, error) { //nolint:unparam func (user *User) handleUpdateDraftEvent(ctx context.Context, event proton.MessageEvent) ([]imap.Update, error) {
return safe.RLockRetErr(func() ([]imap.Update, error) { return safe.RLockRetErr(func() ([]imap.Update, error) {
user.log.WithFields(logrus.Fields{ user.log.WithFields(logrus.Fields{
"messageID": event.ID, "messageID": event.ID,

View File

@ -270,7 +270,7 @@ func (conn *imapConnector) CreateMessage(
mailboxID imap.MailboxID, mailboxID imap.MailboxID,
literal []byte, literal []byte,
flags imap.FlagSet, flags imap.FlagSet,
date time.Time, _ time.Time,
) (imap.Message, []byte, error) { ) (imap.Message, []byte, error) {
defer conn.goPollAPIEvents(false) defer conn.goPollAPIEvents(false)
@ -435,11 +435,11 @@ func (conn *imapConnector) MoveMessages(ctx context.Context, messageIDs []imap.M
var result bool var result bool
if v, ok := conn.apiLabels[string(labelFromID)]; ok && v.Type == proton.LabelTypeLabel { if v, ok := conn.apiLabels[string(labelFromID)]; ok && v.Type == proton.LabelTypeLabel {
result = result || true result = true
} }
if v, ok := conn.apiLabels[string(labelToID)]; ok && (v.Type == proton.LabelTypeFolder || v.Type == proton.LabelTypeSystem) { if v, ok := conn.apiLabels[string(labelToID)]; ok && (v.Type == proton.LabelTypeFolder || v.Type == proton.LabelTypeSystem) {
result = result || true result = true
} }
return result return result
@ -505,7 +505,7 @@ func (conn *imapConnector) GetMailboxVisibility(_ context.Context, mailboxID ima
} }
// Close the connector will no longer be used and all resources should be closed/released. // Close the connector will no longer be used and all resources should be closed/released.
func (conn *imapConnector) Close(ctx context.Context) error { func (conn *imapConnector) Close(_ context.Context) error {
return nil return nil
} }
@ -520,7 +520,7 @@ func (conn *imapConnector) importMessage(
if err := safe.RLockRet(func() error { if err := safe.RLockRet(func() error {
return withAddrKR(conn.apiUser, conn.apiAddrs[conn.addrID], conn.vault.KeyPass(), func(_, addrKR *crypto.KeyRing) error { return withAddrKR(conn.apiUser, conn.apiAddrs[conn.addrID], conn.vault.KeyPass(), func(_, addrKR *crypto.KeyRing) error {
messageID := "" var messageID string
if slices.Contains(labelIDs, proton.DraftsLabel) { if slices.Contains(labelIDs, proton.DraftsLabel) {
msg, err := conn.createDraft(ctx, literal, addrKR, conn.apiAddrs[conn.addrID]) msg, err := conn.createDraft(ctx, literal, addrKR, conn.apiAddrs[conn.addrID])

View File

@ -19,6 +19,6 @@
package user package user
func debugDumpToDisk(b []byte) error { func debugDumpToDisk(_ []byte) error {
return nil return nil
} }

View File

@ -572,10 +572,10 @@ func (user *User) syncMessages(
// We could sync a placeholder message here, but for now we skip it entirely. // We could sync a placeholder message here, but for now we skip it entirely.
continue continue
} else { }
if err := vault.RemFailedMessageID(res.messageID); err != nil {
logrus.WithError(err).Error("Failed to remove failed message ID") if err := vault.RemFailedMessageID(res.messageID); err != nil {
} logrus.WithError(err).Error("Failed to remove failed message ID")
} }
targetInfo := addressToIndex[res.addressID] targetInfo := addressToIndex[res.addressID]

View File

@ -48,11 +48,7 @@ func unmarshalFile[T any](gcm cipher.AEAD, b []byte, data *T) error {
} }
} }
if err := msgpack.Unmarshal(dec, data); err != nil { return msgpack.Unmarshal(dec, data)
return err
}
return nil
} }
func marshalFile[T any](gcm cipher.AEAD, t T) ([]byte, error) { func marshalFile[T any](gcm cipher.AEAD, t T) ([]byte, error) {

View File

@ -29,7 +29,7 @@ func (v *Versioner) RemoveOldVersions() error {
} }
// RemoveOtherVersions removes all but the specific provided app version. // RemoveOtherVersions removes all but the specific provided app version.
func (v *Versioner) RemoveOtherVersions(versionToKeep *semver.Version) error { func (v *Versioner) RemoveOtherVersions(_ *semver.Version) error {
// darwin does not use the versioner; removal is a noop. // darwin does not use the versioner; removal is a noop.
return nil return nil
} }

View File

@ -92,11 +92,7 @@ func buildSimpleRFC822(kr *crypto.KeyRing, msg proton.Message, opts JobOptions,
return err return err
} }
if err := w.Close(); err != nil { return w.Close()
return err
}
return nil
} }
func buildMultipartRFC822( func buildMultipartRFC822(
@ -148,11 +144,7 @@ func buildMultipartRFC822(
} }
} }
if err := w.Close(); err != nil { return w.Close()
return err
}
return nil
} }
func writeTextPart( func writeTextPart(
@ -319,11 +311,7 @@ func buildPGPMIMEFallbackRFC822(msg proton.Message, opts JobOptions, buf *bytes.
return err return err
} }
if err := w.Close(); err != nil { return w.Close()
return err
}
return nil
} }
func writeMultipartSignedRFC822(header message.Header, body []byte, sig proton.Signature, buf *bytes.Buffer) error { func writeMultipartSignedRFC822(header message.Header, body []byte, sig proton.Signature, buf *bytes.Buffer) error {
@ -379,11 +367,7 @@ func writeMultipartSignedRFC822(header message.Header, body []byte, sig proton.S
return err return err
} }
if err := mw.Close(); err != nil { return mw.Close()
return err
}
return nil
} }
func writeMultipartEncryptedRFC822(header message.Header, body []byte, buf *bytes.Buffer) error { func writeMultipartEncryptedRFC822(header message.Header, body []byte, buf *bytes.Buffer) error {

View File

@ -673,7 +673,7 @@ func TestParsePanic(t *testing.T) {
require.Error(t, err) require.Error(t, err)
} }
func TestParseTextPlainWithPdfttachmentCyrillic(t *testing.T) { func TestParseTextPlainWithPdfAttachmentCyrillic(t *testing.T) {
f := getFileReader("text_plain_pdf_attachment_cyrillic.eml") f := getFileReader("text_plain_pdf_attachment_cyrillic.eml")
m, err := Parse(f) m, err := Parse(f)
@ -718,6 +718,6 @@ func getFileReader(filename string) io.Reader {
type panicReader struct{} type panicReader struct{}
func (panicReader) Read(p []byte) (int, error) { func (panicReader) Read(_ []byte) (int, error) {
panic("lol") panic("lol")
} }

View File

@ -351,8 +351,8 @@ func (t *testCtx) expectProxyCtlAllowProxy() {
type mockRestarter struct{} type mockRestarter struct{}
func (m *mockRestarter) Set(restart, crash bool) {} func (m *mockRestarter) Set(_, _ bool) {}
func (m *mockRestarter) AddFlags(flags ...string) {} func (m *mockRestarter) AddFlags(_ ...string) {}
func (m *mockRestarter) Override(exe string) {} func (m *mockRestarter) Override(_ string) {}

View File

@ -28,7 +28,7 @@ var (
preCompKeyPEM []byte preCompKeyPEM []byte
) )
func FastGenerateCert(template *x509.Certificate) ([]byte, []byte, error) { func FastGenerateCert(_ *x509.Certificate) ([]byte, []byte, error) {
return preCompCertPEM, preCompKeyPEM, nil return preCompCertPEM, preCompKeyPEM, nil
} }

View File

@ -470,7 +470,7 @@ func (s *scenario) imapClientAppendsToMailbox(clientID string, file, mailbox str
return nil return nil
} }
func (s *scenario) imapClientsMoveMessageWithSubjectUserFromToByOrderedOperations(sourceIMAPClient, targetIMAPClient, messageSubject, bddUserID, targetMailboxName, op1, op2, op3 string) error { func (s *scenario) imapClientsMoveMessageWithSubjectUserFromToByOrderedOperations(sourceIMAPClient, targetIMAPClient, messageSubject, _, targetMailboxName, op1, op2, op3 string) error {
// call NOOP to prevent unilateral updates in following FETCH // call NOOP to prevent unilateral updates in following FETCH
_, sourceClient := s.t.getIMAPClient(sourceIMAPClient) _, sourceClient := s.t.getIMAPClient(sourceIMAPClient)
_, targetClient := s.t.getIMAPClient(targetIMAPClient) _, targetClient := s.t.getIMAPClient(targetIMAPClient)