From 4edf2eb92c47146ba9137e4ae1b967a7e3bbee5a Mon Sep 17 00:00:00 2001 From: James Houlahan Date: Tue, 31 May 2022 15:54:04 +0200 Subject: [PATCH] Other: Add v2 to module name --- Makefile | 14 +-- cmd/Desktop-Bridge/main.go | 4 +- cmd/launcher/main.go | 16 +-- go.mod | 2 +- internal/api/api.go | 14 +-- internal/api/ctx.go | 2 +- internal/api/focus.go | 4 +- internal/app/base/base.go | 36 +++--- internal/app/base/migration.go | 4 +- internal/app/base/migration_rebranding.go | 4 +- internal/app/base/restart_test.go | 2 +- internal/app/bridge/bridge.go | 38 +++--- internal/bridge/autostart.go | 2 +- internal/bridge/bridge.go | 22 ++-- internal/bridge/bug_report.go | 10 +- internal/bridge/store_factory.go | 12 +- internal/bridge/types.go | 2 +- internal/config/cache/cache.go | 4 +- internal/config/cache/cache_test.go | 2 +- internal/config/settings/kvs.go | 2 +- internal/config/settings/kvs_test.go | 4 +- internal/config/tls/tls.go | 2 +- internal/cookies/jar.go | 2 +- internal/cookies/jar_test.go | 2 +- internal/crash/handler.go | 2 +- internal/events/events.go | 2 +- internal/frontend/cli/account_utils.go | 2 +- internal/frontend/cli/accounts.go | 6 +- internal/frontend/cli/frontend.go | 112 +++++++++++------- internal/frontend/cli/system.go | 8 +- internal/frontend/cli/updates.go | 6 +- internal/frontend/cli/utils.go | 6 +- internal/frontend/clientconfig/config.go | 6 +- .../frontend/clientconfig/config_applemail.go | 10 +- internal/frontend/frontend.go | 18 +-- internal/frontend/qml/Bridge_test.qml | 2 +- .../frontend/qml/icons/img-welcome-dark.svg | 2 +- internal/frontend/qml/icons/img-welcome.svg | 2 +- .../frontend/qt/dockicon/dockicon_darwin.go | 5 +- .../frontend/qt/dockicon/dockicon_default.go | 5 +- internal/frontend/qt/frontend.go | 14 +-- internal/frontend/qt/frontend_events.go | 6 +- internal/frontend/qt/frontend_init.go | 2 +- internal/frontend/qt/frontend_nogui.go | 12 +- internal/frontend/qt/frontend_settings.go | 10 +- internal/frontend/qt/frontend_updates.go | 4 +- internal/frontend/qt/frontend_users.go | 6 +- internal/frontend/qt/helpers.go | 1 + internal/frontend/qt/log/log.go | 1 + internal/frontend/qt/qml_backend.go | 6 +- internal/frontend/qt/qml_users.go | 4 +- internal/frontend/theme/detect_windows.go | 1 - internal/frontend/types/types.go | 6 +- internal/imap/backend.go | 10 +- internal/imap/bridge.go | 6 +- internal/imap/mailbox.go | 4 +- internal/imap/mailbox_append.go | 10 +- internal/imap/mailbox_fetch.go | 2 +- internal/imap/mailbox_header.go | 2 +- internal/imap/mailbox_messages.go | 8 +- internal/imap/mailbox_root.go | 2 +- internal/imap/server.go | 14 +-- internal/imap/store.go | 8 +- internal/imap/updates.go | 6 +- internal/imap/user.go | 2 +- internal/locations/locations.go | 12 +- internal/locations/locations_test.go | 2 +- internal/logging/crash.go | 6 +- internal/logging/logging.go | 2 +- internal/logging/logging_test.go | 10 +- internal/sentry/reporter.go | 4 +- internal/sentry/reporter_test.go | 24 ++-- internal/serverutil/controller.go | 4 +- internal/serverutil/test/controller_test.go | 6 +- internal/serverutil/test/server.go | 4 +- internal/smtp/backend.go | 10 +- internal/smtp/bridge.go | 6 +- internal/smtp/dump_qa.go | 5 +- internal/smtp/preferences.go | 2 +- internal/smtp/preferences_test.go | 2 +- internal/smtp/send_recorder.go | 2 +- internal/smtp/send_recorder_test.go | 2 +- internal/smtp/server.go | 6 +- internal/smtp/smtp.go | 4 +- internal/smtp/store.go | 2 +- internal/smtp/user.go | 10 +- internal/smtp/vcard_tools.go | 2 +- internal/store/address.go | 2 +- internal/store/address_mailbox.go | 2 +- internal/store/address_message.go | 2 +- internal/store/cache.go | 6 +- internal/store/cache/disk.go | 14 ++- internal/store/cache_test.go | 2 +- internal/store/cache_watcher.go | 2 +- internal/store/cache_worker_test.go | 2 +- internal/store/change.go | 2 +- internal/store/change_test.go | 2 +- internal/store/event_loop.go | 6 +- internal/store/event_loop_test.go | 2 +- internal/store/mailbox.go | 2 +- internal/store/mailbox_counts.go | 2 +- internal/store/mailbox_counts_test.go | 2 +- internal/store/mailbox_ids.go | 2 +- internal/store/mailbox_ids_test.go | 2 +- internal/store/mailbox_message.go | 2 +- internal/store/message.go | 4 +- internal/store/mocks/mocks.go | 4 +- internal/store/mocks/utils_mocks.go | 2 +- internal/store/store.go | 14 +-- internal/store/store_test.go | 12 +- internal/store/store_test_exports.go | 2 +- internal/store/sync.go | 2 +- internal/store/sync_test.go | 2 +- internal/store/types.go | 2 +- internal/store/user_address.go | 2 +- internal/store/user_address_info.go | 2 +- internal/store/user_mailbox.go | 2 +- internal/store/user_message.go | 10 +- internal/store/user_message_test.go | 4 +- internal/store/user_sync.go | 11 +- internal/store/user_sync_test.go | 2 +- internal/transfer/mocks/mocks.go | 2 +- internal/updater/host_qa.go | 1 + internal/updater/install_darwin.go | 4 +- internal/updater/install_default.go | 2 +- internal/updater/sync.go | 2 +- internal/updater/sync_test.go | 6 +- internal/updater/updater.go | 4 +- internal/updater/updater_test.go | 6 +- internal/users/cache.go | 6 +- internal/users/credentials/pass_imaptest.go | 1 + internal/users/credentials/store.go | 2 +- internal/users/credentials/store_test.go | 24 ++-- internal/users/mocks/listener_mocks.go | 2 +- internal/users/mocks/mocks.go | 6 +- internal/users/types.go | 4 +- internal/users/user.go | 10 +- internal/users/user_credentials_test.go | 4 +- internal/users/user_new_test.go | 6 +- internal/users/users.go | 12 +- internal/users/users_clear_test.go | 2 +- internal/users/users_delete_test.go | 2 +- internal/users/users_login_test.go | 6 +- internal/users/users_new_test.go | 6 +- internal/users/users_test.go | 21 ++-- internal/versioner/install.go | 2 +- internal/versioner/remove.go | 2 +- internal/versioner/util.go | 2 +- internal/versioner/version.go | 2 +- internal/versioner/version_test.go | 8 +- internal/versioner/versioner_test.go | 4 +- pkg/files/removal_test.go | 2 +- pkg/keychain/keychain.go | 2 +- pkg/message/build.go | 4 +- pkg/message/build_encrypted.go | 4 +- pkg/message/build_framework_test.go | 6 +- pkg/message/build_rfc822.go | 2 +- pkg/message/build_rfc822_custom.go | 2 +- pkg/message/build_test.go | 4 +- pkg/message/encrypt.go | 2 +- pkg/message/envelope.go | 2 +- pkg/message/flags.go | 2 +- pkg/message/init.go | 2 +- pkg/message/mocks/mocks.go | 4 +- pkg/message/parser.go | 6 +- pkg/message/parser/parser_test.go | 1 - pkg/message/parser/part.go | 2 +- pkg/message/parser/trimmer_test.go | 2 +- pkg/message/parser_test.go | 3 +- pkg/message/section.go | 2 +- pkg/message/section_test.go | 21 ++-- pkg/mime/encoding_test.go | 85 ++++++------- pkg/pmapi/attachments_test.go | 2 +- pkg/pmapi/config_qa.go | 1 + pkg/pmapi/import_test.go | 2 +- pkg/pmapi/manager_auth.go | 2 +- pkg/pmapi/manager_ping.go | 6 +- pkg/pmapi/messages_test.go | 6 +- pkg/pmapi/mocks/mocks.go | 4 +- pkg/pmapi/pmapi_test.go | 6 +- pkg/pool/pool.go | 2 +- pkg/pool/pool_test.go | 2 +- pkg/sum/sum_test.go | 2 +- test/accounts/account.go | 2 +- test/accounts/accounts.go | 2 +- test/api_checks_test.go | 4 +- test/bdd_test.go | 2 +- test/benchmarks/bench_test.go | 5 +- test/context/accounts.go | 2 +- test/context/bridge.go | 20 ++-- test/context/context.go | 15 +-- test/context/credentials.go | 2 +- test/context/globals.go | 2 +- test/context/imap.go | 10 +- test/context/pmapi_controller.go | 12 +- test/context/settings.go | 2 +- test/context/smtp.go | 10 +- test/context/updater.go | 2 +- test/context/users.go | 6 +- test/fakeapi/attachments.go | 2 +- test/fakeapi/auth.go | 2 +- test/fakeapi/contacts.go | 2 +- test/fakeapi/controller.go | 4 +- test/fakeapi/controller_calls.go | 2 +- test/fakeapi/controller_control.go | 4 +- test/fakeapi/controller_session.go | 2 +- test/fakeapi/controller_user.go | 2 +- test/fakeapi/counts.go | 2 +- test/fakeapi/events.go | 2 +- test/fakeapi/fakeapi.go | 2 +- test/fakeapi/keys.go | 2 +- test/fakeapi/labels.go | 2 +- test/fakeapi/manager.go | 2 +- test/fakeapi/messages.go | 4 +- test/fakeapi/user.go | 2 +- test/imap_actions_messages_test.go | 2 +- test/liveapi/cleanup.go | 2 +- test/liveapi/controller.go | 4 +- test/liveapi/labels.go | 2 +- test/liveapi/messages.go | 4 +- test/liveapi/persistent_clients.go | 4 +- test/liveapi/users.go | 4 +- test/main_test.go | 2 +- test/mocks/imap_client.go | 2 +- test/mocks/imap_response.go | 1 - test/smtp_actions_test.go | 2 + test/store_checks_test.go | 6 +- test/store_setup_test.go | 2 +- utils/hasher/main.go | 2 +- utils/versioner/main.go | 2 +- 230 files changed, 697 insertions(+), 643 deletions(-) diff --git a/Makefile b/Makefile index 3f3f24f..d2979a8 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ BUILD_TIME:=$(shell date +%FT%T%z) BUILD_FLAGS:=-tags='${BUILD_TAGS}' BUILD_FLAGS_LAUNCHER:=${BUILD_FLAGS} BUILD_FLAGS_GUI:=-tags='${BUILD_TAGS} build_qt' -GO_LDFLAGS:=$(addprefix -X github.com/ProtonMail/proton-bridge/internal/constants.,Version=${APP_VERSION} Revision=${REVISION} BuildTime=${BUILD_TIME}) +GO_LDFLAGS:=$(addprefix -X github.com/ProtonMail/proton-bridge/v2/internal/constants.,Version=${APP_VERSION} Revision=${REVISION} BuildTime=${BUILD_TIME}) ifneq "${BUILD_LDFLAGS}" "" GO_LDFLAGS+=${BUILD_LDFLAGS} endif @@ -228,12 +228,12 @@ integration-test-bridge: ${MAKE} -C test test-bridge mocks: - mockgen --package mocks github.com/ProtonMail/proton-bridge/internal/users Locator,PanicHandler,CredentialsStorer,StoreMaker > internal/users/mocks/mocks.go - mockgen --package mocks github.com/ProtonMail/proton-bridge/pkg/listener Listener > internal/users/mocks/listener_mocks.go - mockgen --package mocks github.com/ProtonMail/proton-bridge/internal/store PanicHandler,BridgeUser,ChangeNotifier,Storer > internal/store/mocks/mocks.go - mockgen --package mocks github.com/ProtonMail/proton-bridge/pkg/listener Listener > internal/store/mocks/utils_mocks.go - mockgen --package mocks github.com/ProtonMail/proton-bridge/pkg/pmapi Client,Manager > pkg/pmapi/mocks/mocks.go - mockgen --package mocks github.com/ProtonMail/proton-bridge/pkg/message Fetcher > pkg/message/mocks/mocks.go + mockgen --package mocks github.com/ProtonMail/proton-bridge/v2/internal/users Locator,PanicHandler,CredentialsStorer,StoreMaker > internal/users/mocks/mocks.go + mockgen --package mocks github.com/ProtonMail/proton-bridge/v2/pkg/listener Listener > internal/users/mocks/listener_mocks.go + mockgen --package mocks github.com/ProtonMail/proton-bridge/v2/internal/store PanicHandler,BridgeUser,ChangeNotifier,Storer > internal/store/mocks/mocks.go + mockgen --package mocks github.com/ProtonMail/proton-bridge/v2/pkg/listener Listener > internal/store/mocks/utils_mocks.go + mockgen --package mocks github.com/ProtonMail/proton-bridge/v2/pkg/pmapi Client,Manager > pkg/pmapi/mocks/mocks.go + mockgen --package mocks github.com/ProtonMail/proton-bridge/v2/pkg/message Fetcher > pkg/message/mocks/mocks.go lint: gofiles lint-golang lint-license lint-dependencies lint-changelog diff --git a/cmd/Desktop-Bridge/main.go b/cmd/Desktop-Bridge/main.go index 0255fd9..b79af82 100644 --- a/cmd/Desktop-Bridge/main.go +++ b/cmd/Desktop-Bridge/main.go @@ -37,8 +37,8 @@ package main import ( "os" - "github.com/ProtonMail/proton-bridge/internal/app/base" - "github.com/ProtonMail/proton-bridge/internal/app/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/app/base" + "github.com/ProtonMail/proton-bridge/v2/internal/app/bridge" "github.com/sirupsen/logrus" ) diff --git a/cmd/launcher/main.go b/cmd/launcher/main.go index ed050d8..6189aad 100644 --- a/cmd/launcher/main.go +++ b/cmd/launcher/main.go @@ -26,14 +26,14 @@ import ( "github.com/Masterminds/semver/v3" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/internal/config/useragent" - "github.com/ProtonMail/proton-bridge/internal/constants" - "github.com/ProtonMail/proton-bridge/internal/crash" - "github.com/ProtonMail/proton-bridge/internal/locations" - "github.com/ProtonMail/proton-bridge/internal/logging" - "github.com/ProtonMail/proton-bridge/internal/sentry" - "github.com/ProtonMail/proton-bridge/internal/updater" - "github.com/ProtonMail/proton-bridge/internal/versioner" + "github.com/ProtonMail/proton-bridge/v2/internal/config/useragent" + "github.com/ProtonMail/proton-bridge/v2/internal/constants" + "github.com/ProtonMail/proton-bridge/v2/internal/crash" + "github.com/ProtonMail/proton-bridge/v2/internal/locations" + "github.com/ProtonMail/proton-bridge/v2/internal/logging" + "github.com/ProtonMail/proton-bridge/v2/internal/sentry" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/internal/versioner" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/go.mod b/go.mod index 035c0ea..7f73b29 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/ProtonMail/proton-bridge +module github.com/ProtonMail/proton-bridge/v2 go 1.15 diff --git a/internal/api/api.go b/internal/api/api.go index 050c28a..1a64a02 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -25,17 +25,15 @@ import ( "fmt" "net/http" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/pkg/listener" - "github.com/ProtonMail/proton-bridge/pkg/ports" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/pkg/ports" "github.com/sirupsen/logrus" ) -var ( - log = logrus.WithField("pkg", "api") //nolint:gochecknoglobals -) +var log = logrus.WithField("pkg", "api") //nolint:gochecknoglobals type apiServer struct { host string diff --git a/internal/api/ctx.go b/internal/api/ctx.go index 24c2ba1..421bc69 100644 --- a/internal/api/ctx.go +++ b/internal/api/ctx.go @@ -20,7 +20,7 @@ package api import ( "net/http" - "github.com/ProtonMail/proton-bridge/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" ) // httpHandler with Go's Response and Request. diff --git a/internal/api/focus.go b/internal/api/focus.go index 424dbc1..88047f9 100644 --- a/internal/api/focus.go +++ b/internal/api/focus.go @@ -21,8 +21,8 @@ import ( "fmt" "net/http" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/events" ) // focusHandler should be called from other instances (attempt to start bridge diff --git a/internal/app/base/base.go b/internal/app/base/base.go index 6f90834..1a11ffa 100644 --- a/internal/app/base/base.go +++ b/internal/app/base/base.go @@ -39,24 +39,24 @@ import ( "github.com/Masterminds/semver/v3" "github.com/ProtonMail/go-autostart" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/internal/api" - "github.com/ProtonMail/proton-bridge/internal/config/cache" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/config/tls" - "github.com/ProtonMail/proton-bridge/internal/config/useragent" - "github.com/ProtonMail/proton-bridge/internal/constants" - "github.com/ProtonMail/proton-bridge/internal/cookies" - "github.com/ProtonMail/proton-bridge/internal/crash" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/internal/locations" - "github.com/ProtonMail/proton-bridge/internal/logging" - "github.com/ProtonMail/proton-bridge/internal/sentry" - "github.com/ProtonMail/proton-bridge/internal/updater" - "github.com/ProtonMail/proton-bridge/internal/users/credentials" - "github.com/ProtonMail/proton-bridge/internal/versioner" - "github.com/ProtonMail/proton-bridge/pkg/keychain" - "github.com/ProtonMail/proton-bridge/pkg/listener" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/api" + "github.com/ProtonMail/proton-bridge/v2/internal/config/cache" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/config/tls" + "github.com/ProtonMail/proton-bridge/v2/internal/config/useragent" + "github.com/ProtonMail/proton-bridge/v2/internal/constants" + "github.com/ProtonMail/proton-bridge/v2/internal/cookies" + "github.com/ProtonMail/proton-bridge/v2/internal/crash" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/locations" + "github.com/ProtonMail/proton-bridge/v2/internal/logging" + "github.com/ProtonMail/proton-bridge/v2/internal/sentry" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/internal/users/credentials" + "github.com/ProtonMail/proton-bridge/v2/internal/versioner" + "github.com/ProtonMail/proton-bridge/v2/pkg/keychain" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/allan-simon/go-singleinstance" "github.com/sirupsen/logrus" "github.com/urfave/cli/v2" diff --git a/internal/app/base/migration.go b/internal/app/base/migration.go index 603a34b..6791f96 100644 --- a/internal/app/base/migration.go +++ b/internal/app/base/migration.go @@ -21,8 +21,8 @@ import ( "os" "path/filepath" - "github.com/ProtonMail/proton-bridge/internal/constants" - "github.com/ProtonMail/proton-bridge/internal/locations" + "github.com/ProtonMail/proton-bridge/v2/internal/constants" + "github.com/ProtonMail/proton-bridge/v2/internal/locations" "github.com/sirupsen/logrus" ) diff --git a/internal/app/base/migration_rebranding.go b/internal/app/base/migration_rebranding.go index 8bc13ff..9c7a57f 100644 --- a/internal/app/base/migration_rebranding.go +++ b/internal/app/base/migration_rebranding.go @@ -24,8 +24,8 @@ import ( "runtime" "strings" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/pkg/keychain" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/pkg/keychain" "github.com/hashicorp/go-multierror" "github.com/sirupsen/logrus" ) diff --git a/internal/app/base/restart_test.go b/internal/app/base/restart_test.go index 2567edb..419e19d 100644 --- a/internal/app/base/restart_test.go +++ b/internal/app/base/restart_test.go @@ -25,7 +25,7 @@ import ( ) func TestIncrementRestartFlag(t *testing.T) { - var tests = []struct { + tests := []struct { in []string out []string }{ diff --git a/internal/app/bridge/bridge.go b/internal/app/bridge/bridge.go index b8f766c..737cc70 100644 --- a/internal/app/bridge/bridge.go +++ b/internal/app/bridge/bridge.go @@ -22,20 +22,20 @@ import ( "crypto/tls" "time" - "github.com/ProtonMail/proton-bridge/internal/api" - "github.com/ProtonMail/proton-bridge/internal/app/base" - pkgBridge "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - pkgTLS "github.com/ProtonMail/proton-bridge/internal/config/tls" - "github.com/ProtonMail/proton-bridge/internal/constants" - "github.com/ProtonMail/proton-bridge/internal/frontend" - "github.com/ProtonMail/proton-bridge/internal/frontend/types" - "github.com/ProtonMail/proton-bridge/internal/imap" - "github.com/ProtonMail/proton-bridge/internal/smtp" - "github.com/ProtonMail/proton-bridge/internal/store" - "github.com/ProtonMail/proton-bridge/internal/store/cache" - "github.com/ProtonMail/proton-bridge/internal/updater" - "github.com/ProtonMail/proton-bridge/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/internal/api" + "github.com/ProtonMail/proton-bridge/v2/internal/app/base" + pkgBridge "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + pkgTLS "github.com/ProtonMail/proton-bridge/v2/internal/config/tls" + "github.com/ProtonMail/proton-bridge/v2/internal/constants" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/types" + "github.com/ProtonMail/proton-bridge/v2/internal/imap" + "github.com/ProtonMail/proton-bridge/v2/internal/smtp" + "github.com/ProtonMail/proton-bridge/v2/internal/store" + "github.com/ProtonMail/proton-bridge/v2/internal/store/cache" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/urfave/cli/v2" @@ -57,13 +57,16 @@ func New(base *base.Base) *cli.App { app.Flags = append(app.Flags, []cli.Flag{ &cli.StringFlag{ Name: flagLogIMAP, - Usage: "Enable logging of IMAP communications (all|client|server) (may contain decrypted data!)"}, + Usage: "Enable logging of IMAP communications (all|client|server) (may contain decrypted data!)", + }, &cli.BoolFlag{ Name: flagLogSMTP, - Usage: "Enable logging of SMTP communications (may contain decrypted data!)"}, + Usage: "Enable logging of SMTP communications (may contain decrypted data!)", + }, &cli.BoolFlag{ Name: flagNonInteractive, - Usage: "Start Bridge entirely noninteractively"}, + Usage: "Start Bridge entirely noninteractively", + }, }...) return app @@ -305,7 +308,6 @@ func loadMessageCache(b *base.Base) (cache.Cache, error) { ConcurrentRead: b.Settings.GetInt(settings.CacheConcurrencyRead), ConcurrentWrite: b.Settings.GetInt(settings.CacheConcurrencyWrite), }) - if err != nil { return cache.NewInMemoryCache(inMemoryCacheLimnit), err } diff --git a/internal/bridge/autostart.go b/internal/bridge/autostart.go index 7822422..6d692b5 100644 --- a/internal/bridge/autostart.go +++ b/internal/bridge/autostart.go @@ -18,7 +18,7 @@ // Package bridge provides core functionality of Bridge app. package bridge -import "github.com/ProtonMail/proton-bridge/internal/config/settings" +import "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" // IsAutostartEnabled checks if link file exits. func (b *Bridge) IsAutostartEnabled() bool { diff --git a/internal/bridge/bridge.go b/internal/bridge/bridge.go index 23c1e6c..af1c3a6 100644 --- a/internal/bridge/bridge.go +++ b/internal/bridge/bridge.go @@ -26,17 +26,17 @@ import ( "github.com/Masterminds/semver/v3" "github.com/ProtonMail/go-autostart" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/constants" - "github.com/ProtonMail/proton-bridge/internal/metrics" - "github.com/ProtonMail/proton-bridge/internal/sentry" - "github.com/ProtonMail/proton-bridge/internal/store/cache" - "github.com/ProtonMail/proton-bridge/internal/updater" - "github.com/ProtonMail/proton-bridge/internal/users" - "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - - "github.com/ProtonMail/proton-bridge/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/constants" + "github.com/ProtonMail/proton-bridge/v2/internal/metrics" + "github.com/ProtonMail/proton-bridge/v2/internal/sentry" + "github.com/ProtonMail/proton-bridge/v2/internal/store/cache" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/internal/users" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" logrus "github.com/sirupsen/logrus" ) diff --git a/internal/bridge/bug_report.go b/internal/bridge/bug_report.go index 8b01163..3b96158 100644 --- a/internal/bridge/bug_report.go +++ b/internal/bridge/bug_report.go @@ -28,12 +28,14 @@ import ( "path/filepath" "sort" - "github.com/ProtonMail/proton-bridge/internal/logging" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/logging" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) -const MaxAttachmentSize = 7 * 1024 * 1024 // 7 MB total limit -const MaxCompressedFilesCount = 6 +const ( + MaxAttachmentSize = 7 * 1024 * 1024 // 7 MB total limit + MaxCompressedFilesCount = 6 +) var ErrSizeTooLarge = errors.New("file is too big") diff --git a/internal/bridge/store_factory.go b/internal/bridge/store_factory.go index 297f337..4a5f7a0 100644 --- a/internal/bridge/store_factory.go +++ b/internal/bridge/store_factory.go @@ -21,12 +21,12 @@ import ( "fmt" "path/filepath" - "github.com/ProtonMail/proton-bridge/internal/sentry" - "github.com/ProtonMail/proton-bridge/internal/store" - "github.com/ProtonMail/proton-bridge/internal/store/cache" - "github.com/ProtonMail/proton-bridge/internal/users" - "github.com/ProtonMail/proton-bridge/pkg/listener" - "github.com/ProtonMail/proton-bridge/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/internal/sentry" + "github.com/ProtonMail/proton-bridge/v2/internal/store" + "github.com/ProtonMail/proton-bridge/v2/internal/store/cache" + "github.com/ProtonMail/proton-bridge/v2/internal/users" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" ) type storeFactory struct { diff --git a/internal/bridge/types.go b/internal/bridge/types.go index d4a085a..91b986f 100644 --- a/internal/bridge/types.go +++ b/internal/bridge/types.go @@ -20,7 +20,7 @@ package bridge import ( "github.com/Masterminds/semver/v3" - "github.com/ProtonMail/proton-bridge/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" ) type Locator interface { diff --git a/internal/config/cache/cache.go b/internal/config/cache/cache.go index d9a0374..5fa3ff3 100644 --- a/internal/config/cache/cache.go +++ b/internal/config/cache/cache.go @@ -22,7 +22,7 @@ import ( "os" "path/filepath" - "github.com/ProtonMail/proton-bridge/pkg/files" + "github.com/ProtonMail/proton-bridge/v2/pkg/files" ) type Cache struct { @@ -30,7 +30,7 @@ type Cache struct { } func New(dir, version string) (*Cache, error) { - if err := os.MkdirAll(filepath.Join(dir, version), 0700); err != nil { + if err := os.MkdirAll(filepath.Join(dir, version), 0o700); err != nil { return nil, err } diff --git a/internal/config/cache/cache_test.go b/internal/config/cache/cache_test.go index d694d5e..98a0720 100644 --- a/internal/config/cache/cache_test.go +++ b/internal/config/cache/cache_test.go @@ -61,7 +61,7 @@ func TestRemoveOldVersions(t *testing.T) { func createFilesInDir(t *testing.T, dir string, files ...string) { for _, target := range files { - require.NoError(t, os.MkdirAll(filepath.Dir(filepath.Join(dir, target)), 0700)) + require.NoError(t, os.MkdirAll(filepath.Dir(filepath.Join(dir, target)), 0o700)) f, err := os.Create(filepath.Join(dir, target)) require.NoError(t, err) diff --git a/internal/config/settings/kvs.go b/internal/config/settings/kvs.go index 152630e..2e38264 100644 --- a/internal/config/settings/kvs.go +++ b/internal/config/settings/kvs.go @@ -79,7 +79,7 @@ func (p *keyValueStore) save() error { return err } - return ioutil.WriteFile(p.path, b, 0600) + return ioutil.WriteFile(p.path, b, 0o600) } func (p *keyValueStore) setDefault(key, value string) { diff --git a/internal/config/settings/kvs_test.go b/internal/config/settings/kvs_test.go index 672846f..3acb6d6 100644 --- a/internal/config/settings/kvs_test.go +++ b/internal/config/settings/kvs_test.go @@ -38,7 +38,7 @@ func TestLoadBadKeyValueStore(t *testing.T) { path, clean := newTmpFile(r) defer clean() - r.NoError(ioutil.WriteFile(path, []byte("{\"key\":\"MISSING_QUOTES"), 0700)) + r.NoError(ioutil.WriteFile(path, []byte("{\"key\":\"MISSING_QUOTES"), 0o700)) pref := newKeyValueStore(path) r.Equal("", pref.Get("key")) } @@ -131,7 +131,7 @@ func newTestEmptyKeyValueStore(r *require.Assertions) (*keyValueStore, func()) { func newTestKeyValueStore(r *require.Assertions) (*keyValueStore, func()) { path, clean := newTmpFile(r) - r.NoError(ioutil.WriteFile(path, []byte("{\"str\":\"value\",\"int\":\"42\",\"bool\":\"true\",\"falseBool\":\"t\"}"), 0700)) + r.NoError(ioutil.WriteFile(path, []byte("{\"str\":\"value\",\"int\":\"42\",\"bool\":\"true\",\"falseBool\":\"t\"}"), 0o700)) return newKeyValueStore(path), clean } diff --git a/internal/config/tls/tls.go b/internal/config/tls/tls.go index 2d68b75..8cee611 100644 --- a/internal/config/tls/tls.go +++ b/internal/config/tls/tls.go @@ -116,7 +116,7 @@ func (t *TLS) GenerateCerts(template *x509.Certificate) error { return err } - keyOut, err := os.OpenFile(t.getTLSKeyPath(), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) + keyOut, err := os.OpenFile(t.getTLSKeyPath(), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600) if err != nil { return err } diff --git a/internal/cookies/jar.go b/internal/cookies/jar.go index 2e7b0e3..9d1d249 100644 --- a/internal/cookies/jar.go +++ b/internal/cookies/jar.go @@ -27,7 +27,7 @@ import ( "sync" "time" - "github.com/ProtonMail/proton-bridge/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" ) type cookiesByHost map[string][]*http.Cookie diff --git a/internal/cookies/jar_test.go b/internal/cookies/jar_test.go index 6979164..0943836 100644 --- a/internal/cookies/jar_test.go +++ b/internal/cookies/jar_test.go @@ -24,7 +24,7 @@ import ( "testing" "time" - "github.com/ProtonMail/proton-bridge/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/internal/crash/handler.go b/internal/crash/handler.go index 5dbcb6c..ae27821 100644 --- a/internal/crash/handler.go +++ b/internal/crash/handler.go @@ -19,7 +19,7 @@ package crash import ( - "github.com/ProtonMail/proton-bridge/internal/sentry" + "github.com/ProtonMail/proton-bridge/v2/internal/sentry" "github.com/sirupsen/logrus" ) diff --git a/internal/events/events.go b/internal/events/events.go index 50b8794..05a0016 100644 --- a/internal/events/events.go +++ b/internal/events/events.go @@ -21,7 +21,7 @@ package events import ( "time" - "github.com/ProtonMail/proton-bridge/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" ) // Constants of events used by the event listener in bridge. diff --git a/internal/frontend/cli/account_utils.go b/internal/frontend/cli/account_utils.go index d818102..3e620d7 100644 --- a/internal/frontend/cli/account_utils.go +++ b/internal/frontend/cli/account_utils.go @@ -22,7 +22,7 @@ import ( "strconv" "strings" - "github.com/ProtonMail/proton-bridge/internal/frontend/types" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/types" "github.com/abiosoft/ishell" ) diff --git a/internal/frontend/cli/accounts.go b/internal/frontend/cli/accounts.go index 5894023..13d806a 100644 --- a/internal/frontend/cli/accounts.go +++ b/internal/frontend/cli/accounts.go @@ -21,9 +21,9 @@ import ( "context" "strings" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/frontend/types" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/types" "github.com/abiosoft/ishell" ) diff --git a/internal/frontend/cli/frontend.go b/internal/frontend/cli/frontend.go index 4e97798..badad56 100644 --- a/internal/frontend/cli/frontend.go +++ b/internal/frontend/cli/frontend.go @@ -19,20 +19,18 @@ package cli import ( - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/internal/frontend/types" - "github.com/ProtonMail/proton-bridge/internal/locations" - "github.com/ProtonMail/proton-bridge/internal/updater" - "github.com/ProtonMail/proton-bridge/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/types" + "github.com/ProtonMail/proton-bridge/v2/internal/locations" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" "github.com/abiosoft/ishell" "github.com/sirupsen/logrus" ) -var ( - log = logrus.WithField("pkg", "frontend/cli") //nolint:gochecknoglobals -) +var log = logrus.WithField("pkg", "frontend/cli") //nolint:gochecknoglobals type frontendCLI struct { *ishell.Shell @@ -70,21 +68,25 @@ func New( //nolint:funlen } // Clear commands. - clearCmd := &ishell.Cmd{Name: "clear", + clearCmd := &ishell.Cmd{ + Name: "clear", Help: "remove stored accounts and preferences. (alias: cl)", Aliases: []string{"cl"}, } - clearCmd.AddCmd(&ishell.Cmd{Name: "cache", + clearCmd.AddCmd(&ishell.Cmd{ + Name: "cache", Help: "remove stored preferences for accounts (aliases: c, prefs, preferences)", Aliases: []string{"c", "prefs", "preferences"}, Func: fe.deleteCache, }) - clearCmd.AddCmd(&ishell.Cmd{Name: "accounts", + clearCmd.AddCmd(&ishell.Cmd{ + Name: "accounts", Help: "remove all accounts from keychain. (aliases: a, k, keychain)", Aliases: []string{"a", "k", "keychain"}, Func: fe.deleteAccounts, }) - clearCmd.AddCmd(&ishell.Cmd{Name: "everything", + clearCmd.AddCmd(&ishell.Cmd{ + Name: "everything", Help: "remove everything", Aliases: []string{"a", "k", "keychain"}, Func: fe.deleteEverything, @@ -92,22 +94,26 @@ func New( //nolint:funlen fe.AddCmd(clearCmd) // Change commands. - changeCmd := &ishell.Cmd{Name: "change", + changeCmd := &ishell.Cmd{ + Name: "change", Help: "change server or account settings (aliases: ch, switch)", Aliases: []string{"ch", "switch"}, } - changeCmd.AddCmd(&ishell.Cmd{Name: "mode", + changeCmd.AddCmd(&ishell.Cmd{ + Name: "mode", Help: "switch between combined addresses and split addresses mode for account. Use index or account name as parameter. (alias: m)", Aliases: []string{"m"}, Func: fe.changeMode, Completer: fe.completeUsernames, }) - changeCmd.AddCmd(&ishell.Cmd{Name: "port", + changeCmd.AddCmd(&ishell.Cmd{ + Name: "port", Help: "change port numbers of IMAP and SMTP servers. (alias: p)", Aliases: []string{"p"}, Func: fe.changePort, }) - changeCmd.AddCmd(&ishell.Cmd{Name: "smtp-security", + changeCmd.AddCmd(&ishell.Cmd{ + Name: "smtp-security", Help: "change port numbers of IMAP and SMTP servers.(alias: ssl, starttls)", Aliases: []string{"ssl", "starttls"}, Func: fe.changeSMTPSecurity, @@ -115,113 +121,136 @@ func New( //nolint:funlen fe.AddCmd(changeCmd) // DoH commands. - dohCmd := &ishell.Cmd{Name: "proxy", + dohCmd := &ishell.Cmd{ + Name: "proxy", Help: "allow or disallow bridge to securely connect to proton via a third party when it is being blocked", } - dohCmd.AddCmd(&ishell.Cmd{Name: "allow", + dohCmd.AddCmd(&ishell.Cmd{ + Name: "allow", Help: "allow bridge to securely connect to proton via a third party when it is being blocked", Func: fe.allowProxy, }) - dohCmd.AddCmd(&ishell.Cmd{Name: "disallow", + dohCmd.AddCmd(&ishell.Cmd{ + Name: "disallow", Help: "disallow bridge to securely connect to proton via a third party when it is being blocked", Func: fe.disallowProxy, }) fe.AddCmd(dohCmd) // Cache-On-Disk commands. - codCmd := &ishell.Cmd{Name: "local-cache", + codCmd := &ishell.Cmd{ + Name: "local-cache", Help: "manage the local encrypted message cache", } - codCmd.AddCmd(&ishell.Cmd{Name: "enable", + codCmd.AddCmd(&ishell.Cmd{ + Name: "enable", Help: "enable the local cache", Func: fe.enableCacheOnDisk, }) - codCmd.AddCmd(&ishell.Cmd{Name: "disable", + codCmd.AddCmd(&ishell.Cmd{ + Name: "disable", Help: "disable the local cache", Func: fe.disableCacheOnDisk, }) - codCmd.AddCmd(&ishell.Cmd{Name: "change-location", + codCmd.AddCmd(&ishell.Cmd{ + Name: "change-location", Help: "change the location of the local cache", Func: fe.setCacheOnDiskLocation, }) fe.AddCmd(codCmd) // Updates commands. - updatesCmd := &ishell.Cmd{Name: "updates", + updatesCmd := &ishell.Cmd{ + Name: "updates", Help: "manage bridge updates", } - updatesCmd.AddCmd(&ishell.Cmd{Name: "check", + updatesCmd.AddCmd(&ishell.Cmd{ + Name: "check", Help: "check for Bridge updates", Func: fe.checkUpdates, }) - autoUpdatesCmd := &ishell.Cmd{Name: "autoupdates", + autoUpdatesCmd := &ishell.Cmd{ + Name: "autoupdates", Help: "manage bridge updates", } updatesCmd.AddCmd(autoUpdatesCmd) - autoUpdatesCmd.AddCmd(&ishell.Cmd{Name: "enable", + autoUpdatesCmd.AddCmd(&ishell.Cmd{ + Name: "enable", Help: "automatically keep bridge up to date", Func: fe.enableAutoUpdates, }) - autoUpdatesCmd.AddCmd(&ishell.Cmd{Name: "disable", + autoUpdatesCmd.AddCmd(&ishell.Cmd{ + Name: "disable", Help: "require bridge to be manually updated", Func: fe.disableAutoUpdates, }) - updatesChannelCmd := &ishell.Cmd{Name: "channel", + updatesChannelCmd := &ishell.Cmd{ + Name: "channel", Help: "switch updates channel", } updatesCmd.AddCmd(updatesChannelCmd) - updatesChannelCmd.AddCmd(&ishell.Cmd{Name: "early", + updatesChannelCmd.AddCmd(&ishell.Cmd{ + Name: "early", Help: "switch to the early-access updates channel", Func: fe.selectEarlyChannel, }) - updatesChannelCmd.AddCmd(&ishell.Cmd{Name: "stable", + updatesChannelCmd.AddCmd(&ishell.Cmd{ + Name: "stable", Help: "switch to the stable updates channel", Func: fe.selectStableChannel, }) fe.AddCmd(updatesCmd) // Print info commands. - fe.AddCmd(&ishell.Cmd{Name: "log-dir", + fe.AddCmd(&ishell.Cmd{ + Name: "log-dir", Help: "print path to directory with logs. (aliases: log, logs)", Aliases: []string{"log", "logs"}, Func: fe.printLogDir, }) - fe.AddCmd(&ishell.Cmd{Name: "manual", + fe.AddCmd(&ishell.Cmd{ + Name: "manual", Help: "print URL with instructions. (alias: man)", Aliases: []string{"man"}, Func: fe.printManual, }) - fe.AddCmd(&ishell.Cmd{Name: "credits", + fe.AddCmd(&ishell.Cmd{ + Name: "credits", Help: "print used resources.", Func: fe.printCredits, }) // Account commands. - fe.AddCmd(&ishell.Cmd{Name: "list", + fe.AddCmd(&ishell.Cmd{ + Name: "list", Help: "print the list of accounts. (aliases: l, ls)", Func: fe.noAccountWrapper(fe.listAccounts), Aliases: []string{"l", "ls"}, }) - fe.AddCmd(&ishell.Cmd{Name: "info", + fe.AddCmd(&ishell.Cmd{ + Name: "info", Help: "print the configuration for account. Use index or account name as parameter. (alias: i)", Func: fe.noAccountWrapper(fe.showAccountInfo), Completer: fe.completeUsernames, Aliases: []string{"i"}, }) - fe.AddCmd(&ishell.Cmd{Name: "login", + fe.AddCmd(&ishell.Cmd{ + Name: "login", Help: "login procedure to add or connect account. Optionally use index or account as parameter. (aliases: a, add, con, connect)", Func: fe.loginAccount, Aliases: []string{"add", "a", "con", "connect"}, Completer: fe.completeUsernames, }) - fe.AddCmd(&ishell.Cmd{Name: "logout", + fe.AddCmd(&ishell.Cmd{ + Name: "logout", Help: "disconnect the account. Use index or account name as parameter. (aliases: d, disconnect)", Func: fe.noAccountWrapper(fe.logoutAccount), Aliases: []string{"d", "disconnect"}, Completer: fe.completeUsernames, }) - fe.AddCmd(&ishell.Cmd{Name: "delete", + fe.AddCmd(&ishell.Cmd{ + Name: "delete", Help: "remove the account from keychain. Use index or account name as parameter. (aliases: del, rm, remove)", Func: fe.noAccountWrapper(fe.deleteAccount), Aliases: []string{"del", "rm", "remove"}, @@ -229,7 +258,8 @@ func New( //nolint:funlen }) // System commands. - fe.AddCmd(&ishell.Cmd{Name: "restart", + fe.AddCmd(&ishell.Cmd{ + Name: "restart", Help: "restart the bridge.", Func: fe.restart, }) diff --git a/internal/frontend/cli/system.go b/internal/frontend/cli/system.go index e2f792b..9ada04c 100644 --- a/internal/frontend/cli/system.go +++ b/internal/frontend/cli/system.go @@ -23,14 +23,12 @@ import ( "strconv" "strings" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/pkg/ports" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/pkg/ports" "github.com/abiosoft/ishell" ) -var ( - currentPort = "" //nolint:gochecknoglobals -) +var currentPort = "" //nolint:gochecknoglobals func (f *frontendCLI) restart(c *ishell.Context) { if f.yesNoQuestion("Are you sure you want to restart the Bridge") { diff --git a/internal/frontend/cli/updates.go b/internal/frontend/cli/updates.go index 7bd5ed8..4edbc65 100644 --- a/internal/frontend/cli/updates.go +++ b/internal/frontend/cli/updates.go @@ -20,9 +20,9 @@ package cli import ( "strings" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" "github.com/abiosoft/ishell" ) diff --git a/internal/frontend/cli/utils.go b/internal/frontend/cli/utils.go index e527754..84efbe9 100644 --- a/internal/frontend/cli/utils.go +++ b/internal/frontend/cli/utils.go @@ -20,7 +20,7 @@ package cli import ( "strings" - pmapi "github.com/ProtonMail/proton-bridge/pkg/pmapi" + pmapi "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/fatih/color" ) @@ -28,9 +28,7 @@ const ( maxInputRepeat = 2 ) -var ( - bold = color.New(color.Bold).SprintFunc() //nolint:gochecknoglobals -) +var bold = color.New(color.Bold).SprintFunc() //nolint:gochecknoglobals func isNotEmpty(val string) bool { return val != "" diff --git a/internal/frontend/clientconfig/config.go b/internal/frontend/clientconfig/config.go index 6fdf0bb..3b5a896 100644 --- a/internal/frontend/clientconfig/config.go +++ b/internal/frontend/clientconfig/config.go @@ -22,9 +22,9 @@ package clientconfig import ( "errors" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/config/useragent" - "github.com/ProtonMail/proton-bridge/internal/frontend/types" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/config/useragent" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/types" "github.com/sirupsen/logrus" ) diff --git a/internal/frontend/clientconfig/config_applemail.go b/internal/frontend/clientconfig/config_applemail.go index 2282e29..b50db72 100644 --- a/internal/frontend/clientconfig/config_applemail.go +++ b/internal/frontend/clientconfig/config_applemail.go @@ -29,10 +29,10 @@ import ( "strings" "time" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/useragent" - "github.com/ProtonMail/proton-bridge/internal/frontend/types" - "github.com/ProtonMail/proton-bridge/pkg/mobileconfig" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/useragent" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/types" + "github.com/ProtonMail/proton-bridge/v2/pkg/mobileconfig" ) const ( @@ -107,7 +107,7 @@ func saveConfigTemporarily(mc *mobileconfig.Config) (fname string, err error) { // Make sure the file is only readable for the current user. fname = filepath.Clean(filepath.Join(dir, "protonmail.mobileconfig")) - f, err := os.OpenFile(fname, os.O_RDWR|os.O_CREATE, 0600) + f, err := os.OpenFile(fname, os.O_RDWR|os.O_CREATE, 0o600) if err != nil { return } diff --git a/internal/frontend/frontend.go b/internal/frontend/frontend.go index 732649e..a69aa6b 100644 --- a/internal/frontend/frontend.go +++ b/internal/frontend/frontend.go @@ -19,15 +19,15 @@ package frontend import ( - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/config/useragent" - "github.com/ProtonMail/proton-bridge/internal/frontend/cli" - "github.com/ProtonMail/proton-bridge/internal/frontend/qt" - "github.com/ProtonMail/proton-bridge/internal/frontend/types" - "github.com/ProtonMail/proton-bridge/internal/locations" - "github.com/ProtonMail/proton-bridge/internal/updater" - "github.com/ProtonMail/proton-bridge/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/config/useragent" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/cli" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/qt" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/types" + "github.com/ProtonMail/proton-bridge/v2/internal/locations" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" ) type Frontend interface { diff --git a/internal/frontend/qml/Bridge_test.qml b/internal/frontend/qml/Bridge_test.qml index b580ad8..1b6598a 100644 --- a/internal/frontend/qml/Bridge_test.qml +++ b/internal/frontend/qml/Bridge_test.qml @@ -836,7 +836,7 @@ Window { property url logsPath: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0] property url licensePath: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0] property url releaseNotesLink: Qt.resolvedUrl("https://protonmail.com/download/bridge/early_releases.html") - property url dependencyLicensesLink: Qt.resolvedUrl("https://github.com/ProtonMail/proton-bridge/blob/master/COPYING_NOTES.md#dependencies") + property url dependencyLicensesLink: Qt.resolvedUrl("https://github.com/ProtonMail/proton-bridge/v2/blob/master/COPYING_NOTES.md#dependencies") property url landingPageLink: Qt.resolvedUrl("https://protonmail.com/bridge") property string colorSchemeName: "light" diff --git a/internal/frontend/qml/icons/img-welcome-dark.svg b/internal/frontend/qml/icons/img-welcome-dark.svg index 79863d4..1439437 100644 --- a/internal/frontend/qml/icons/img-welcome-dark.svg +++ b/internal/frontend/qml/icons/img-welcome-dark.svg @@ -8,7 +8,7 @@ id="svg84" sodipodi:docname="img-welcome-dark.svg" inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)" - inkscape:export-filename="/home/dev/gopath/src/github.com/ProtonMail/proton-bridge/internal/frontend/qml/icons/img-welcome.png" + inkscape:export-filename="/home/dev/gopath/src/github.com/ProtonMail/proton-bridge/v2/internal/frontend/qml/icons/img-welcome.png" inkscape:export-xdpi="400" inkscape:export-ydpi="400" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" diff --git a/internal/frontend/qml/icons/img-welcome.svg b/internal/frontend/qml/icons/img-welcome.svg index 7754029..fcb1f83 100644 --- a/internal/frontend/qml/icons/img-welcome.svg +++ b/internal/frontend/qml/icons/img-welcome.svg @@ -8,7 +8,7 @@ id="svg84" sodipodi:docname="img-welcome.svg" inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)" - inkscape:export-filename="/home/dev/gopath/src/github.com/ProtonMail/proton-bridge/internal/frontend/qml/icons/img-welcome.png" + inkscape:export-filename="/home/dev/gopath/src/github.com/ProtonMail/proton-bridge/v2/internal/frontend/qml/icons/img-welcome.png" inkscape:export-xdpi="400" inkscape:export-ydpi="400" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" diff --git a/internal/frontend/qt/dockicon/dockicon_darwin.go b/internal/frontend/qt/dockicon/dockicon_darwin.go index e5b60fa..57814da 100644 --- a/internal/frontend/qt/dockicon/dockicon_darwin.go +++ b/internal/frontend/qt/dockicon/dockicon_darwin.go @@ -15,8 +15,8 @@ // You should have received a copy of the GNU General Public License // along with Proton Mail Bridge. If not, see . -// +build darwin -// +build build_qt +//go:build darwin && build_qt +// +build darwin,build_qt package dockicon @@ -28,6 +28,7 @@ import "C" func SetDockIconVisibleState(visible bool) { C.SetDockIconVisibleState(C.bool(visible)) } + func GetDockIconVisibleState() bool { return bool(C.GetDockIconVisibleState()) } diff --git a/internal/frontend/qt/dockicon/dockicon_default.go b/internal/frontend/qt/dockicon/dockicon_default.go index bd1a9fb..9ec3625 100644 --- a/internal/frontend/qt/dockicon/dockicon_default.go +++ b/internal/frontend/qt/dockicon/dockicon_default.go @@ -15,12 +15,13 @@ // You should have received a copy of the GNU General Public License // along with Proton Mail Bridge. If not, see . -// +build !darwin -// +build build_qt +//go:build !darwin && build_qt +// +build !darwin,build_qt package dockicon func SetDockIconVisibleState(visible bool) {} + func GetDockIconVisibleState() bool { return true } diff --git a/internal/frontend/qt/frontend.go b/internal/frontend/qt/frontend.go index da87aa3..707c399 100644 --- a/internal/frontend/qt/frontend.go +++ b/internal/frontend/qt/frontend.go @@ -25,13 +25,13 @@ import ( "fmt" "sync" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/config/useragent" - "github.com/ProtonMail/proton-bridge/internal/frontend/types" - "github.com/ProtonMail/proton-bridge/internal/locations" - "github.com/ProtonMail/proton-bridge/internal/updater" - "github.com/ProtonMail/proton-bridge/pkg/listener" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/config/useragent" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/types" + "github.com/ProtonMail/proton-bridge/v2/internal/locations" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/sirupsen/logrus" "github.com/therecipe/qt/core" "github.com/therecipe/qt/qml" diff --git a/internal/frontend/qt/frontend_events.go b/internal/frontend/qt/frontend_events.go index b0a9a92..ed95cb6 100644 --- a/internal/frontend/qt/frontend_events.go +++ b/internal/frontend/qt/frontend_events.go @@ -24,9 +24,9 @@ package qt import ( "strings" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/pkg/keychain" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/pkg/keychain" ) func (f *FrontendQt) watchEvents() { diff --git a/internal/frontend/qt/frontend_init.go b/internal/frontend/qt/frontend_init.go index 49901c2..7191f7a 100644 --- a/internal/frontend/qt/frontend_init.go +++ b/internal/frontend/qt/frontend_init.go @@ -26,7 +26,7 @@ import ( "runtime" "github.com/Masterminds/semver/v3" - qmlLog "github.com/ProtonMail/proton-bridge/internal/frontend/qt/log" + qmlLog "github.com/ProtonMail/proton-bridge/v2/internal/frontend/qt/log" "github.com/therecipe/qt/core" "github.com/therecipe/qt/qml" "github.com/therecipe/qt/quickcontrols2" diff --git a/internal/frontend/qt/frontend_nogui.go b/internal/frontend/qt/frontend_nogui.go index cbe9bcb..9e790aa 100644 --- a/internal/frontend/qt/frontend_nogui.go +++ b/internal/frontend/qt/frontend_nogui.go @@ -24,12 +24,12 @@ import ( "fmt" "net/http" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/config/useragent" - "github.com/ProtonMail/proton-bridge/internal/frontend/types" - "github.com/ProtonMail/proton-bridge/internal/locations" - "github.com/ProtonMail/proton-bridge/internal/updater" - "github.com/ProtonMail/proton-bridge/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/config/useragent" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/types" + "github.com/ProtonMail/proton-bridge/v2/internal/locations" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" "github.com/sirupsen/logrus" ) diff --git a/internal/frontend/qt/frontend_settings.go b/internal/frontend/qt/frontend_settings.go index 0669ee8..cbd1b7e 100644 --- a/internal/frontend/qt/frontend_settings.go +++ b/internal/frontend/qt/frontend_settings.go @@ -24,11 +24,11 @@ import ( "runtime" "time" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/frontend/clientconfig" - "github.com/ProtonMail/proton-bridge/internal/frontend/theme" - "github.com/ProtonMail/proton-bridge/pkg/keychain" - "github.com/ProtonMail/proton-bridge/pkg/ports" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/clientconfig" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/theme" + "github.com/ProtonMail/proton-bridge/v2/pkg/keychain" + "github.com/ProtonMail/proton-bridge/v2/pkg/ports" "github.com/therecipe/qt/core" ) diff --git a/internal/frontend/qt/frontend_updates.go b/internal/frontend/qt/frontend_updates.go index 3c606c6..71fa271 100644 --- a/internal/frontend/qt/frontend_updates.go +++ b/internal/frontend/qt/frontend_updates.go @@ -23,8 +23,8 @@ package qt import ( "sync" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" "github.com/pkg/errors" ) diff --git a/internal/frontend/qt/frontend_users.go b/internal/frontend/qt/frontend_users.go index 42e48c8..b5ee920 100644 --- a/internal/frontend/qt/frontend_users.go +++ b/internal/frontend/qt/frontend_users.go @@ -25,9 +25,9 @@ import ( "encoding/base64" "time" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/internal/users" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/users" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) func (f *FrontendQt) login(username, password string) { diff --git a/internal/frontend/qt/helpers.go b/internal/frontend/qt/helpers.go index e5a7e40..25a56db 100644 --- a/internal/frontend/qt/helpers.go +++ b/internal/frontend/qt/helpers.go @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with Proton Mail Bridge. If not, see . +//go:build build_qt // +build build_qt package qt diff --git a/internal/frontend/qt/log/log.go b/internal/frontend/qt/log/log.go index 815dc69..0c18043 100644 --- a/internal/frontend/qt/log/log.go +++ b/internal/frontend/qt/log/log.go @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with Proton Mail Bridge. If not, see . +//go:build build_qt // +build build_qt // Package log redirects QML logs to logrus diff --git a/internal/frontend/qt/qml_backend.go b/internal/frontend/qt/qml_backend.go index b3bc9f6..6701b7e 100644 --- a/internal/frontend/qt/qml_backend.go +++ b/internal/frontend/qt/qml_backend.go @@ -23,9 +23,9 @@ package qt import ( "runtime" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - dockIcon "github.com/ProtonMail/proton-bridge/internal/frontend/qt/dockicon" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + dockIcon "github.com/ProtonMail/proton-bridge/v2/internal/frontend/qt/dockicon" "github.com/therecipe/qt/core" ) diff --git a/internal/frontend/qt/qml_users.go b/internal/frontend/qt/qml_users.go index 79b2cc4..4f2a881 100644 --- a/internal/frontend/qt/qml_users.go +++ b/internal/frontend/qt/qml_users.go @@ -23,8 +23,8 @@ package qt import ( "sync" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/internal/frontend/types" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/frontend/types" "github.com/therecipe/qt/core" ) diff --git a/internal/frontend/theme/detect_windows.go b/internal/frontend/theme/detect_windows.go index e54a59a..3c40abb 100644 --- a/internal/frontend/theme/detect_windows.go +++ b/internal/frontend/theme/detect_windows.go @@ -32,7 +32,6 @@ func detectSystemTheme() Theme { `SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize`, registry.QUERY_VALUE, ) - if err != nil { log.WithError(err).Error("Not able to open register") return Light diff --git a/internal/frontend/types/types.go b/internal/frontend/types/types.go index e179b61..0a125ac 100644 --- a/internal/frontend/types/types.go +++ b/internal/frontend/types/types.go @@ -19,9 +19,9 @@ package types import ( - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/updater" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) // PanicHandler is an interface of a type that can be used to gracefully handle panics which occur. diff --git a/internal/imap/backend.go b/internal/imap/backend.go index cff6c88..6b5cc1d 100644 --- a/internal/imap/backend.go +++ b/internal/imap/backend.go @@ -36,11 +36,11 @@ import ( "sync" "time" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/internal/users" - "github.com/ProtonMail/proton-bridge/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/users" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" "github.com/emersion/go-imap" goIMAPBackend "github.com/emersion/go-imap/backend" ) diff --git a/internal/imap/bridge.go b/internal/imap/bridge.go index bbbaa1d..c6e76f5 100644 --- a/internal/imap/bridge.go +++ b/internal/imap/bridge.go @@ -18,9 +18,9 @@ package imap import ( - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/users" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/users" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) type cacheProvider interface { diff --git a/internal/imap/mailbox.go b/internal/imap/mailbox.go index 3bbcc73..4e52f8f 100644 --- a/internal/imap/mailbox.go +++ b/internal/imap/mailbox.go @@ -21,8 +21,8 @@ import ( "strings" "time" - "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/emersion/go-imap" "github.com/sirupsen/logrus" ) diff --git a/internal/imap/mailbox_append.go b/internal/imap/mailbox_append.go index fdb5ea9..e772a4d 100644 --- a/internal/imap/mailbox_append.go +++ b/internal/imap/mailbox_append.go @@ -27,9 +27,9 @@ import ( "time" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/internal/imap/uidplus" - "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/imap/uidplus" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/emersion/go-imap" "github.com/emersion/go-message/textproto" "github.com/pkg/errors" @@ -177,7 +177,7 @@ func (im *imapMailbox) labelExistingMessage(msg storeMessageProvider) error { // // If the message is moved from any folder, the moment when expunge happens on source we will move message trash unless we move it to archive. // If the message is already in Archive we should not call API at all. // Otherwise the message is already in All mail, Return OK. - var storeMBox = im.storeMailbox + storeMBox := im.storeMailbox if pmapi.AllMailLabel == storeMBox.LabelID() { if msg.Message().HasLabelID(pmapi.ArchiveLabel) { return uidplus.AppendResponse(storeMBox.UIDValidity(), storeMBox.GetUIDList([]string{msg.ID()})) @@ -238,7 +238,7 @@ func (im *imapMailbox) importMessage(kr *crypto.KeyRing, hdr textproto.Header, b return err } - var targetMailbox = im.storeMailbox + targetMailbox := im.storeMailbox if targetMailbox.LabelID() == pmapi.AllMailLabel { // Importing mail in directly into All Mail is not allowed. Instead we redirect the import to Archive // The mail will automatically appear in All mail. The appends response still reports that the mail was diff --git a/internal/imap/mailbox_fetch.go b/internal/imap/mailbox_fetch.go index b3d5692..f82aecb 100644 --- a/internal/imap/mailbox_fetch.go +++ b/internal/imap/mailbox_fetch.go @@ -20,7 +20,7 @@ package imap import ( "bytes" - "github.com/ProtonMail/proton-bridge/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" "github.com/emersion/go-imap" "github.com/pkg/errors" ) diff --git a/internal/imap/mailbox_header.go b/internal/imap/mailbox_header.go index dbcba18..f446168 100644 --- a/internal/imap/mailbox_header.go +++ b/internal/imap/mailbox_header.go @@ -21,7 +21,7 @@ import ( "bytes" "strings" - "github.com/ProtonMail/proton-bridge/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" "github.com/emersion/go-imap" ) diff --git a/internal/imap/mailbox_messages.go b/internal/imap/mailbox_messages.go index 18be95a..34e4126 100644 --- a/internal/imap/mailbox_messages.go +++ b/internal/imap/mailbox_messages.go @@ -24,10 +24,10 @@ import ( "sync" "time" - "github.com/ProtonMail/proton-bridge/internal/imap/uidplus" - "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/parallel" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/imap/uidplus" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/parallel" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/emersion/go-imap" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/internal/imap/mailbox_root.go b/internal/imap/mailbox_root.go index e36fa4c..8736781 100644 --- a/internal/imap/mailbox_root.go +++ b/internal/imap/mailbox_root.go @@ -21,7 +21,7 @@ import ( "errors" "time" - "github.com/ProtonMail/proton-bridge/internal/store" + "github.com/ProtonMail/proton-bridge/v2/internal/store" imap "github.com/emersion/go-imap" ) diff --git a/internal/imap/server.go b/internal/imap/server.go index 3839f16..a52ad62 100644 --- a/internal/imap/server.go +++ b/internal/imap/server.go @@ -26,13 +26,13 @@ import ( "time" imapid "github.com/ProtonMail/go-imap-id" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/useragent" - "github.com/ProtonMail/proton-bridge/internal/imap/id" - "github.com/ProtonMail/proton-bridge/internal/imap/idle" - "github.com/ProtonMail/proton-bridge/internal/imap/uidplus" - "github.com/ProtonMail/proton-bridge/internal/serverutil" - "github.com/ProtonMail/proton-bridge/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/useragent" + "github.com/ProtonMail/proton-bridge/v2/internal/imap/id" + "github.com/ProtonMail/proton-bridge/v2/internal/imap/idle" + "github.com/ProtonMail/proton-bridge/v2/internal/imap/uidplus" + "github.com/ProtonMail/proton-bridge/v2/internal/serverutil" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" "github.com/emersion/go-imap" imapappendlimit "github.com/emersion/go-imap-appendlimit" imapmove "github.com/emersion/go-imap-move" diff --git a/internal/imap/store.go b/internal/imap/store.go index 776b52b..d91a420 100644 --- a/internal/imap/store.go +++ b/internal/imap/store.go @@ -23,10 +23,10 @@ import ( "net/textproto" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/internal/imap/uidplus" - "github.com/ProtonMail/proton-bridge/internal/store" - pkgMsg "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/imap/uidplus" + "github.com/ProtonMail/proton-bridge/v2/internal/store" + pkgMsg "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) type storeUserProvider interface { diff --git a/internal/imap/updates.go b/internal/imap/updates.go index b3c9228..9f8d262 100644 --- a/internal/imap/updates.go +++ b/internal/imap/updates.go @@ -22,9 +22,9 @@ import ( "sync" "time" - "github.com/ProtonMail/proton-bridge/internal/store" - "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/store" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" imap "github.com/emersion/go-imap" goIMAPBackend "github.com/emersion/go-imap/backend" "github.com/sirupsen/logrus" diff --git a/internal/imap/user.go b/internal/imap/user.go index b250632..b4fe4d9 100644 --- a/internal/imap/user.go +++ b/internal/imap/user.go @@ -22,7 +22,7 @@ import ( "strings" "sync" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" imapquota "github.com/emersion/go-imap-quota" goIMAPBackend "github.com/emersion/go-imap/backend" ) diff --git a/internal/locations/locations.go b/internal/locations/locations.go index 702d868..70d54f0 100644 --- a/internal/locations/locations.go +++ b/internal/locations/locations.go @@ -24,7 +24,7 @@ import ( "path/filepath" "runtime" - "github.com/ProtonMail/proton-bridge/pkg/files" + "github.com/ProtonMail/proton-bridge/v2/pkg/files" "github.com/sirupsen/logrus" ) @@ -107,13 +107,13 @@ func (l *Locations) getLicenseFilePath() string { // GetDependencyLicensesLink returns link to page listing dependencies. func (l *Locations) GetDependencyLicensesLink() string { - return "https://github.com/ProtonMail/proton-bridge/blob/master/COPYING_NOTES.md#dependencies" + return "https://github.com/ProtonMail/proton-bridge/v2/blob/master/COPYING_NOTES.md#dependencies" } // ProvideSettingsPath returns a location for user settings (e.g. ~/.config//). // It creates it if it doesn't already exist. func (l *Locations) ProvideSettingsPath() (string, error) { - if err := os.MkdirAll(l.getSettingsPath(), 0700); err != nil { + if err := os.MkdirAll(l.getSettingsPath(), 0o700); err != nil { return "", err } @@ -123,7 +123,7 @@ func (l *Locations) ProvideSettingsPath() (string, error) { // ProvideLogsPath returns a location for user logs (e.g. ~/.cache///logs). // It creates it if it doesn't already exist. func (l *Locations) ProvideLogsPath() (string, error) { - if err := os.MkdirAll(l.getLogsPath(), 0700); err != nil { + if err := os.MkdirAll(l.getLogsPath(), 0o700); err != nil { return "", err } @@ -133,7 +133,7 @@ func (l *Locations) ProvideLogsPath() (string, error) { // ProvideCachePath returns a location for user cache dirs (e.g. ~/.config///cache). // It creates it if it doesn't already exist. func (l *Locations) ProvideCachePath() (string, error) { - if err := os.MkdirAll(l.getCachePath(), 0700); err != nil { + if err := os.MkdirAll(l.getCachePath(), 0o700); err != nil { return "", err } @@ -148,7 +148,7 @@ func (l *Locations) GetOldCachePath() string { // ProvideUpdatesPath returns a location for update files (e.g. ~/.cache///updates). // It creates it if it doesn't already exist. func (l *Locations) ProvideUpdatesPath() (string, error) { - if err := os.MkdirAll(l.getUpdatesPath(), 0700); err != nil { + if err := os.MkdirAll(l.getUpdatesPath(), 0o700); err != nil { return "", err } diff --git a/internal/locations/locations_test.go b/internal/locations/locations_test.go index 6893462..7c7c7a7 100644 --- a/internal/locations/locations_test.go +++ b/internal/locations/locations_test.go @@ -161,7 +161,7 @@ func newTestLocations(t *testing.T) *Locations { func createFilesInDir(t *testing.T, dir string, files ...string) { for _, target := range files { - require.NoError(t, os.MkdirAll(filepath.Dir(filepath.Join(dir, target)), 0700)) + require.NoError(t, os.MkdirAll(filepath.Dir(filepath.Join(dir, target)), 0o700)) f, err := os.Create(filepath.Join(dir, target)) require.NoError(t, err) diff --git a/internal/logging/crash.go b/internal/logging/crash.go index cca9ca3..904f208 100644 --- a/internal/logging/crash.go +++ b/internal/logging/crash.go @@ -25,8 +25,8 @@ import ( "runtime/pprof" "time" - "github.com/ProtonMail/proton-bridge/internal/constants" - "github.com/ProtonMail/proton-bridge/internal/crash" + "github.com/ProtonMail/proton-bridge/v2/internal/constants" + "github.com/ProtonMail/proton-bridge/v2/internal/crash" "github.com/sirupsen/logrus" ) @@ -34,7 +34,7 @@ func DumpStackTrace(logsPath string) crash.RecoveryAction { return func(r interface{}) error { file := filepath.Join(logsPath, getStackTraceName(constants.Version, constants.Revision)) - f, err := os.OpenFile(filepath.Clean(file), os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0600) + f, err := os.OpenFile(filepath.Clean(file), os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0o600) if err != nil { return err } diff --git a/internal/logging/logging.go b/internal/logging/logging.go index c22eea3..87d2b5c 100644 --- a/internal/logging/logging.go +++ b/internal/logging/logging.go @@ -25,7 +25,7 @@ import ( "regexp" "time" - "github.com/ProtonMail/proton-bridge/internal/constants" + "github.com/ProtonMail/proton-bridge/v2/internal/constants" "github.com/sirupsen/logrus" "github.com/sirupsen/logrus/hooks/writer" ) diff --git a/internal/logging/logging_test.go b/internal/logging/logging_test.go index a05f4f2..291b632 100644 --- a/internal/logging/logging_test.go +++ b/internal/logging/logging_test.go @@ -30,11 +30,11 @@ func TestClearLogs(t *testing.T) { dir, err := ioutil.TempDir("", "clear-logs-test") require.NoError(t, err) - require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "other.log"), []byte("Hello"), 0755)) - require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "v1_10.log"), []byte("Hello"), 0755)) - require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "v1_11.log"), []byte("Hello"), 0755)) - require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "v2_12.log"), []byte("Hello"), 0755)) - require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "v2_13.log"), []byte("Hello"), 0755)) + require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "other.log"), []byte("Hello"), 0o755)) + require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "v1_10.log"), []byte("Hello"), 0o755)) + require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "v1_11.log"), []byte("Hello"), 0o755)) + require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "v2_12.log"), []byte("Hello"), 0o755)) + require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "v2_13.log"), []byte("Hello"), 0o755)) require.NoError(t, clearLogs(dir, 3, 0)) checkFileNames(t, dir, []string{ diff --git a/internal/sentry/reporter.go b/internal/sentry/reporter.go index 69a8bff..1aeb876 100644 --- a/internal/sentry/reporter.go +++ b/internal/sentry/reporter.go @@ -25,8 +25,8 @@ import ( "runtime" "time" - "github.com/ProtonMail/proton-bridge/internal/constants" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/constants" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/getsentry/sentry-go" "github.com/sirupsen/logrus" ) diff --git a/internal/sentry/reporter_test.go b/internal/sentry/reporter_test.go index da38ff5..36e1768 100644 --- a/internal/sentry/reporter_test.go +++ b/internal/sentry/reporter_test.go @@ -35,30 +35,30 @@ func TestSkipDuringUnwind(t *testing.T) { }() wantSkippedFunctions := []string{ - "github.com/ProtonMail/proton-bridge/internal/sentry.TestSkipDuringUnwind", - "github.com/ProtonMail/proton-bridge/internal/sentry.TestSkipDuringUnwind.func1", + "github.com/ProtonMail/proton-bridge/v2/internal/sentry.TestSkipDuringUnwind", + "github.com/ProtonMail/proton-bridge/v2/internal/sentry.TestSkipDuringUnwind.func1", } r.Equal(t, wantSkippedFunctions, skippedFunctions) } func TestFilterOutPanicHandlers(t *testing.T) { skippedFunctions = []string{ - "github.com/ProtonMail/proton-bridge/pkg/config.(*PanicHandler).HandlePanic", - "github.com/ProtonMail/proton-bridge/pkg/config.HandlePanic", - "github.com/ProtonMail/proton-bridge/internal/sentry.ReportSentryCrash", - "github.com/ProtonMail/proton-bridge/internal/sentry.ReportSentryCrash.func1", + "github.com/ProtonMail/proton-bridge/v2/pkg/config.(*PanicHandler).HandlePanic", + "github.com/ProtonMail/proton-bridge/v2/pkg/config.HandlePanic", + "github.com/ProtonMail/proton-bridge/v2/internal/sentry.ReportSentryCrash", + "github.com/ProtonMail/proton-bridge/v2/internal/sentry.ReportSentryCrash.func1", } frames := []sentry.Frame{ - {Module: "github.com/ProtonMail/proton-bridge/internal/cmd", Function: "main"}, + {Module: "github.com/ProtonMail/proton-bridge/v2/internal/cmd", Function: "main"}, {Module: "github.com/urfave/cli", Function: "(*App).Run"}, - {Module: "github.com/ProtonMail/proton-bridge/internal/cmd", Function: "RegisterHandlePanic"}, + {Module: "github.com/ProtonMail/proton-bridge/v2/internal/cmd", Function: "RegisterHandlePanic"}, {Module: "github.com/ProtonMail/pkg", Function: "HandlePanic"}, {Module: "main", Function: "run"}, - {Module: "github.com/ProtonMail/proton-bridge/pkg/config", Function: "(*PanicHandler).HandlePanic"}, - {Module: "github.com/ProtonMail/proton-bridge/pkg/config", Function: "HandlePanic"}, - {Module: "github.com/ProtonMail/proton-bridge/internal/sentry", Function: "ReportSentryCrash"}, - {Module: "github.com/ProtonMail/proton-bridge/internal/sentry", Function: "ReportSentryCrash.func1"}, + {Module: "github.com/ProtonMail/proton-bridge/v2/pkg/config", Function: "(*PanicHandler).HandlePanic"}, + {Module: "github.com/ProtonMail/proton-bridge/v2/pkg/config", Function: "HandlePanic"}, + {Module: "github.com/ProtonMail/proton-bridge/v2/internal/sentry", Function: "ReportSentryCrash"}, + {Module: "github.com/ProtonMail/proton-bridge/v2/internal/sentry", Function: "ReportSentryCrash.func1"}, } gotFrames := filterOutPanicHandlers(frames) diff --git a/internal/serverutil/controller.go b/internal/serverutil/controller.go index 1f6b622..3155ba3 100644 --- a/internal/serverutil/controller.go +++ b/internal/serverutil/controller.go @@ -22,8 +22,8 @@ import ( "fmt" "net" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" "github.com/sirupsen/logrus" ) diff --git a/internal/serverutil/test/controller_test.go b/internal/serverutil/test/controller_test.go index 2b8a119..22986fc 100644 --- a/internal/serverutil/test/controller_test.go +++ b/internal/serverutil/test/controller_test.go @@ -22,9 +22,9 @@ import ( "testing" "time" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/internal/serverutil" - "github.com/ProtonMail/proton-bridge/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/serverutil" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" "github.com/stretchr/testify/require" ) diff --git a/internal/serverutil/test/server.go b/internal/serverutil/test/server.go index 6788c39..246dc57 100644 --- a/internal/serverutil/test/server.go +++ b/internal/serverutil/test/server.go @@ -24,8 +24,8 @@ import ( "net" "net/http" - "github.com/ProtonMail/proton-bridge/internal/serverutil" - "github.com/ProtonMail/proton-bridge/pkg/ports" + "github.com/ProtonMail/proton-bridge/v2/internal/serverutil" + "github.com/ProtonMail/proton-bridge/v2/pkg/ports" ) func newTestServer() *testServer { diff --git a/internal/smtp/backend.go b/internal/smtp/backend.go index 4f5cce7..056378d 100644 --- a/internal/smtp/backend.go +++ b/internal/smtp/backend.go @@ -21,11 +21,11 @@ import ( "strings" "time" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/users" - "github.com/ProtonMail/proton-bridge/pkg/confirmer" - "github.com/ProtonMail/proton-bridge/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/users" + "github.com/ProtonMail/proton-bridge/v2/pkg/confirmer" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" goSMTPBackend "github.com/emersion/go-smtp" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/internal/smtp/bridge.go b/internal/smtp/bridge.go index a5cc2c8..f384539 100644 --- a/internal/smtp/bridge.go +++ b/internal/smtp/bridge.go @@ -18,9 +18,9 @@ package smtp import ( - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/users" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/users" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) type bridger interface { diff --git a/internal/smtp/dump_qa.go b/internal/smtp/dump_qa.go index edf3360..27f3a67 100644 --- a/internal/smtp/dump_qa.go +++ b/internal/smtp/dump_qa.go @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with Proton Mail Bridge. If not, see . +//go:build build_qa // +build build_qa package smtp @@ -38,7 +39,7 @@ func dumpMessageData(b []byte, subject string) { path := filepath.Join(home, "bridge-qa") - if err := os.MkdirAll(path, 0700); err != nil { + if err := os.MkdirAll(path, 0o700); err != nil { logrus.WithError(err).Error("Failed to dump raw message data") return } @@ -50,7 +51,7 @@ func dumpMessageData(b []byte, subject string) { if err := ioutil.WriteFile( filepath.Join(path, fmt.Sprintf("%v-%v.eml", subject, time.Now().Unix())), b, - 0600, + 0o600, ); err != nil { logrus.WithError(err).Error("Failed to dump raw message data") return diff --git a/internal/smtp/preferences.go b/internal/smtp/preferences.go index 6e891e5..4862222 100644 --- a/internal/smtp/preferences.go +++ b/internal/smtp/preferences.go @@ -19,7 +19,7 @@ package smtp import ( "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" ) diff --git a/internal/smtp/preferences_test.go b/internal/smtp/preferences_test.go index ef94994..4e88052 100644 --- a/internal/smtp/preferences_test.go +++ b/internal/smtp/preferences_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/internal/smtp/send_recorder.go b/internal/smtp/send_recorder.go index e6de045..93d9d2a 100644 --- a/internal/smtp/send_recorder.go +++ b/internal/smtp/send_recorder.go @@ -25,7 +25,7 @@ import ( "sync" "time" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) type messageGetter interface { diff --git a/internal/smtp/send_recorder_test.go b/internal/smtp/send_recorder_test.go index 5a214de..375c7ea 100644 --- a/internal/smtp/send_recorder_test.go +++ b/internal/smtp/send_recorder_test.go @@ -25,7 +25,7 @@ import ( "testing" "time" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/stretchr/testify/assert" ) diff --git a/internal/smtp/server.go b/internal/smtp/server.go index b4115a2..cb5485e 100644 --- a/internal/smtp/server.go +++ b/internal/smtp/server.go @@ -23,9 +23,9 @@ import ( "io" "net" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/serverutil" - "github.com/ProtonMail/proton-bridge/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/serverutil" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" "github.com/emersion/go-sasl" goSMTP "github.com/emersion/go-smtp" ) diff --git a/internal/smtp/smtp.go b/internal/smtp/smtp.go index 443ef34..5df423c 100644 --- a/internal/smtp/smtp.go +++ b/internal/smtp/smtp.go @@ -20,6 +20,4 @@ package smtp import "github.com/sirupsen/logrus" -var ( - log = logrus.WithField("pkg", "smtp") //nolint:gochecknoglobals -) +var log = logrus.WithField("pkg", "smtp") //nolint:gochecknoglobals diff --git a/internal/smtp/store.go b/internal/smtp/store.go index 81d6eb3..e1ae391 100644 --- a/internal/smtp/store.go +++ b/internal/smtp/store.go @@ -21,7 +21,7 @@ import ( "io" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) type storeUserProvider interface { diff --git a/internal/smtp/user.go b/internal/smtp/user.go index e59a2f6..ec36ee5 100644 --- a/internal/smtp/user.go +++ b/internal/smtp/user.go @@ -32,11 +32,11 @@ import ( "time" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/pkg/listener" - pkgMsg "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/message/parser" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" + pkgMsg "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/message/parser" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" goSMTPBackend "github.com/emersion/go-smtp" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/internal/smtp/vcard_tools.go b/internal/smtp/vcard_tools.go index cc4afd7..b5b6ece 100644 --- a/internal/smtp/vcard_tools.go +++ b/internal/smtp/vcard_tools.go @@ -23,7 +23,7 @@ import ( "strings" "github.com/ProtonMail/go-vcard" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) type ContactMetadata struct { diff --git a/internal/store/address.go b/internal/store/address.go index 4a49287..b6d083a 100644 --- a/internal/store/address.go +++ b/internal/store/address.go @@ -18,7 +18,7 @@ package store import ( - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/sirupsen/logrus" bolt "go.etcd.io/bbolt" ) diff --git a/internal/store/address_mailbox.go b/internal/store/address_mailbox.go index ffd62c7..06692ee 100644 --- a/internal/store/address_mailbox.go +++ b/internal/store/address_mailbox.go @@ -20,7 +20,7 @@ package store import ( "fmt" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) // ListMailboxes returns all mailboxes. diff --git a/internal/store/address_message.go b/internal/store/address_message.go index 0cdbf15..fc69e48 100644 --- a/internal/store/address_message.go +++ b/internal/store/address_message.go @@ -18,7 +18,7 @@ package store import ( - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" bolt "go.etcd.io/bbolt" ) diff --git a/internal/store/cache.go b/internal/store/cache.go index fd18d46..a2b907c 100644 --- a/internal/store/cache.go +++ b/internal/store/cache.go @@ -21,9 +21,9 @@ import ( "context" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/internal/store/cache" - "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/store/cache" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" bolt "go.etcd.io/bbolt" ) diff --git a/internal/store/cache/disk.go b/internal/store/cache/disk.go index 246857c..5f9992e 100644 --- a/internal/store/cache/disk.go +++ b/internal/store/cache/disk.go @@ -29,12 +29,14 @@ import ( "path/filepath" "sync" - "github.com/ProtonMail/proton-bridge/pkg/semaphore" + "github.com/ProtonMail/proton-bridge/v2/pkg/semaphore" "github.com/ricochet2200/go-disk-usage/du" ) -var ErrMsgCorrupted = errors.New("ecrypted file was corrupted") -var ErrLowSpace = errors.New("not enough free space left on device") +var ( + ErrMsgCorrupted = errors.New("ecrypted file was corrupted") + ErrLowSpace = errors.New("not enough free space left on device") +) // IsOnDiskCache will return true if Cache is type of onDiskCache. func IsOnDiskCache(c Cache) bool { @@ -58,7 +60,7 @@ type onDiskCache struct { } func NewOnDiskCache(path string, cmp Compressor, opts Options) (Cache, error) { - if err := os.MkdirAll(path, 0700); err != nil { + if err := os.MkdirAll(path, 0o700); err != nil { return nil, err } @@ -114,7 +116,7 @@ func (c *onDiskCache) Unlock(userID string, passphrase []byte) error { return err } - if err := os.MkdirAll(c.getUserPath(userID), 0700); err != nil { + if err := os.MkdirAll(c.getUserPath(userID), 0o700); err != nil { return err } @@ -239,7 +241,7 @@ func (c *onDiskCache) writeFile(path string, b []byte) error { defer c.update() // NOTE(GODT-1158): What happens when this fails? Should be fixed eventually. - return ioutil.WriteFile(filepath.Clean(path), b, 0600) + return ioutil.WriteFile(filepath.Clean(path), b, 0o600) } func (c *onDiskCache) hasSpace(size int) bool { diff --git a/internal/store/cache_test.go b/internal/store/cache_test.go index c25f4ce..6ff67ce 100644 --- a/internal/store/cache_test.go +++ b/internal/store/cache_test.go @@ -20,7 +20,7 @@ package store import ( "testing" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" ) diff --git a/internal/store/cache_watcher.go b/internal/store/cache_watcher.go index 10faa84..fd11977 100644 --- a/internal/store/cache_watcher.go +++ b/internal/store/cache_watcher.go @@ -21,7 +21,7 @@ import ( "context" "time" - "github.com/ProtonMail/proton-bridge/internal/store/cache" + "github.com/ProtonMail/proton-bridge/v2/internal/store/cache" ) func (store *Store) StartWatcher() { diff --git a/internal/store/cache_worker_test.go b/internal/store/cache_worker_test.go index 73030d7..31a2186 100644 --- a/internal/store/cache_worker_test.go +++ b/internal/store/cache_worker_test.go @@ -20,7 +20,7 @@ package store import ( "testing" - storemocks "github.com/ProtonMail/proton-bridge/internal/store/mocks" + storemocks "github.com/ProtonMail/proton-bridge/v2/internal/store/mocks" "github.com/golang/mock/gomock" "github.com/pkg/errors" ) diff --git a/internal/store/change.go b/internal/store/change.go index 8f7facd..9045c25 100644 --- a/internal/store/change.go +++ b/internal/store/change.go @@ -18,7 +18,7 @@ package store import ( - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) type ChangeNotifier interface { diff --git a/internal/store/change_test.go b/internal/store/change_test.go index 3d543a7..d2874de 100644 --- a/internal/store/change_test.go +++ b/internal/store/change_test.go @@ -20,7 +20,7 @@ package store import ( "testing" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" ) diff --git a/internal/store/event_loop.go b/internal/store/event_loop.go index 2db0789..54c76dd 100644 --- a/internal/store/event_loop.go +++ b/internal/store/event_loop.go @@ -22,9 +22,9 @@ import ( "math/rand" "time" - bridgeEvents "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/pkg/listener" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + bridgeEvents "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/internal/store/event_loop_test.go b/internal/store/event_loop_test.go index 281c136..7db90e7 100644 --- a/internal/store/event_loop_test.go +++ b/internal/store/event_loop_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" ) diff --git a/internal/store/mailbox.go b/internal/store/mailbox.go index 1929b02..79dd7a9 100644 --- a/internal/store/mailbox.go +++ b/internal/store/mailbox.go @@ -23,7 +23,7 @@ import ( "strings" "sync/atomic" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/sirupsen/logrus" bolt "go.etcd.io/bbolt" ) diff --git a/internal/store/mailbox_counts.go b/internal/store/mailbox_counts.go index 668f6a6..e2ad27b 100644 --- a/internal/store/mailbox_counts.go +++ b/internal/store/mailbox_counts.go @@ -22,7 +22,7 @@ import ( "encoding/json" "sort" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" bolt "go.etcd.io/bbolt" ) diff --git a/internal/store/mailbox_counts_test.go b/internal/store/mailbox_counts_test.go index 159b2d9..eb07bb8 100644 --- a/internal/store/mailbox_counts_test.go +++ b/internal/store/mailbox_counts_test.go @@ -20,7 +20,7 @@ package store import ( "testing" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" a "github.com/stretchr/testify/assert" ) diff --git a/internal/store/mailbox_ids.go b/internal/store/mailbox_ids.go index 466a4b4..658d68d 100644 --- a/internal/store/mailbox_ids.go +++ b/internal/store/mailbox_ids.go @@ -24,7 +24,7 @@ import ( "regexp" "strings" - "github.com/ProtonMail/proton-bridge/internal/imap/uidplus" + "github.com/ProtonMail/proton-bridge/v2/internal/imap/uidplus" "github.com/pkg/errors" bolt "go.etcd.io/bbolt" ) diff --git a/internal/store/mailbox_ids_test.go b/internal/store/mailbox_ids_test.go index 221371f..0a3a5eb 100644 --- a/internal/store/mailbox_ids_test.go +++ b/internal/store/mailbox_ids_test.go @@ -21,7 +21,7 @@ import ( "net/mail" "testing" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" a "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/internal/store/mailbox_message.go b/internal/store/mailbox_message.go index dc3fcf6..1c69ddd 100644 --- a/internal/store/mailbox_message.go +++ b/internal/store/mailbox_message.go @@ -18,7 +18,7 @@ package store import ( - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" "github.com/sirupsen/logrus" bolt "go.etcd.io/bbolt" diff --git a/internal/store/message.go b/internal/store/message.go index be2fff7..ac8c7ec 100644 --- a/internal/store/message.go +++ b/internal/store/message.go @@ -22,8 +22,8 @@ import ( "bytes" "net/textproto" - pkgMsg "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + pkgMsg "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" bolt "go.etcd.io/bbolt" ) diff --git a/internal/store/mocks/mocks.go b/internal/store/mocks/mocks.go index e0e8c6a..39cef92 100644 --- a/internal/store/mocks/mocks.go +++ b/internal/store/mocks/mocks.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ProtonMail/proton-bridge/internal/store (interfaces: PanicHandler,BridgeUser,ChangeNotifier,Storer) +// Source: github.com/ProtonMail/proton-bridge/v2/internal/store (interfaces: PanicHandler,BridgeUser,ChangeNotifier,Storer) // Package mocks is a generated GoMock package. package mocks @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - pmapi "github.com/ProtonMail/proton-bridge/pkg/pmapi" + pmapi "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" gomock "github.com/golang/mock/gomock" ) diff --git a/internal/store/mocks/utils_mocks.go b/internal/store/mocks/utils_mocks.go index 2b881f1..e60e9f0 100644 --- a/internal/store/mocks/utils_mocks.go +++ b/internal/store/mocks/utils_mocks.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ProtonMail/proton-bridge/pkg/listener (interfaces: Listener) +// Source: github.com/ProtonMail/proton-bridge/v2/pkg/listener (interfaces: Listener) // Package mocks is a generated GoMock package. package mocks diff --git a/internal/store/store.go b/internal/store/store.go index 3c3280b..d8a7eb6 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -25,12 +25,12 @@ import ( "sync" "time" - "github.com/ProtonMail/proton-bridge/internal/sentry" - "github.com/ProtonMail/proton-bridge/internal/store/cache" - "github.com/ProtonMail/proton-bridge/pkg/listener" - "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - "github.com/ProtonMail/proton-bridge/pkg/pool" + "github.com/ProtonMail/proton-bridge/v2/internal/sentry" + "github.com/ProtonMail/proton-bridge/v2/internal/store/cache" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pool" "github.com/hashicorp/go-multierror" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -223,7 +223,7 @@ func openBoltDatabase(filePath string) (db *bolt.DB, err error) { l := log.WithField("path", filePath) l.Debug("Opening bolt database") - if db, err = bolt.Open(filePath, 0600, &bolt.Options{Timeout: 1 * time.Second}); err != nil { + if db, err = bolt.Open(filePath, 0o600, &bolt.Options{Timeout: 1 * time.Second}); err != nil { l.WithError(err).Error("Could not open bolt database") return } diff --git a/internal/store/store_test.go b/internal/store/store_test.go index 1206ed7..b396fb9 100644 --- a/internal/store/store_test.go +++ b/internal/store/store_test.go @@ -28,12 +28,12 @@ import ( "time" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/internal/store/cache" - storemocks "github.com/ProtonMail/proton-bridge/internal/store/mocks" - "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - pmapimocks "github.com/ProtonMail/proton-bridge/pkg/pmapi/mocks" - tests "github.com/ProtonMail/proton-bridge/test" + "github.com/ProtonMail/proton-bridge/v2/internal/store/cache" + storemocks "github.com/ProtonMail/proton-bridge/v2/internal/store/mocks" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + pmapimocks "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi/mocks" + tests "github.com/ProtonMail/proton-bridge/v2/test" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" diff --git a/internal/store/store_test_exports.go b/internal/store/store_test_exports.go index 1ccd991..b955b81 100644 --- a/internal/store/store_test_exports.go +++ b/internal/store/store_test_exports.go @@ -21,7 +21,7 @@ import ( "encoding/json" "fmt" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/stretchr/testify/assert" bolt "go.etcd.io/bbolt" ) diff --git a/internal/store/sync.go b/internal/store/sync.go index 16e0677..0c5bb11 100644 --- a/internal/store/sync.go +++ b/internal/store/sync.go @@ -22,7 +22,7 @@ import ( "math" "sync" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" ) diff --git a/internal/store/sync_test.go b/internal/store/sync_test.go index 8140313..1b13778 100644 --- a/internal/store/sync_test.go +++ b/internal/store/sync_test.go @@ -24,7 +24,7 @@ import ( "sync" "testing" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/store/types.go b/internal/store/types.go index 8680284..b9469e7 100644 --- a/internal/store/types.go +++ b/internal/store/types.go @@ -20,7 +20,7 @@ package store import ( "context" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) type PanicHandler interface { diff --git a/internal/store/user_address.go b/internal/store/user_address.go index 0b94da1..72e9ce3 100644 --- a/internal/store/user_address.go +++ b/internal/store/user_address.go @@ -21,7 +21,7 @@ import ( "encoding/json" "fmt" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" bolt "go.etcd.io/bbolt" ) diff --git a/internal/store/user_address_info.go b/internal/store/user_address_info.go index c3a36ae..1a33503 100644 --- a/internal/store/user_address_info.go +++ b/internal/store/user_address_info.go @@ -21,7 +21,7 @@ import ( "encoding/json" "strings" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" bolt "go.etcd.io/bbolt" ) diff --git a/internal/store/user_mailbox.go b/internal/store/user_mailbox.go index ef8187b..a2c28e5 100644 --- a/internal/store/user_mailbox.go +++ b/internal/store/user_mailbox.go @@ -21,7 +21,7 @@ import ( "fmt" "strings" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" ) diff --git a/internal/store/user_message.go b/internal/store/user_message.go index 717402c..8ce9cec 100644 --- a/internal/store/user_message.go +++ b/internal/store/user_message.go @@ -27,8 +27,8 @@ import ( "strings" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/internal/store/cache" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/store/cache" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" "github.com/sirupsen/logrus" bolt "go.etcd.io/bbolt" @@ -43,7 +43,8 @@ func (store *Store) CreateDraft( attachmentReaders []io.Reader, attachedPublicKey, attachedPublicKeyName string, - parentID string) (*pmapi.Message, []*pmapi.Attachment, error) { + parentID string, +) (*pmapi.Message, []*pmapi.Attachment, error) { attachments := store.prepareDraftAttachments(message, attachmentReaders, attachedPublicKey, attachedPublicKeyName) if err := encryptDraft(kr, message, attachments); err != nil { @@ -90,7 +91,8 @@ func (store *Store) prepareDraftAttachments( message *pmapi.Message, attachmentReaders []io.Reader, attachedPublicKey, - attachedPublicKeyName string) []*draftAttachment { + attachedPublicKeyName string, +) []*draftAttachment { attachments := []*draftAttachment{} for idx, attachment := range message.Attachments { attachments = append(attachments, &draftAttachment{ diff --git a/internal/store/user_message_test.go b/internal/store/user_message_test.go index 679fec2..d2ee5ba 100644 --- a/internal/store/user_message_test.go +++ b/internal/store/user_message_test.go @@ -24,8 +24,8 @@ import ( "strings" "testing" - pkgMsg "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + pkgMsg "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" bolt "go.etcd.io/bbolt" diff --git a/internal/store/user_sync.go b/internal/store/user_sync.go index 0b0623b..845b2f8 100644 --- a/internal/store/user_sync.go +++ b/internal/store/user_sync.go @@ -23,15 +23,17 @@ import ( "fmt" "strconv" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" "github.com/sirupsen/logrus" bolt "go.etcd.io/bbolt" ) -const syncFinishTimeKey = "sync_state" // The original key was sync_state and we want to keep compatibility. -const syncIDRangesKey = "id_ranges" -const syncIDsToBeDeletedKey = "ids_to_be_deleted" +const ( + syncFinishTimeKey = "sync_state" // The original key was sync_state and we want to keep compatibility. + syncIDRangesKey = "id_ranges" + syncIDsToBeDeletedKey = "ids_to_be_deleted" +) // updateCountsFromServer will download and set the counts. func (store *Store) updateCountsFromServer() error { @@ -204,7 +206,6 @@ func (store *Store) loadSyncState() *syncState { return }) - if err != nil { store.log.WithError(err).Error("Failed to load sync state") } diff --git a/internal/store/user_sync_test.go b/internal/store/user_sync_test.go index ef10f64..278884f 100644 --- a/internal/store/user_sync_test.go +++ b/internal/store/user_sync_test.go @@ -21,7 +21,7 @@ import ( "sort" "testing" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/internal/transfer/mocks/mocks.go b/internal/transfer/mocks/mocks.go index 3b57b51..90a4351 100644 --- a/internal/transfer/mocks/mocks.go +++ b/internal/transfer/mocks/mocks.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ProtonMail/proton-bridge/internal/transfer (interfaces: PanicHandler,IMAPClientProvider) +// Source: github.com/ProtonMail/proton-bridge/v2/internal/transfer (interfaces: PanicHandler,IMAPClientProvider) // Package mocks is a generated GoMock package. package mocks diff --git a/internal/updater/host_qa.go b/internal/updater/host_qa.go index e6e9c09..2650a98 100644 --- a/internal/updater/host_qa.go +++ b/internal/updater/host_qa.go @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with Proton Mail Bridge. If not, see . +//go:build build_qa // +build build_qa package updater diff --git a/internal/updater/install_darwin.go b/internal/updater/install_darwin.go index a0c9d59..2ae74c8 100644 --- a/internal/updater/install_darwin.go +++ b/internal/updater/install_darwin.go @@ -25,8 +25,8 @@ import ( "path/filepath" "github.com/Masterminds/semver/v3" - "github.com/ProtonMail/proton-bridge/internal/versioner" - "github.com/ProtonMail/proton-bridge/pkg/tar" + "github.com/ProtonMail/proton-bridge/v2/internal/versioner" + "github.com/ProtonMail/proton-bridge/v2/pkg/tar" "github.com/pkg/errors" ) diff --git a/internal/updater/install_default.go b/internal/updater/install_default.go index 15f2956..ab424ef 100644 --- a/internal/updater/install_default.go +++ b/internal/updater/install_default.go @@ -24,7 +24,7 @@ import ( "io" "github.com/Masterminds/semver/v3" - "github.com/ProtonMail/proton-bridge/internal/versioner" + "github.com/ProtonMail/proton-bridge/v2/internal/versioner" ) type InstallerDefault struct { diff --git a/internal/updater/sync.go b/internal/updater/sync.go index 38b8e45..c486083 100644 --- a/internal/updater/sync.go +++ b/internal/updater/sync.go @@ -120,7 +120,7 @@ func mkdirAllClear(path string) error { if err := os.RemoveAll(path); err != nil { return err } - return os.MkdirAll(path, 0750) + return os.MkdirAll(path, 0o750) } // checksum assumes the file is a regular file and that it exists. diff --git a/internal/updater/sync_test.go b/internal/updater/sync_test.go index 522cad9..67bbcce 100644 --- a/internal/updater/sync_test.go +++ b/internal/updater/sync_test.go @@ -130,7 +130,7 @@ func createTestFolder(dirPath, dirType string) error { path := filepath.Join(dirPath, "testpath") switch dirType { case FileType: - err = ioutil.WriteFile(path, []byte("This is a test"), 0640) + err = ioutil.WriteFile(path, []byte("This is a test"), 0o640) if err != nil { return err } @@ -142,12 +142,12 @@ func createTestFolder(dirPath, dirType string) error { } case DirType: - err = os.MkdirAll(path, 0750) + err = os.MkdirAll(path, 0o750) if err != nil { return err } - err = ioutil.WriteFile(filepath.Join(path, "another_file"), []byte("This is a test"), 0640) + err = ioutil.WriteFile(filepath.Join(path, "another_file"), []byte("This is a test"), 0o640) if err != nil { return err } diff --git a/internal/updater/updater.go b/internal/updater/updater.go index fe35475..e6d0409 100644 --- a/internal/updater/updater.go +++ b/internal/updater/updater.go @@ -24,8 +24,8 @@ import ( "github.com/Masterminds/semver/v3" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/internal/updater/updater_test.go b/internal/updater/updater_test.go index ea2c91c..6b61c3d 100644 --- a/internal/updater/updater_test.go +++ b/internal/updater/updater_test.go @@ -27,9 +27,9 @@ import ( "time" "github.com/Masterminds/semver/v3" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - "github.com/ProtonMail/proton-bridge/pkg/pmapi/mocks" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi/mocks" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/users/cache.go b/internal/users/cache.go index 2d9e56f..780a4af 100644 --- a/internal/users/cache.go +++ b/internal/users/cache.go @@ -41,7 +41,7 @@ func isFolderEmpty(path string) (bool, error) { // if it is suitable (non existing, or empty and deletable) the folder is deleted. func checkFolderIsSuitableDestinationForCache(path string) error { // Ensure the parent directory exists. - if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil { + if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil { return err } @@ -87,7 +87,7 @@ func copyFolder(srcPath, dstPath string) error { return errors.New("source is not an existing folder") } - if err = os.MkdirAll(dstPath, 0700); err != nil { + if err = os.MkdirAll(dstPath, 0o700); err != nil { return err } files, err := ioutil.ReadDir(srcPath) @@ -170,7 +170,7 @@ func copyFile(srcPath, dstPath string) error { err = src.Close() }() - dst, err := os.OpenFile(filepath.Clean(dstPath), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) + dst, err := os.OpenFile(filepath.Clean(dstPath), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o600) if err != nil { return err } diff --git a/internal/users/credentials/pass_imaptest.go b/internal/users/credentials/pass_imaptest.go index 1a09531..4cf5eea 100644 --- a/internal/users/credentials/pass_imaptest.go +++ b/internal/users/credentials/pass_imaptest.go @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with Proton Mail Bridge. If not, see . +//go:build imaptest // +build imaptest package credentials diff --git a/internal/users/credentials/store.go b/internal/users/credentials/store.go index 6e0fb9d..2b4918c 100644 --- a/internal/users/credentials/store.go +++ b/internal/users/credentials/store.go @@ -24,7 +24,7 @@ import ( "sync" "time" - "github.com/ProtonMail/proton-bridge/pkg/keychain" + "github.com/ProtonMail/proton-bridge/v2/pkg/keychain" "github.com/sirupsen/logrus" ) diff --git a/internal/users/credentials/store_test.go b/internal/users/credentials/store_test.go index 0bfdf6f..1b96def 100644 --- a/internal/users/credentials/store_test.go +++ b/internal/users/credentials/store_test.go @@ -29,17 +29,19 @@ import ( r "github.com/stretchr/testify/require" ) -const testSep = "\n" -const secretFormat = "%v" + testSep + // UserID, - "%v" + testSep + // Name, - "%v" + testSep + // Emails, - "%v" + testSep + // APIToken, - "%v" + testSep + // Mailbox, - "%v" + testSep + // BridgePassword, - "%v" + testSep + // Version string - "%v" + testSep + // Timestamp, - "%v" + testSep + // IsHidden, - "%v" // IsCombinedAddressMode +const ( + testSep = "\n" + secretFormat = "%v" + testSep + // UserID, + "%v" + testSep + // Name, + "%v" + testSep + // Emails, + "%v" + testSep + // APIToken, + "%v" + testSep + // Mailbox, + "%v" + testSep + // BridgePassword, + "%v" + testSep + // Version string + "%v" + testSep + // Timestamp, + "%v" + testSep + // IsHidden, + "%v" // IsCombinedAddressMode +) // the best would be to run this test on mac, win, and linux separately diff --git a/internal/users/mocks/listener_mocks.go b/internal/users/mocks/listener_mocks.go index 2b881f1..e60e9f0 100644 --- a/internal/users/mocks/listener_mocks.go +++ b/internal/users/mocks/listener_mocks.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ProtonMail/proton-bridge/pkg/listener (interfaces: Listener) +// Source: github.com/ProtonMail/proton-bridge/v2/pkg/listener (interfaces: Listener) // Package mocks is a generated GoMock package. package mocks diff --git a/internal/users/mocks/mocks.go b/internal/users/mocks/mocks.go index 83e327d..0c69bfa 100644 --- a/internal/users/mocks/mocks.go +++ b/internal/users/mocks/mocks.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ProtonMail/proton-bridge/internal/users (interfaces: Locator,PanicHandler,CredentialsStorer,StoreMaker) +// Source: github.com/ProtonMail/proton-bridge/v2/internal/users (interfaces: Locator,PanicHandler,CredentialsStorer,StoreMaker) // Package mocks is a generated GoMock package. package mocks @@ -7,8 +7,8 @@ package mocks import ( reflect "reflect" - store "github.com/ProtonMail/proton-bridge/internal/store" - credentials "github.com/ProtonMail/proton-bridge/internal/users/credentials" + store "github.com/ProtonMail/proton-bridge/v2/internal/store" + credentials "github.com/ProtonMail/proton-bridge/v2/internal/users/credentials" gomock "github.com/golang/mock/gomock" ) diff --git a/internal/users/types.go b/internal/users/types.go index 489cac0..ce33734 100644 --- a/internal/users/types.go +++ b/internal/users/types.go @@ -18,8 +18,8 @@ package users import ( - "github.com/ProtonMail/proton-bridge/internal/store" - "github.com/ProtonMail/proton-bridge/internal/users/credentials" + "github.com/ProtonMail/proton-bridge/v2/internal/store" + "github.com/ProtonMail/proton-bridge/v2/internal/users/credentials" ) type Locator interface { diff --git a/internal/users/user.go b/internal/users/user.go index f8c5e91..70bee32 100644 --- a/internal/users/user.go +++ b/internal/users/user.go @@ -23,11 +23,11 @@ import ( "strings" "sync" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/internal/store" - "github.com/ProtonMail/proton-bridge/internal/users/credentials" - "github.com/ProtonMail/proton-bridge/pkg/listener" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/store" + "github.com/ProtonMail/proton-bridge/v2/internal/users/credentials" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/internal/users/user_credentials_test.go b/internal/users/user_credentials_test.go index 8fe8c7d..5b70fd1 100644 --- a/internal/users/user_credentials_test.go +++ b/internal/users/user_credentials_test.go @@ -21,8 +21,8 @@ import ( "context" "testing" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" gomock "github.com/golang/mock/gomock" "github.com/pkg/errors" r "github.com/stretchr/testify/require" diff --git a/internal/users/user_new_test.go b/internal/users/user_new_test.go index d1921bb..8f20379 100644 --- a/internal/users/user_new_test.go +++ b/internal/users/user_new_test.go @@ -21,9 +21,9 @@ import ( "errors" "testing" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/internal/users/credentials" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/users/credentials" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" gomock "github.com/golang/mock/gomock" r "github.com/stretchr/testify/require" ) diff --git a/internal/users/users.go b/internal/users/users.go index 0b6285e..450ca23 100644 --- a/internal/users/users.go +++ b/internal/users/users.go @@ -24,12 +24,12 @@ import ( "sync" "time" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/internal/metrics" - "github.com/ProtonMail/proton-bridge/internal/users/credentials" - "github.com/ProtonMail/proton-bridge/pkg/keychain" - "github.com/ProtonMail/proton-bridge/pkg/listener" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/metrics" + "github.com/ProtonMail/proton-bridge/v2/internal/users/credentials" + "github.com/ProtonMail/proton-bridge/v2/pkg/keychain" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/hashicorp/go-multierror" "github.com/pkg/errors" logrus "github.com/sirupsen/logrus" diff --git a/internal/users/users_clear_test.go b/internal/users/users_clear_test.go index b15cf44..b74a298 100644 --- a/internal/users/users_clear_test.go +++ b/internal/users/users_clear_test.go @@ -20,7 +20,7 @@ package users import ( "testing" - "github.com/ProtonMail/proton-bridge/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/events" gomock "github.com/golang/mock/gomock" r "github.com/stretchr/testify/require" ) diff --git a/internal/users/users_delete_test.go b/internal/users/users_delete_test.go index 17a28c3..bce1ac7 100644 --- a/internal/users/users_delete_test.go +++ b/internal/users/users_delete_test.go @@ -21,7 +21,7 @@ import ( "errors" "testing" - "github.com/ProtonMail/proton-bridge/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/events" gomock "github.com/golang/mock/gomock" r "github.com/stretchr/testify/require" ) diff --git a/internal/users/users_login_test.go b/internal/users/users_login_test.go index 0f2bec6..bff40ff 100644 --- a/internal/users/users_login_test.go +++ b/internal/users/users_login_test.go @@ -20,9 +20,9 @@ package users import ( "testing" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/internal/metrics" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/metrics" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" gomock "github.com/golang/mock/gomock" "github.com/pkg/errors" r "github.com/stretchr/testify/require" diff --git a/internal/users/users_new_test.go b/internal/users/users_new_test.go index b8462a8..9c93de9 100644 --- a/internal/users/users_new_test.go +++ b/internal/users/users_new_test.go @@ -22,9 +22,9 @@ import ( "testing" time "time" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/internal/users/credentials" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/users/credentials" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" gomock "github.com/golang/mock/gomock" r "github.com/stretchr/testify/require" ) diff --git a/internal/users/users_test.go b/internal/users/users_test.go index a8315fa..b8a4fa1 100644 --- a/internal/users/users_test.go +++ b/internal/users/users_test.go @@ -26,16 +26,16 @@ import ( "testing" "time" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/internal/sentry" - "github.com/ProtonMail/proton-bridge/internal/store" - "github.com/ProtonMail/proton-bridge/internal/store/cache" - "github.com/ProtonMail/proton-bridge/internal/users/credentials" - usersmocks "github.com/ProtonMail/proton-bridge/internal/users/mocks" - "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - pmapimocks "github.com/ProtonMail/proton-bridge/pkg/pmapi/mocks" - tests "github.com/ProtonMail/proton-bridge/test" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/internal/sentry" + "github.com/ProtonMail/proton-bridge/v2/internal/store" + "github.com/ProtonMail/proton-bridge/v2/internal/store/cache" + "github.com/ProtonMail/proton-bridge/v2/internal/users/credentials" + usersmocks "github.com/ProtonMail/proton-bridge/v2/internal/users/mocks" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + pmapimocks "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi/mocks" + tests "github.com/ProtonMail/proton-bridge/v2/test" gomock "github.com/golang/mock/gomock" "github.com/sirupsen/logrus" r "github.com/stretchr/testify/require" @@ -221,6 +221,7 @@ func (fr *fullStackReporter) Errorf(format string, args ...interface{}) { fmt.Printf("err: "+format+"\n", args...) fr.T.Fail() } + func (fr *fullStackReporter) Fatalf(format string, args ...interface{}) { debug.PrintStack() fmt.Printf("fail: "+format+"\n", args...) diff --git a/internal/versioner/install.go b/internal/versioner/install.go index 078a813..6fb7d4b 100644 --- a/internal/versioner/install.go +++ b/internal/versioner/install.go @@ -23,7 +23,7 @@ import ( "path/filepath" "github.com/Masterminds/semver/v3" - "github.com/ProtonMail/proton-bridge/pkg/tar" + "github.com/ProtonMail/proton-bridge/v2/pkg/tar" ) // InstallNewVersion installs a tgz update package of the given version. diff --git a/internal/versioner/remove.go b/internal/versioner/remove.go index d32fd51..f8a45ef 100644 --- a/internal/versioner/remove.go +++ b/internal/versioner/remove.go @@ -24,7 +24,7 @@ import ( "os" "github.com/Masterminds/semver/v3" - "github.com/ProtonMail/proton-bridge/internal/constants" + "github.com/ProtonMail/proton-bridge/v2/internal/constants" "github.com/sirupsen/logrus" ) diff --git a/internal/versioner/util.go b/internal/versioner/util.go index b861f98..ff37566 100644 --- a/internal/versioner/util.go +++ b/internal/versioner/util.go @@ -39,5 +39,5 @@ func fileIsExecutable(path string) bool { return false } - return info.Mode()&0111 != 0 + return info.Mode()&0o111 != 0 } diff --git a/internal/versioner/version.go b/internal/versioner/version.go index 105a9e1..adfe383 100644 --- a/internal/versioner/version.go +++ b/internal/versioner/version.go @@ -27,7 +27,7 @@ import ( "github.com/Masterminds/semver/v3" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/pkg/sum" + "github.com/ProtonMail/proton-bridge/v2/pkg/sum" ) const sumFile = ".sum" diff --git a/internal/versioner/version_test.go b/internal/versioner/version_test.go index cdc4f38..47af511 100644 --- a/internal/versioner/version_test.go +++ b/internal/versioner/version_test.go @@ -26,8 +26,8 @@ import ( "github.com/Masterminds/semver/v3" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/pkg/sum" - tests "github.com/ProtonMail/proton-bridge/test" + "github.com/ProtonMail/proton-bridge/v2/pkg/sum" + tests "github.com/ProtonMail/proton-bridge/v2/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -120,7 +120,7 @@ func createSignedFiles(t *testing.T, root string, paths ...string) *crypto.KeyRi } func makeFile(t *testing.T, path string) { - require.NoError(t, os.MkdirAll(filepath.Dir(path), 0700)) + require.NoError(t, os.MkdirAll(filepath.Dir(path), 0o700)) f, err := os.Create(path) require.NoError(t, err) @@ -141,5 +141,5 @@ func signFile(t *testing.T, path string, kr *crypto.KeyRing) { sig, err := kr.SignDetached(crypto.NewPlainMessage(file)) require.NoError(t, err) - require.NoError(t, ioutil.WriteFile(path+".sig", sig.GetBinary(), 0700)) + require.NoError(t, ioutil.WriteFile(path+".sig", sig.GetBinary(), 0o700)) } diff --git a/internal/versioner/versioner_test.go b/internal/versioner/versioner_test.go index 0654d27..f8ec703 100644 --- a/internal/versioner/versioner_test.go +++ b/internal/versioner/versioner_test.go @@ -60,13 +60,13 @@ func newTestVersioner(t *testing.T, exeName, updates string, versions ...string) func makeDummyVersionDirectory(t *testing.T, exeName, updates, version string) string { target := filepath.Join(updates, version) - require.NoError(t, os.Mkdir(target, 0700)) + require.NoError(t, os.Mkdir(target, 0o700)) exe, err := os.Create(filepath.Join(target, getExeName(exeName))) require.NoError(t, err) require.NotNil(t, exe) require.NoError(t, exe.Close()) - require.NoError(t, os.Chmod(exe.Name(), 0700)) + require.NoError(t, os.Chmod(exe.Name(), 0o700)) sig, err := os.Create(filepath.Join(target, getExeName(exeName)+".sig")) require.NoError(t, err) diff --git a/pkg/files/removal_test.go b/pkg/files/removal_test.go index 8f9f8da..038d693 100644 --- a/pkg/files/removal_test.go +++ b/pkg/files/removal_test.go @@ -97,7 +97,7 @@ func newTestDir(t *testing.T, subdirs ...string) string { require.NoError(t, err) for _, target := range subdirs { - require.NoError(t, os.MkdirAll(filepath.Join(dir, target), 0700)) + require.NoError(t, os.MkdirAll(filepath.Join(dir, target), 0o700)) } return dir diff --git a/pkg/keychain/keychain.go b/pkg/keychain/keychain.go index f73893d..756ef2c 100644 --- a/pkg/keychain/keychain.go +++ b/pkg/keychain/keychain.go @@ -23,7 +23,7 @@ import ( "fmt" "sync" - "github.com/ProtonMail/proton-bridge/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" "github.com/docker/docker-credential-helpers/credentials" ) diff --git a/pkg/message/build.go b/pkg/message/build.go index 374751e..8b0e71b 100644 --- a/pkg/message/build.go +++ b/pkg/message/build.go @@ -24,8 +24,8 @@ import ( "sync" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - "github.com/ProtonMail/proton-bridge/pkg/pool" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pool" "github.com/pkg/errors" ) diff --git a/pkg/message/build_encrypted.go b/pkg/message/build_encrypted.go index fcaafa2..7e7273d 100644 --- a/pkg/message/build_encrypted.go +++ b/pkg/message/build_encrypted.go @@ -29,8 +29,8 @@ import ( "strings" "github.com/ProtonMail/gopenpgp/v2/crypto" - pmmime "github.com/ProtonMail/proton-bridge/pkg/mime" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/emersion/go-message" "github.com/emersion/go-textwrapper" ) diff --git a/pkg/message/build_framework_test.go b/pkg/message/build_framework_test.go index ba4d561..5a018ec 100644 --- a/pkg/message/build_framework_test.go +++ b/pkg/message/build_framework_test.go @@ -27,9 +27,9 @@ import ( "time" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/pkg/message/mocks" - "github.com/ProtonMail/proton-bridge/pkg/message/parser" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/message/mocks" + "github.com/ProtonMail/proton-bridge/v2/pkg/message/parser" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/pkg/message/build_rfc822.go b/pkg/message/build_rfc822.go index b83fbb6..eb7e0b9 100644 --- a/pkg/message/build_rfc822.go +++ b/pkg/message/build_rfc822.go @@ -28,7 +28,7 @@ import ( "github.com/ProtonMail/go-rfc5322" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/emersion/go-message" "github.com/emersion/go-message/textproto" "github.com/pkg/errors" diff --git a/pkg/message/build_rfc822_custom.go b/pkg/message/build_rfc822_custom.go index 5dfa029..48d8a6e 100644 --- a/pkg/message/build_rfc822_custom.go +++ b/pkg/message/build_rfc822_custom.go @@ -23,7 +23,7 @@ import ( "github.com/ProtonMail/gopenpgp/v2/constants" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/emersion/go-message" ) diff --git a/pkg/message/build_test.go b/pkg/message/build_test.go index 2f189ba..e814223 100644 --- a/pkg/message/build_test.go +++ b/pkg/message/build_test.go @@ -26,8 +26,8 @@ import ( "time" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/pkg/message/mocks" - tests "github.com/ProtonMail/proton-bridge/test" + "github.com/ProtonMail/proton-bridge/v2/pkg/message/mocks" + tests "github.com/ProtonMail/proton-bridge/v2/test" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/pkg/message/encrypt.go b/pkg/message/encrypt.go index 8aa752c..77464cb 100644 --- a/pkg/message/encrypt.go +++ b/pkg/message/encrypt.go @@ -27,7 +27,7 @@ import ( "strings" "github.com/ProtonMail/gopenpgp/v2/crypto" - pmmime "github.com/ProtonMail/proton-bridge/pkg/mime" + pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime" "github.com/emersion/go-message/textproto" "github.com/pkg/errors" ) diff --git a/pkg/message/envelope.go b/pkg/message/envelope.go index 0f8b856..e7828e4 100644 --- a/pkg/message/envelope.go +++ b/pkg/message/envelope.go @@ -22,7 +22,7 @@ import ( "net/textproto" "strings" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/emersion/go-imap" ) diff --git a/pkg/message/flags.go b/pkg/message/flags.go index c9434e5..06be0ae 100644 --- a/pkg/message/flags.go +++ b/pkg/message/flags.go @@ -18,7 +18,7 @@ package message import ( - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/emersion/go-imap" ) diff --git a/pkg/message/init.go b/pkg/message/init.go index fd8b4f1..3aa7d36 100644 --- a/pkg/message/init.go +++ b/pkg/message/init.go @@ -19,7 +19,7 @@ package message import ( "github.com/ProtonMail/go-rfc5322" - pmmime "github.com/ProtonMail/proton-bridge/pkg/mime" + pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime" ) func init() { //nolint:gochecknoinits diff --git a/pkg/message/mocks/mocks.go b/pkg/message/mocks/mocks.go index 4c58525..85629c1 100644 --- a/pkg/message/mocks/mocks.go +++ b/pkg/message/mocks/mocks.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ProtonMail/proton-bridge/pkg/message (interfaces: Fetcher) +// Source: github.com/ProtonMail/proton-bridge/v2/pkg/message (interfaces: Fetcher) // Package mocks is a generated GoMock package. package mocks @@ -10,7 +10,7 @@ import ( reflect "reflect" crypto "github.com/ProtonMail/gopenpgp/v2/crypto" - pmapi "github.com/ProtonMail/proton-bridge/pkg/pmapi" + pmapi "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" gomock "github.com/golang/mock/gomock" ) diff --git a/pkg/message/parser.go b/pkg/message/parser.go index 4ed849e..718fc27 100644 --- a/pkg/message/parser.go +++ b/pkg/message/parser.go @@ -28,9 +28,9 @@ import ( "strings" "github.com/ProtonMail/go-rfc5322" - "github.com/ProtonMail/proton-bridge/pkg/message/parser" - pmmime "github.com/ProtonMail/proton-bridge/pkg/mime" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/message/parser" + pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/emersion/go-message" "github.com/jaytaylor/html2text" "github.com/pkg/errors" diff --git a/pkg/message/parser/parser_test.go b/pkg/message/parser/parser_test.go index 3e88fa3..d6e3c1d 100644 --- a/pkg/message/parser/parser_test.go +++ b/pkg/message/parser/parser_test.go @@ -36,7 +36,6 @@ func newTestParser(t *testing.T, msg string) *Parser { func getFileReader(filename string) io.ReadCloser { f, err := os.Open(filepath.Join("testdata", filename)) - if err != nil { panic(err) } diff --git a/pkg/message/parser/part.go b/pkg/message/parser/part.go index 65401ea..2b52a55 100644 --- a/pkg/message/parser/part.go +++ b/pkg/message/parser/part.go @@ -23,7 +23,7 @@ import ( "mime" "unicode/utf8" - pmmime "github.com/ProtonMail/proton-bridge/pkg/mime" + pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime" "github.com/PuerkitoBio/goquery" "github.com/emersion/go-message" "github.com/sirupsen/logrus" diff --git a/pkg/message/parser/trimmer_test.go b/pkg/message/parser/trimmer_test.go index d8fa3dc..f2626da 100644 --- a/pkg/message/parser/trimmer_test.go +++ b/pkg/message/parser/trimmer_test.go @@ -26,7 +26,7 @@ import ( ) func TestEndOfMailTrimmer(t *testing.T) { - var tests = []struct { + tests := []struct { in string out string }{ diff --git a/pkg/message/parser_test.go b/pkg/message/parser_test.go index 4bc60df..5ac01b6 100644 --- a/pkg/message/parser_test.go +++ b/pkg/message/parser_test.go @@ -25,7 +25,7 @@ import ( "path/filepath" "testing" - "github.com/ProtonMail/proton-bridge/pkg/message/parser" + "github.com/ProtonMail/proton-bridge/v2/pkg/message/parser" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/text/encoding/charmap" @@ -604,7 +604,6 @@ func getFileReader(filename string) io.Reader { func readerToString(r io.Reader) string { b, err := ioutil.ReadAll(r) - if err != nil { panic(err) } diff --git a/pkg/message/section.go b/pkg/message/section.go index e80331d..a2b38ce 100644 --- a/pkg/message/section.go +++ b/pkg/message/section.go @@ -26,7 +26,7 @@ import ( "strconv" "strings" - pmmime "github.com/ProtonMail/proton-bridge/pkg/mime" + pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime" "github.com/emersion/go-imap" "github.com/pkg/errors" "github.com/vmihailenco/msgpack/v5" diff --git a/pkg/message/section_test.go b/pkg/message/section_test.go index 3704032..6b6568e 100644 --- a/pkg/message/section_test.go +++ b/pkg/message/section_test.go @@ -341,7 +341,8 @@ var testPaths = []struct { path []int expectedSection, expectedBody string }{ - {[]int{}, + { + []int{}, sampleMail, `main summary @@ -434,7 +435,8 @@ Content-Type: text/html `, }, - {[]int{1}, + { + []int{1}, `Content-Type: text/plain 1. main message @@ -446,7 +448,8 @@ Content-Type: text/html `, }, - {[]int{3}, + { + []int{3}, `Subject: Inside mail 3 From: Mary Smith To: John Doe @@ -488,7 +491,8 @@ Content-Transfer-Encoding: base64 `, }, - {[]int{3, 1}, + { + []int{3, 1}, `Content-Type: text/plain 3.1 message text @@ -498,7 +502,8 @@ Content-Transfer-Encoding: base64 `, }, - {[]int{3, 2}, + { + []int{3, 2}, `Content-Type: application/octet-stream Content-Disposition: attachment; filename="msg_3_signature.sig" Content-Transfer-Encoding: base64 @@ -510,7 +515,8 @@ Content-Transfer-Encoding: base64 `, }, - {[]int{4, 2, 2, 1}, + { + []int{4, 2, 2, 1}, `Content-Type: text/plain 4.2.2.1 plain text @@ -520,7 +526,8 @@ Content-Transfer-Encoding: base64 `, }, - {[]int{4, 2, 2, 2}, + { + []int{4, 2, 2, 2}, `Content-Type: text/html

4.2.2.2 html text

diff --git a/pkg/mime/encoding_test.go b/pkg/mime/encoding_test.go index 676a98f..35c524b 100644 --- a/pkg/mime/encoding_test.go +++ b/pkg/mime/encoding_test.go @@ -126,21 +126,21 @@ func TestGetEncoding(t *testing.T) { // All MIME charsets with aliases can be found here: // https://www.iana.org/assignments/character-sets/character-sets.xhtml mimesets := map[string][]string{ - "utf-8": []string{ // MIB 16 + "utf-8": { // MIB 16 "utf8", "csutf8", "unicode-1-1-utf-8", "iso-utf-8", "utf8mb4", }, - "gbk": []string{ + "gbk": { "gb2312", // MIB 2025 //"euc-cn": []string{ "euccn", "ibm-euccn", }, //"utf7": []string{"utf-7", "unicode-1-1-utf-7"}, - "iso-8859-2": []string{ // MIB 5 + "iso-8859-2": { // MIB 5 "iso-ir-101", "iso_8859-2", "iso8859-2", @@ -150,27 +150,27 @@ func TestGetEncoding(t *testing.T) { "ibm852", //"FAILEDibm852", }, - "iso-8859-3": []string{ // MIB 6 + "iso-8859-3": { // MIB 6 "iso-ir-109", "iso_8859-3", "latin3", "l3", "csisolatin3", }, - "iso-8859-4": []string{ // MIB 7 + "iso-8859-4": { // MIB 7 "iso-ir-110", "iso_8859-4", "latin4", "l4", "csisolatin4", }, - "iso-8859-5": []string{ // MIB 8 + "iso-8859-5": { // MIB 8 "iso-ir-144", "iso_8859-5", "cyrillic", "csisolatincyrillic", }, - "iso-8859-6": []string{ // MIB 9 + "iso-8859-6": { // MIB 9 "iso-ir-127", "iso_8859-6", "ecma-114", @@ -182,16 +182,18 @@ func TestGetEncoding(t *testing.T) { "iso-8859-6-e", //"iso-8859-6i": []string{ // MIB 82 "csiso88596i", - "iso-8859-6-i"}, - "iso-8859-7": []string{ // MIB 10 + "iso-8859-6-i", + }, + "iso-8859-7": { // MIB 10 "iso-ir-126", "iso_8859-7", "elot_928", "ecma-118", "greek", "greek8", - "csisolatingreek"}, - "iso-8859-8": []string{ // MIB 11 + "csisolatingreek", + }, + "iso-8859-8": { // MIB 11 "iso-ir-138", "iso_8859-8", "hebrew", @@ -200,33 +202,36 @@ func TestGetEncoding(t *testing.T) { "csiso88598e", "iso-8859-8-e", }, - "iso-8859-8-i": []string{ // MIB 85 + "iso-8859-8-i": { // MIB 85 "logical", "csiso88598i", "iso-8859-8-i", // Hebrew, the "i" means right-to-left, probably unnecessary with ISO cleaning above. }, - "iso-8859-10": []string{ // MIB 13 + "iso-8859-10": { // MIB 13 "iso-ir-157", "l6", "iso_8859-10:1992", "csisolatin6", - "latin6"}, - "iso-8859-13": []string{ // MIB 109 + "latin6", + }, + "iso-8859-13": { // MIB 109 "csiso885913"}, - "iso-8859-14": []string{ // MIB 110 + "iso-8859-14": { // MIB 110 "iso-ir-199", "iso_8859-14:1998", "iso_8859-14", "latin8", "iso-celtic", "l8", - "csiso885914"}, - "iso-8859-15": []string{ // MIB 111 + "csiso885914", + }, + "iso-8859-15": { // MIB 111 "iso_8859-15", "latin-9", "csiso885915", - "ISO8859-15"}, - "iso-8859-16": []string{ // MIB 112 + "ISO8859-15", + }, + "iso-8859-16": { // MIB 112 "iso-ir-226", "iso_8859-16:2001", "iso_8859-16", @@ -234,21 +239,21 @@ func TestGetEncoding(t *testing.T) { "l10", "csiso885916", }, - "windows-874": []string{ // MIB 2109 + "windows-874": { // MIB 2109 "cswindows874", "cp874", "iso-8859-11", "tis-620", }, - "windows-1250": []string{ // MIB 2250 + "windows-1250": { // MIB 2250 "cswindows1250", "cp1250", }, - "windows-1251": []string{ // MIB 2251 + "windows-1251": { // MIB 2251 "cswindows1251", "cp1251", }, - "windows-1252": []string{ // MIB 2252 + "windows-1252": { // MIB 2252 "cswindows1252", "cp1252", "3dwindows-1252", @@ -278,20 +283,20 @@ func TestGetEncoding(t *testing.T) { "iso-ir-6", "we8iso8859p1", }, - "windows-1253": []string{"cswindows1253", "cp1253"}, // MIB 2253 - "windows-1254": []string{"cswindows1254", "cp1254"}, // MIB 2254 - "windows-1255": []string{"cSwindows1255", "cp1255"}, // MIB 2255 - "windows-1256": []string{"cswIndows1256", "cp1256"}, // MIB 2256 - "windows-1257": []string{"cswinDows1257", "cp1257"}, // MIB 2257 - "windows-1258": []string{"cswindoWs1258", "cp1258"}, // MIB 2257 - "koi8-r": []string{"cskoi8r", "koi8r"}, // MIB 2084 - "koi8-u": []string{"cskoi8u", "koi8u"}, // MIB 2088 - "macintosh": []string{"mac", "macroman", "csmacintosh"}, // MIB 2027 - "big5": []string{ + "windows-1253": {"cswindows1253", "cp1253"}, // MIB 2253 + "windows-1254": {"cswindows1254", "cp1254"}, // MIB 2254 + "windows-1255": {"cSwindows1255", "cp1255"}, // MIB 2255 + "windows-1256": {"cswIndows1256", "cp1256"}, // MIB 2256 + "windows-1257": {"cswinDows1257", "cp1257"}, // MIB 2257 + "windows-1258": {"cswindoWs1258", "cp1258"}, // MIB 2257 + "koi8-r": {"cskoi8r", "koi8r"}, // MIB 2084 + "koi8-u": {"cskoi8u", "koi8u"}, // MIB 2088 + "macintosh": {"mac", "macroman", "csmacintosh"}, // MIB 2027 + "big5": { "zht16mswin950", // cp950 "cp950", }, - "euc-kr": []string{ + "euc-kr": { "euckr", // MIB 38 "ibm-euckr", //"uhc": []string{ // Korea @@ -299,11 +304,11 @@ func TestGetEncoding(t *testing.T) { "ksc5601", "cp949", }, - "euc-jp": []string{ + "euc-jp": { "eucjp", "ibm-eucjp", }, - "shift_jis": []string{ + "shift_jis": { "CP932", "MS932", "Windows-932", @@ -312,7 +317,7 @@ func TestGetEncoding(t *testing.T) { "IBM-943", "CP943", }, - "iso-2022-jp": []string{ // MIB 39 + "iso-2022-jp": { // MIB 39 "iso2022jp", "csiso2022jp", }, @@ -424,14 +429,14 @@ func TestEncodeReader(t *testing.T) { // run tests for _, val := range testData { - //fmt.Println("Testing ", val) + // fmt.Println("Testing ", val) expected := []byte(val.message) decoded, err := DecodeCharset(val.original, "text/plain; charset="+val.charset) if len(expected) == 0 { if err == nil { t.Error("Expected err but have ", err) } else { - //fmt.Println("Expected err: ", err) + // fmt.Println("Expected err: ", err) continue } } else { diff --git a/pkg/pmapi/attachments_test.go b/pkg/pmapi/attachments_test.go index 7523c31..9c14a12 100644 --- a/pkg/pmapi/attachments_test.go +++ b/pkg/pmapi/attachments_test.go @@ -31,7 +31,7 @@ import ( "strings" "testing" - pmmime "github.com/ProtonMail/proton-bridge/pkg/mime" + pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime" "github.com/stretchr/testify/require" ) diff --git a/pkg/pmapi/config_qa.go b/pkg/pmapi/config_qa.go index e92b9da..2f00f6f 100644 --- a/pkg/pmapi/config_qa.go +++ b/pkg/pmapi/config_qa.go @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with Proton Mail Bridge. If not, see . +//go:build build_qa // +build build_qa package pmapi diff --git a/pkg/pmapi/import_test.go b/pkg/pmapi/import_test.go index f24c479..f8a5a16 100644 --- a/pkg/pmapi/import_test.go +++ b/pkg/pmapi/import_test.go @@ -28,7 +28,7 @@ import ( "net/http" "testing" - pmmime "github.com/ProtonMail/proton-bridge/pkg/mime" + pmmime "github.com/ProtonMail/proton-bridge/v2/pkg/mime" r "github.com/stretchr/testify/require" ) diff --git a/pkg/pmapi/manager_auth.go b/pkg/pmapi/manager_auth.go index 2daad62..77abef5 100644 --- a/pkg/pmapi/manager_auth.go +++ b/pkg/pmapi/manager_auth.go @@ -105,7 +105,7 @@ func (m *manager) authRefresh(ctx context.Context, uid, ref string) (*AuthRefres m.refreshingAuth.Lock() defer m.refreshingAuth.Unlock() - var req = authRefreshReq{ + req := authRefreshReq{ UID: uid, RefreshToken: ref, ResponseType: "token", diff --git a/pkg/pmapi/manager_ping.go b/pkg/pmapi/manager_ping.go index 0d013dc..0835eec 100644 --- a/pkg/pmapi/manager_ping.go +++ b/pkg/pmapi/manager_ping.go @@ -24,10 +24,8 @@ import ( "github.com/sirupsen/logrus" ) -var ( - // retryConnectionSleeps defines a smooth cool down in seconds. - retryConnectionSleeps = []int{2, 5, 10, 30, 60} //nolint:gochecknoglobals -) +// retryConnectionSleeps defines a smooth cool down in seconds. +var retryConnectionSleeps = []int{2, 5, 10, 30, 60} //nolint:gochecknoglobals func (m *manager) pingUntilSuccess() { if m.isPingOngoing() { diff --git a/pkg/pmapi/messages_test.go b/pkg/pmapi/messages_test.go index 9847ad8..eed778c 100644 --- a/pkg/pmapi/messages_test.go +++ b/pkg/pmapi/messages_test.go @@ -27,8 +27,10 @@ import ( "github.com/stretchr/testify/require" ) -const testMessageCleartext = `
jeej saas

Sent from ProtonMail, encrypted email based in Switzerland.

` -const testMessageCleartextLegacy = `
flkasjfkjasdklfjasd
fasd
jfasjdfjasd
fj
asdfj
sadjf
sadjf
asjdf
jasd
fj
asdjf
asdjfsad
fasdlkfjasdjfkljsadfljsdfjsdljflkdsjfkljsdlkfjsdlk
jasfd
jsd
jf
sdjfjsdf

djfskjsladf
asd
fja
sdjfajsf
jas
fas
fj
afj
ajf
af
asdfasdfasd
Sent from ProtonMail, encrypted email based in Switzerland.
dshfljsadfasdf
as
df
asd
fasd
f
asd
fasdflasdklfjsadlkjf
asd
fasdlkfjasdlkfjklasdjflkasjdflaslkfasdfjlasjflkasflksdjflkjasdf
asdflkasdjflajsfljaslkflasf
asdfkas
dfjas
djf
asjf
asj
faj
f
afj
sdjaf
jas
sdfj
ajf
aj
ajsdafafdaaf
a
f
lasl;ga
sags
ad
gags
g
ga
a
gg
a
ag
ag
agga.g.ga,ag.ag./ga

dsga
sg

gasga\g\g\g\g\g\n\y\t\r\\r\r\\n\n\n\


sd
asdf
asdf
dsa
fasd
f
` +const ( + testMessageCleartext = `
jeej saas

Sent from ProtonMail, encrypted email based in Switzerland.

` + testMessageCleartextLegacy = `
flkasjfkjasdklfjasd
fasd
jfasjdfjasd
fj
asdfj
sadjf
sadjf
asjdf
jasd
fj
asdjf
asdjfsad
fasdlkfjasdjfkljsadfljsdfjsdljflkdsjfkljsdlkfjsdlk
jasfd
jsd
jf
sdjfjsdf

djfskjsladf
asd
fja
sdjfajsf
jas
fas
fj
afj
ajf
af
asdfasdfasd
Sent from ProtonMail, encrypted email based in Switzerland.
dshfljsadfasdf
as
df
asd
fasd
f
asd
fasdflasdklfjsadlkjf
asd
fasdlkfjasdlkfjklasdjflkasjdflaslkfasdfjlasjflkasflksdjflkjasdf
asdflkasdjflajsfljaslkflasf
asdfkas
dfjas
djf
asjf
asj
faj
f
afj
sdjaf
jas
sdfj
ajf
aj
ajsdafafdaaf
a
f
lasl;ga
sags
ad
gags
g
ga
a
gg
a
ag
ag
agga.g.ga,ag.ag./ga

dsga
sg

gasga\g\g\g\g\g\n\y\t\r\\r\r\\n\n\n\


sd
asdf
asdf
dsa
fasd
f
` +) const testMessageEncrypted = `-----BEGIN PGP MESSAGE----- Version: OpenPGP.js v1.2.0 diff --git a/pkg/pmapi/mocks/mocks.go b/pkg/pmapi/mocks/mocks.go index 82a7570..a064cc9 100644 --- a/pkg/pmapi/mocks/mocks.go +++ b/pkg/pmapi/mocks/mocks.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ProtonMail/proton-bridge/pkg/pmapi (interfaces: Client,Manager) +// Source: github.com/ProtonMail/proton-bridge/v2/pkg/pmapi (interfaces: Client,Manager) // Package mocks is a generated GoMock package. package mocks @@ -12,7 +12,7 @@ import ( time "time" crypto "github.com/ProtonMail/gopenpgp/v2/crypto" - pmapi "github.com/ProtonMail/proton-bridge/pkg/pmapi" + pmapi "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" gomock "github.com/golang/mock/gomock" logrus "github.com/sirupsen/logrus" ) diff --git a/pkg/pmapi/pmapi_test.go b/pkg/pmapi/pmapi_test.go index b75306b..9da3366 100644 --- a/pkg/pmapi/pmapi_test.go +++ b/pkg/pmapi/pmapi_test.go @@ -24,8 +24,10 @@ import ( "github.com/ProtonMail/gopenpgp/v2/crypto" ) -const testMailboxPassword = "apple" -const testMailboxPasswordLegacy = "123" +const ( + testMailboxPassword = "apple" + testMailboxPasswordLegacy = "123" +) var ( testPrivateKeyRing *crypto.KeyRing diff --git a/pkg/pool/pool.go b/pkg/pool/pool.go index 3f76001..f979a37 100644 --- a/pkg/pool/pool.go +++ b/pkg/pool/pool.go @@ -20,7 +20,7 @@ package pool import ( "sync" - "github.com/ProtonMail/proton-bridge/pkg/pchan" + "github.com/ProtonMail/proton-bridge/v2/pkg/pchan" ) type WorkFunc func(interface{}, int) (interface{}, error) diff --git a/pkg/pool/pool_test.go b/pkg/pool/pool_test.go index 3beb917..27e8137 100644 --- a/pkg/pool/pool_test.go +++ b/pkg/pool/pool_test.go @@ -20,7 +20,7 @@ package pool_test import ( "testing" - "github.com/ProtonMail/proton-bridge/pkg/pool" + "github.com/ProtonMail/proton-bridge/v2/pkg/pool" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/sum/sum_test.go b/pkg/sum/sum_test.go index 9bda7a4..87c8a2a 100644 --- a/pkg/sum/sum_test.go +++ b/pkg/sum/sum_test.go @@ -75,7 +75,7 @@ func createFiles(t *testing.T, root string, paths ...string) { } func makeFile(t *testing.T, path string) { - require.NoError(t, os.MkdirAll(filepath.Dir(path), 0700)) + require.NoError(t, os.MkdirAll(filepath.Dir(path), 0o700)) f, err := os.Create(path) require.NoError(t, err) diff --git a/test/accounts/account.go b/test/accounts/account.go index 31f65dd..58804b5 100644 --- a/test/accounts/account.go +++ b/test/accounts/account.go @@ -25,7 +25,7 @@ import ( "sort" "strings" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) const ( diff --git a/test/accounts/accounts.go b/test/accounts/accounts.go index 332b93c..6dc186e 100644 --- a/test/accounts/accounts.go +++ b/test/accounts/accounts.go @@ -21,7 +21,7 @@ import ( "encoding/json" "io/ioutil" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" ) diff --git a/test/api_checks_test.go b/test/api_checks_test.go index 071503b..574f669 100644 --- a/test/api_checks_test.go +++ b/test/api_checks_test.go @@ -24,8 +24,8 @@ import ( "strings" "time" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - "github.com/ProtonMail/proton-bridge/test/accounts" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/test/accounts" "github.com/cucumber/godog" "github.com/stretchr/testify/assert" ) diff --git a/test/bdd_test.go b/test/bdd_test.go index c954ab3..6bfd368 100644 --- a/test/bdd_test.go +++ b/test/bdd_test.go @@ -20,7 +20,7 @@ package tests import ( "context" - testContext "github.com/ProtonMail/proton-bridge/test/context" + testContext "github.com/ProtonMail/proton-bridge/v2/test/context" "github.com/cucumber/godog" ) diff --git a/test/benchmarks/bench_test.go b/test/benchmarks/bench_test.go index c48abbf..5f70f44 100644 --- a/test/benchmarks/bench_test.go +++ b/test/benchmarks/bench_test.go @@ -22,8 +22,8 @@ import ( "testing" "time" - "github.com/ProtonMail/proton-bridge/test/context" - "github.com/ProtonMail/proton-bridge/test/mocks" + "github.com/ProtonMail/proton-bridge/v2/test/context" + "github.com/ProtonMail/proton-bridge/v2/test/mocks" ) func benchTestContext() (*context.TestContext, *mocks.IMAPClient) { @@ -157,7 +157,6 @@ func BenchmarkIMAPOutlook(b *testing.B) { b.Run("default", func(b *testing.B) { for i := 0; i < b.N; i++ { for _, command := range []string{ - /* "ID ("+ `"name" "Mac OS X Mail" `+ diff --git a/test/context/accounts.go b/test/context/accounts.go index 1b1e1ab..366655a 100644 --- a/test/context/accounts.go +++ b/test/context/accounts.go @@ -20,7 +20,7 @@ package context import ( "os" - "github.com/ProtonMail/proton-bridge/test/accounts" + "github.com/ProtonMail/proton-bridge/v2/test/accounts" ) func newTestAccounts() *accounts.TestAccounts { diff --git a/test/context/bridge.go b/test/context/bridge.go index 74bdd9d..ec2b857 100644 --- a/test/context/bridge.go +++ b/test/context/bridge.go @@ -21,16 +21,16 @@ import ( "time" "github.com/ProtonMail/go-autostart" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/config/useragent" - "github.com/ProtonMail/proton-bridge/internal/constants" - "github.com/ProtonMail/proton-bridge/internal/sentry" - "github.com/ProtonMail/proton-bridge/internal/store/cache" - "github.com/ProtonMail/proton-bridge/internal/users" - "github.com/ProtonMail/proton-bridge/pkg/listener" - "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/config/useragent" + "github.com/ProtonMail/proton-bridge/v2/internal/constants" + "github.com/ProtonMail/proton-bridge/v2/internal/sentry" + "github.com/ProtonMail/proton-bridge/v2/internal/store/cache" + "github.com/ProtonMail/proton-bridge/v2/internal/users" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) // GetBridge returns bridge instance. diff --git a/test/context/context.go b/test/context/context.go index 3bdd8cc..381cda2 100644 --- a/test/context/context.go +++ b/test/context/context.go @@ -21,13 +21,13 @@ package context import ( "sync" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/useragent" - "github.com/ProtonMail/proton-bridge/internal/users" - "github.com/ProtonMail/proton-bridge/pkg/listener" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - "github.com/ProtonMail/proton-bridge/test/accounts" - "github.com/ProtonMail/proton-bridge/test/mocks" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/useragent" + "github.com/ProtonMail/proton-bridge/v2/internal/users" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/test/accounts" + "github.com/ProtonMail/proton-bridge/v2/test/mocks" "github.com/sirupsen/logrus" ) @@ -169,6 +169,7 @@ func (ctx *TestContext) GetLastError() error { func (ctx *TestContext) MessagePreparationStarted(username string) { ctx.pmapiController.LockEvents(username) } + func (ctx *TestContext) MessagePreparationFinished(username string) { ctx.pmapiController.UnlockEvents(username) } diff --git a/test/context/credentials.go b/test/context/credentials.go index 6551116..790c891 100644 --- a/test/context/credentials.go +++ b/test/context/credentials.go @@ -20,7 +20,7 @@ package context import ( "strings" - "github.com/ProtonMail/proton-bridge/internal/users/credentials" + "github.com/ProtonMail/proton-bridge/v2/internal/users/credentials" "github.com/pkg/errors" ) diff --git a/test/context/globals.go b/test/context/globals.go index 3cda19b..a7cab7f 100644 --- a/test/context/globals.go +++ b/test/context/globals.go @@ -20,7 +20,7 @@ package context import ( "os" - "github.com/ProtonMail/proton-bridge/test/liveapi" + "github.com/ProtonMail/proton-bridge/v2/test/liveapi" ) // BeforeRun does necessary setup. diff --git a/test/context/imap.go b/test/context/imap.go index 1eef3eb..9d0ffaf 100644 --- a/test/context/imap.go +++ b/test/context/imap.go @@ -21,11 +21,11 @@ import ( "fmt" "time" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/config/tls" - "github.com/ProtonMail/proton-bridge/internal/imap" - "github.com/ProtonMail/proton-bridge/test/mocks" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/config/tls" + "github.com/ProtonMail/proton-bridge/v2/internal/imap" + "github.com/ProtonMail/proton-bridge/v2/test/mocks" "github.com/stretchr/testify/require" ) diff --git a/test/context/pmapi_controller.go b/test/context/pmapi_controller.go index d8aed42..78e3951 100644 --- a/test/context/pmapi_controller.go +++ b/test/context/pmapi_controller.go @@ -20,12 +20,12 @@ package context import ( "os" - "github.com/ProtonMail/proton-bridge/internal/events" - "github.com/ProtonMail/proton-bridge/pkg/listener" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - "github.com/ProtonMail/proton-bridge/test/accounts" - "github.com/ProtonMail/proton-bridge/test/fakeapi" - "github.com/ProtonMail/proton-bridge/test/liveapi" + "github.com/ProtonMail/proton-bridge/v2/internal/events" + "github.com/ProtonMail/proton-bridge/v2/pkg/listener" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/test/accounts" + "github.com/ProtonMail/proton-bridge/v2/test/fakeapi" + "github.com/ProtonMail/proton-bridge/v2/test/liveapi" ) type PMAPIController interface { diff --git a/test/context/settings.go b/test/context/settings.go index f9812c8..1f6936d 100644 --- a/test/context/settings.go +++ b/test/context/settings.go @@ -21,7 +21,7 @@ import ( "io/ioutil" "math/rand" - "github.com/ProtonMail/proton-bridge/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" ) type fakeSettings struct { diff --git a/test/context/smtp.go b/test/context/smtp.go index ac0511f..746afeb 100644 --- a/test/context/smtp.go +++ b/test/context/smtp.go @@ -21,11 +21,11 @@ import ( "fmt" "time" - "github.com/ProtonMail/proton-bridge/internal/bridge" - "github.com/ProtonMail/proton-bridge/internal/config/settings" - "github.com/ProtonMail/proton-bridge/internal/config/tls" - "github.com/ProtonMail/proton-bridge/internal/smtp" - "github.com/ProtonMail/proton-bridge/test/mocks" + "github.com/ProtonMail/proton-bridge/v2/internal/bridge" + "github.com/ProtonMail/proton-bridge/v2/internal/config/settings" + "github.com/ProtonMail/proton-bridge/v2/internal/config/tls" + "github.com/ProtonMail/proton-bridge/v2/internal/smtp" + "github.com/ProtonMail/proton-bridge/v2/test/mocks" "github.com/stretchr/testify/require" ) diff --git a/test/context/updater.go b/test/context/updater.go index 9664dae..af508b3 100644 --- a/test/context/updater.go +++ b/test/context/updater.go @@ -18,7 +18,7 @@ package context import ( - "github.com/ProtonMail/proton-bridge/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" ) type fakeUpdater struct{} diff --git a/test/context/users.go b/test/context/users.go index 040cdcb..7110c3f 100644 --- a/test/context/users.go +++ b/test/context/users.go @@ -25,9 +25,9 @@ import ( "time" "github.com/ProtonMail/go-srp" - "github.com/ProtonMail/proton-bridge/internal/store" - "github.com/ProtonMail/proton-bridge/internal/users" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/store" + "github.com/ProtonMail/proton-bridge/v2/internal/users" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" "github.com/stretchr/testify/assert" ) diff --git a/test/fakeapi/attachments.go b/test/fakeapi/attachments.go index 60132f5..d73d726 100644 --- a/test/fakeapi/attachments.go +++ b/test/fakeapi/attachments.go @@ -26,7 +26,7 @@ import ( "io/ioutil" "net/textproto" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) // dataPacketOutlineLightInstagram48png is data packet with encrypted data and diff --git a/test/fakeapi/auth.go b/test/fakeapi/auth.go index a814330..983ec6c 100644 --- a/test/fakeapi/auth.go +++ b/test/fakeapi/auth.go @@ -20,7 +20,7 @@ package fakeapi import ( "context" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) func (api *FakePMAPI) Auth2FA(_ context.Context, twoFactorCode string) error { diff --git a/test/fakeapi/contacts.go b/test/fakeapi/contacts.go index d880e52..5964d0e 100644 --- a/test/fakeapi/contacts.go +++ b/test/fakeapi/contacts.go @@ -23,7 +23,7 @@ import ( "net/url" "strconv" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) func (api *FakePMAPI) DecryptAndVerifyCards(cards []pmapi.Card) ([]pmapi.Card, error) { diff --git a/test/fakeapi/controller.go b/test/fakeapi/controller.go index 70b0e84..2574f2c 100644 --- a/test/fakeapi/controller.go +++ b/test/fakeapi/controller.go @@ -20,8 +20,8 @@ package fakeapi import ( "sync" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - "github.com/ProtonMail/proton-bridge/test/context/calls" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/test/context/calls" "github.com/sirupsen/logrus" ) diff --git a/test/fakeapi/controller_calls.go b/test/fakeapi/controller_calls.go index 328b3d9..127ef9a 100644 --- a/test/fakeapi/controller_calls.go +++ b/test/fakeapi/controller_calls.go @@ -20,7 +20,7 @@ package fakeapi import ( "encoding/json" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) type method string diff --git a/test/fakeapi/controller_control.go b/test/fakeapi/controller_control.go index 00d25e4..ddd4f35 100644 --- a/test/fakeapi/controller_control.go +++ b/test/fakeapi/controller_control.go @@ -24,8 +24,8 @@ import ( "strings" "time" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - "github.com/ProtonMail/proton-bridge/test/accounts" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/test/accounts" ) var systemLabelNameToID = map[string]string{ //nolint:gochecknoglobals diff --git a/test/fakeapi/controller_session.go b/test/fakeapi/controller_session.go index cecde24..08a5f0b 100644 --- a/test/fakeapi/controller_session.go +++ b/test/fakeapi/controller_session.go @@ -21,7 +21,7 @@ import ( "bytes" "errors" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) type fakeSession struct { diff --git a/test/fakeapi/controller_user.go b/test/fakeapi/controller_user.go index 01c9e53..69817ae 100644 --- a/test/fakeapi/controller_user.go +++ b/test/fakeapi/controller_user.go @@ -17,7 +17,7 @@ package fakeapi -import "github.com/ProtonMail/proton-bridge/pkg/pmapi" +import "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" type fakeUser struct { user *pmapi.User diff --git a/test/fakeapi/counts.go b/test/fakeapi/counts.go index db04e89..9451f42 100644 --- a/test/fakeapi/counts.go +++ b/test/fakeapi/counts.go @@ -20,7 +20,7 @@ package fakeapi import ( "context" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) func (api *FakePMAPI) CountMessages(_ context.Context, addressID string) ([]*pmapi.MessagesCount, error) { diff --git a/test/fakeapi/events.go b/test/fakeapi/events.go index e9c181a..68bb10f 100644 --- a/test/fakeapi/events.go +++ b/test/fakeapi/events.go @@ -20,7 +20,7 @@ package fakeapi import ( "context" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) func (api *FakePMAPI) GetEvent(_ context.Context, eventID string) (*pmapi.Event, error) { diff --git a/test/fakeapi/fakeapi.go b/test/fakeapi/fakeapi.go index 5bd1ae6..33f62f1 100644 --- a/test/fakeapi/fakeapi.go +++ b/test/fakeapi/fakeapi.go @@ -22,7 +22,7 @@ import ( "fmt" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/sirupsen/logrus" ) diff --git a/test/fakeapi/keys.go b/test/fakeapi/keys.go index 49cd622..d122aa0 100644 --- a/test/fakeapi/keys.go +++ b/test/fakeapi/keys.go @@ -20,7 +20,7 @@ package fakeapi import ( "context" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) // publicKey is used from pmapi unit tests. diff --git a/test/fakeapi/labels.go b/test/fakeapi/labels.go index 083681f..63d3693 100644 --- a/test/fakeapi/labels.go +++ b/test/fakeapi/labels.go @@ -21,7 +21,7 @@ import ( "context" "fmt" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) func (api *FakePMAPI) isLabelFolder(labelID string) bool { diff --git a/test/fakeapi/manager.go b/test/fakeapi/manager.go index 98eb20d..1f3a00d 100644 --- a/test/fakeapi/manager.go +++ b/test/fakeapi/manager.go @@ -24,7 +24,7 @@ import ( "time" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/sirupsen/logrus" ) diff --git a/test/fakeapi/messages.go b/test/fakeapi/messages.go index 8ccb2fd..0b0cf8c 100644 --- a/test/fakeapi/messages.go +++ b/test/fakeapi/messages.go @@ -23,8 +23,8 @@ import ( "fmt" "time" - "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" ) diff --git a/test/fakeapi/user.go b/test/fakeapi/user.go index 3ba77e7..6d23d4e 100644 --- a/test/fakeapi/user.go +++ b/test/fakeapi/user.go @@ -21,7 +21,7 @@ import ( "context" "github.com/ProtonMail/gopenpgp/v2/crypto" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" ) func (api *FakePMAPI) GetMailSettings(context.Context) (pmapi.MailSettings, error) { diff --git a/test/imap_actions_messages_test.go b/test/imap_actions_messages_test.go index 297857b..628c9d6 100644 --- a/test/imap_actions_messages_test.go +++ b/test/imap_actions_messages_test.go @@ -25,7 +25,7 @@ import ( "sync" "time" - "github.com/ProtonMail/proton-bridge/test/mocks" + "github.com/ProtonMail/proton-bridge/v2/test/mocks" "github.com/cucumber/godog" "golang.org/x/net/html/charset" ) diff --git a/test/liveapi/cleanup.go b/test/liveapi/cleanup.go index c47d078..2f94e89 100644 --- a/test/liveapi/cleanup.go +++ b/test/liveapi/cleanup.go @@ -21,7 +21,7 @@ import ( "context" "time" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" ) diff --git a/test/liveapi/controller.go b/test/liveapi/controller.go index e7af7d6..e752996 100644 --- a/test/liveapi/controller.go +++ b/test/liveapi/controller.go @@ -21,8 +21,8 @@ import ( "net/http" "sync" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - "github.com/ProtonMail/proton-bridge/test/context/calls" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/test/context/calls" "github.com/sirupsen/logrus" ) diff --git a/test/liveapi/labels.go b/test/liveapi/labels.go index 84a03c0..45f0e30 100644 --- a/test/liveapi/labels.go +++ b/test/liveapi/labels.go @@ -22,7 +22,7 @@ import ( "fmt" "strings" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" ) diff --git a/test/liveapi/messages.go b/test/liveapi/messages.go index 8110e52..9ae2d4a 100644 --- a/test/liveapi/messages.go +++ b/test/liveapi/messages.go @@ -20,8 +20,8 @@ package liveapi import ( "context" - messageUtils "github.com/ProtonMail/proton-bridge/pkg/message" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + messageUtils "github.com/ProtonMail/proton-bridge/v2/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" ) diff --git a/test/liveapi/persistent_clients.go b/test/liveapi/persistent_clients.go index f076ebe..3729421 100644 --- a/test/liveapi/persistent_clients.go +++ b/test/liveapi/persistent_clients.go @@ -24,8 +24,8 @@ import ( "sync" "github.com/ProtonMail/go-srp" - "github.com/ProtonMail/proton-bridge/internal/constants" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/internal/constants" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/test/liveapi/users.go b/test/liveapi/users.go index a3d7321..b6f533f 100644 --- a/test/liveapi/users.go +++ b/test/liveapi/users.go @@ -20,8 +20,8 @@ package liveapi import ( "context" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - "github.com/ProtonMail/proton-bridge/test/accounts" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/test/accounts" "github.com/cucumber/godog" "github.com/pkg/errors" ) diff --git a/test/main_test.go b/test/main_test.go index 032abe3..b950f1a 100644 --- a/test/main_test.go +++ b/test/main_test.go @@ -22,7 +22,7 @@ import ( "os" "testing" - "github.com/ProtonMail/proton-bridge/internal/constants" + "github.com/ProtonMail/proton-bridge/v2/internal/constants" "github.com/cucumber/godog" "github.com/cucumber/godog/colors" ) diff --git a/test/mocks/imap_client.go b/test/mocks/imap_client.go index 4ac3f2a..65896e9 100644 --- a/test/mocks/imap_client.go +++ b/test/mocks/imap_client.go @@ -25,7 +25,7 @@ import ( "sync" "time" - "github.com/ProtonMail/proton-bridge/pkg/message" + "github.com/ProtonMail/proton-bridge/v2/pkg/message" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/test/mocks/imap_response.go b/test/mocks/imap_response.go index 7451925..d9a0f15 100644 --- a/test/mocks/imap_response.go +++ b/test/mocks/imap_response.go @@ -51,7 +51,6 @@ func (ir *IMAPResponse) sendCommand(reqTag string, reqIndex int, command string, var section string for { line, err := response.ReadString('\n') - if err != nil { ir.err = errors.Wrap(err, "read response failed") debug.printErr(ir.err.Error() + "\n") diff --git a/test/smtp_actions_test.go b/test/smtp_actions_test.go index 5af6008..3abc332 100644 --- a/test/smtp_actions_test.go +++ b/test/smtp_actions_test.go @@ -111,9 +111,11 @@ func smtpClientNamedSendsMessageWithBCC(clientID, bcc string, message *godog.Doc func smtpClientSendsCommand(command string) error { return smtpClientNamedSendsCommand("smtp", command) } + func smtpClientSendsCommandMultiline(command *godog.DocString) error { return smtpClientNamedSendsCommand("smtp", command.Content) } + func smtpClientNamedSendsCommand(clientName, command string) error { command = strings.ReplaceAll(command, "\\r", "\r") command = strings.ReplaceAll(command, "\\n", "\n") diff --git a/test/store_checks_test.go b/test/store_checks_test.go index f7c4fd0..896ad8f 100644 --- a/test/store_checks_test.go +++ b/test/store_checks_test.go @@ -23,9 +23,9 @@ import ( "time" "github.com/ProtonMail/go-rfc5322" - "github.com/ProtonMail/proton-bridge/internal/store" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" - "github.com/ProtonMail/proton-bridge/test/accounts" + "github.com/ProtonMail/proton-bridge/v2/internal/store" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/test/accounts" "github.com/cucumber/godog" "github.com/cucumber/messages-go/v16" "github.com/hashicorp/go-multierror" diff --git a/test/store_setup_test.go b/test/store_setup_test.go index def49da..d059374 100644 --- a/test/store_setup_test.go +++ b/test/store_setup_test.go @@ -25,7 +25,7 @@ import ( "strings" "time" - "github.com/ProtonMail/proton-bridge/pkg/pmapi" + "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi" "github.com/cucumber/godog" ) diff --git a/utils/hasher/main.go b/utils/hasher/main.go index 65bbf24..38e4484 100644 --- a/utils/hasher/main.go +++ b/utils/hasher/main.go @@ -20,7 +20,7 @@ package main import ( "os" - "github.com/ProtonMail/proton-bridge/pkg/sum" + "github.com/ProtonMail/proton-bridge/v2/pkg/sum" "github.com/sirupsen/logrus" "github.com/urfave/cli/v2" ) diff --git a/utils/versioner/main.go b/utils/versioner/main.go index a692e8f..734c80a 100644 --- a/utils/versioner/main.go +++ b/utils/versioner/main.go @@ -24,7 +24,7 @@ import ( "os" "github.com/Masterminds/semver/v3" - "github.com/ProtonMail/proton-bridge/internal/updater" + "github.com/ProtonMail/proton-bridge/v2/internal/updater" "github.com/go-resty/resty/v2" "github.com/sirupsen/logrus" "github.com/urfave/cli/v2"