diff --git a/src/.golangci.yml b/src/.golangci.yml index cab49644a..a1eb89709 100644 --- a/src/.golangci.yml +++ b/src/.golangci.yml @@ -6,6 +6,7 @@ linters: - gci - gofmt - gofumpt + - lll - misspell - revive @@ -16,6 +17,8 @@ linters-settings: - default - prefix(github.com/alcionai/corso) skip-generated: true + lll: + line-length: 120 revive: max-open-files: 2048 # Don't know why, but false means ignore generated files. diff --git a/src/cli/backup/exchange.go b/src/cli/backup/exchange.go index 1d79fdf13..7d10ba3f8 100644 --- a/src/cli/backup/exchange.go +++ b/src/cli/backup/exchange.go @@ -54,7 +54,12 @@ func addExchangeCommands(parent *cobra.Command) *cobra.Command { case createCommand: c, fs = utils.AddCommand(parent, exchangeCreateCmd()) - fs.StringSliceVar(&user, "user", nil, "Backup Exchange data by user ID; accepts "+utils.Wildcard+" to select all users") + fs.StringSliceVar( + &user, + "user", + nil, + "Backup Exchange data by user ID; accepts "+utils.Wildcard+" to select all users", + ) fs.BoolVar(&exchangeAll, "all", false, "Backup all Exchange data for all users") fs.StringSliceVar( &exchangeData, @@ -72,20 +77,41 @@ func addExchangeCommands(parent *cobra.Command) *cobra.Command { cobra.CheckErr(c.MarkFlagRequired("backup")) // per-data-type flags - fs.StringSliceVar(&contact, "contact", nil, "Select backup details by contact ID; accepts "+utils.Wildcard+" to select all contacts") + fs.StringSliceVar( + &contact, + "contact", + nil, + "Select backup details by contact ID; accepts "+utils.Wildcard+" to select all contacts", + ) fs.StringSliceVar( &contactFolder, "contact-folder", nil, - "Select backup details by contact folder ID; accepts "+utils.Wildcard+" to select all contact folders") - fs.StringSliceVar(&email, "email", nil, "Select backup details by emails ID; accepts "+utils.Wildcard+" to select all emails") + "Select backup details by contact folder ID; accepts "+utils.Wildcard+" to select all contact folders", + ) + fs.StringSliceVar( + &email, + "email", + nil, + "Select backup details by emails ID; accepts "+utils.Wildcard+" to select all emails", + ) fs.StringSliceVar( &emailFolder, "email-folder", nil, "Select backup details by email folder ID; accepts "+utils.Wildcard+" to select all email folderss") - fs.StringSliceVar(&event, "event", nil, "Select backup details by event ID; accepts "+utils.Wildcard+" to select all events") - fs.StringSliceVar(&user, "user", nil, "Select backup details by user ID; accepts "+utils.Wildcard+" to select all users") + fs.StringSliceVar( + &event, + "event", + nil, + "Select backup details by event ID; accepts "+utils.Wildcard+" to select all events", + ) + fs.StringSliceVar( + &user, + "user", + nil, + "Select backup details by user ID; accepts "+utils.Wildcard+" to select all users", + ) // TODO: reveal these flags when their production is supported in GC cobra.CheckErr(fs.MarkHidden("contact")) @@ -93,10 +119,25 @@ func addExchangeCommands(parent *cobra.Command) *cobra.Command { cobra.CheckErr(fs.MarkHidden("event")) // exchange-info flags - fs.StringVar(&emailReceivedAfter, "email-received-after", "", "Select backup details where the email was received after this datetime") - fs.StringVar(&emailReceivedBefore, "email-received-before", "", "Select backup details where the email was received before this datetime") + fs.StringVar( + &emailReceivedAfter, + "email-received-after", + "", + "Select backup details where the email was received after this datetime", + ) + fs.StringVar( + &emailReceivedBefore, + "email-received-before", + "", + "Select backup details where the email was received before this datetime", + ) fs.StringVar(&emailSender, "email-sender", "", "Select backup details where the email sender matches this user id") - fs.StringVar(&emailSubject, "email-subject", "", "Select backup details where the email subject lines contain this value") + fs.StringVar( + &emailSubject, + "email-subject", + "", + "Select backup details where the email subject lines contain this value", + ) } return c @@ -204,7 +245,8 @@ func validateExchangeBackupCreateFlags(all bool, users, data []string) error { } for _, d := range data { if d != dataContacts && d != dataEmail && d != dataEvents { - return errors.New(d + " is an unrecognized data type; must be one of " + dataContacts + ", " + dataEmail + ", or " + dataEvents) + return errors.New( + d + " is an unrecognized data type; must be one of " + dataContacts + ", " + dataEmail + ", or " + dataEvents) } } return nil @@ -459,10 +501,12 @@ func validateExchangeBackupDetailFlags( return errors.New("requires one or more --user ids, the wildcard --user *, or the --all flag") } if lc > 0 && lcf == 0 { - return errors.New("one or more --contact-folder ids or the wildcard --contact-folder * must be included to specify a --contact") + return errors.New( + "one or more --contact-folder ids or the wildcard --contact-folder * must be included to specify a --contact") } if le > 0 && lef == 0 { - return errors.New("one or more --email-folder ids or the wildcard --email-folder * must be included to specify a --email") + return errors.New( + "one or more --email-folder ids or the wildcard --email-folder * must be included to specify a --email") } return nil } diff --git a/src/cli/config/account.go b/src/cli/config/account.go index a86b5ad26..98435e0dc 100644 --- a/src/cli/config/account.go +++ b/src/cli/config/account.go @@ -33,7 +33,11 @@ func m365Overrides(in map[string]string) map[string]string { // configureAccount builds a complete account configuration from a mix of // viper properties and manual overrides. -func configureAccount(vpr *viper.Viper, readConfigFromViper bool, overrides map[string]string) (account.Account, error) { +func configureAccount( + vpr *viper.Viper, + readConfigFromViper bool, + overrides map[string]string, +) (account.Account, error) { var ( m365Cfg account.M365Config acct account.Account diff --git a/src/cli/config/config.go b/src/cli/config/config.go index cf67cf831..10d5d9485 100644 --- a/src/cli/config/config.go +++ b/src/cli/config/config.go @@ -179,7 +179,11 @@ func GetStorageAndAccount( // getSorageAndAccountWithViper implements GetSorageAndAccount, but takes in a viper // struct for testing. -func getStorageAndAccountWithViper(vpr *viper.Viper, readFromFile bool, overrides map[string]string) (storage.Storage, account.Account, error) { +func getStorageAndAccountWithViper( + vpr *viper.Viper, + readFromFile bool, + overrides map[string]string, +) (storage.Storage, account.Account, error) { var ( store storage.Storage acct account.Account diff --git a/src/cli/config/storage.go b/src/cli/config/storage.go index a048bed5d..2729756de 100644 --- a/src/cli/config/storage.go +++ b/src/cli/config/storage.go @@ -37,7 +37,11 @@ func s3Overrides(in map[string]string) map[string]string { // configureStorage builds a complete storage configuration from a mix of // viper properties and manual overrides. -func configureStorage(vpr *viper.Viper, readConfigFromViper bool, overrides map[string]string) (storage.Storage, error) { +func configureStorage( + vpr *viper.Viper, + readConfigFromViper bool, + overrides map[string]string, +) (storage.Storage, error) { var ( s3Cfg storage.S3Config store storage.Storage diff --git a/src/cli/restore/exchange.go b/src/cli/restore/exchange.go index 98c5ef80e..19ce88807 100644 --- a/src/cli/restore/exchange.go +++ b/src/cli/restore/exchange.go @@ -43,7 +43,12 @@ func addExchangeCommands(parent *cobra.Command) *cobra.Command { cobra.CheckErr(c.MarkFlagRequired("backup")) // per-data-type flags - fs.StringSliceVar(&contact, "contact", nil, "Restore contacts by ID; accepts "+utils.Wildcard+" to select all contacts") + fs.StringSliceVar( + &contact, + "contact", + nil, + "Restore contacts by ID; accepts "+utils.Wildcard+" to select all contacts", + ) fs.StringSliceVar( &contactFolder, "contact-folder", @@ -54,7 +59,8 @@ func addExchangeCommands(parent *cobra.Command) *cobra.Command { &emailFolder, "email-folder", nil, - "Restore all emails by folder ID; accepts "+utils.Wildcard+" to select all email folders") + "Restore all emails by folder ID; accepts "+utils.Wildcard+" to select all email folders", + ) fs.StringSliceVar(&event, "event", nil, "Restore events by ID; accepts "+utils.Wildcard+" to select all events") fs.StringSliceVar(&user, "user", nil, "Restore all data by user ID; accepts "+utils.Wildcard+" to select all users") @@ -64,8 +70,18 @@ func addExchangeCommands(parent *cobra.Command) *cobra.Command { cobra.CheckErr(fs.MarkHidden("event")) // exchange-info flags - fs.StringVar(&emailReceivedAfter, "email-received-after", "", "Restore mail where the email was received after this datetime") - fs.StringVar(&emailReceivedBefore, "email-received-before", "", "Restore mail where the email was received before this datetime") + fs.StringVar( + &emailReceivedAfter, + "email-received-after", + "", + "Restore mail where the email was received after this datetime", + ) + fs.StringVar( + &emailReceivedBefore, + "email-received-before", + "", + "Restore mail where the email was received before this datetime", + ) fs.StringVar(&emailSender, "email-sender", "", "Restore mail where the email sender matches this user id") fs.StringVar(&emailSubject, "email-subject", "", "Restore mail where the email subject lines contain this value") @@ -278,10 +294,12 @@ func validateExchangeRestoreFlags( return errors.New("requires one or more --user ids, the wildcard --user *, or the --all flag") } if lc > 0 && lcf == 0 { - return errors.New("one or more --contact-folder ids or the wildcard --contact-folder * must be included to specify a --contact") + return errors.New( + "one or more --contact-folder ids or the wildcard --contact-folder * must be included to specify a --contact") } if le > 0 && lef == 0 { - return errors.New("one or more --email-folder ids or the wildcard --email-folder * must be included to specify a --email") + return errors.New( + "one or more --email-folder ids or the wildcard --email-folder * must be included to specify a --email") } return nil } diff --git a/src/internal/connector/exchange/exchange_data_collection.go b/src/internal/connector/exchange/exchange_data_collection.go index 19514d2ea..72efe9e38 100644 --- a/src/internal/connector/exchange/exchange_data_collection.go +++ b/src/internal/connector/exchange/exchange_data_collection.go @@ -29,7 +29,8 @@ var ( const ( collectionChannelBufferSize = 1000 numberOfRetries = 4 - // RestorePropertyTag defined: https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagmessageflags-canonical-property + // RestorePropertyTag defined: + // https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagmessageflags-canonical-property RestorePropertyTag = "Integer 0x0E07" RestoreCanonicalEnableValue = "4" ) diff --git a/src/internal/connector/exchange/service_functions.go b/src/internal/connector/exchange/service_functions.go index d5f2e515b..c0728ce2a 100644 --- a/src/internal/connector/exchange/service_functions.go +++ b/src/internal/connector/exchange/service_functions.go @@ -100,7 +100,8 @@ func GetAllMailFolders(gs graph.Service, user, nameContains string) ([]MailFolde return nil, err } - iter, err := msgraphgocore.NewPageIterator(resp, gs.Adapter(), models.CreateMailFolderCollectionResponseFromDiscriminatorValue) + iter, err := msgraphgocore.NewPageIterator( + resp, gs.Adapter(), models.CreateMailFolderCollectionResponseFromDiscriminatorValue) if err != nil { return nil, err } @@ -140,14 +141,22 @@ func GetMailFolderID(service graph.Service, folderName, user string) (*string, e if err != nil { return nil, err } - response, err := service.Client().UsersById(user).MailFolders().GetWithRequestConfigurationAndResponseHandler(options, nil) + response, err := service. + Client(). + UsersById(user). + MailFolders(). + GetWithRequestConfigurationAndResponseHandler(options, nil) if err != nil { return nil, err } if response == nil { return nil, errors.New("mail folder query to m365 back store returned nil") } - pageIterator, err := msgraphgocore.NewPageIterator(response, service.Adapter(), models.CreateMailFolderCollectionResponseFromDiscriminatorValue) + pageIterator, err := msgraphgocore.NewPageIterator( + response, + service.Adapter(), + models.CreateMailFolderCollectionResponseFromDiscriminatorValue, + ) if err != nil { return nil, err } diff --git a/src/internal/connector/graph/service_helper.go b/src/internal/connector/graph/service_helper.go index 814673142..6172ccc8a 100644 --- a/src/internal/connector/graph/service_helper.go +++ b/src/internal/connector/graph/service_helper.go @@ -14,7 +14,10 @@ func CreateAdapter(tenant, client, secret string) (*msgraphsdk.GraphRequestAdapt if err != nil { return nil, err } - auth, err := ka.NewAzureIdentityAuthenticationProviderWithScopes(cred, []string{"https://graph.microsoft.com/.default"}) + auth, err := ka.NewAzureIdentityAuthenticationProviderWithScopes( + cred, + []string{"https://graph.microsoft.com/.default"}, + ) if err != nil { return nil, err } diff --git a/src/internal/connector/graph_connector.go b/src/internal/connector/graph_connector.go index f66833381..ff4c77de0 100644 --- a/src/internal/connector/graph_connector.go +++ b/src/internal/connector/graph_connector.go @@ -132,7 +132,11 @@ func (gc *GraphConnector) setTenantUsers() error { err = support.WrapAndAppend("general access", errors.New("connector failed: No access"), err) return err } - userIterator, err := msgraphgocore.NewPageIterator(response, &gc.graphService.adapter, models.CreateUserCollectionResponseFromDiscriminatorValue) + userIterator, err := msgraphgocore.NewPageIterator( + response, + &gc.graphService.adapter, + models.CreateUserCollectionResponseFromDiscriminatorValue, + ) if err != nil { return err } @@ -183,7 +187,10 @@ func buildFromMap(isKey bool, mapping map[string]string) []string { // use to read mailbox data out for the specified user // Assumption: User exists // Add iota to this call -> mail, contacts, calendar, etc. -func (gc *GraphConnector) ExchangeDataCollection(ctx context.Context, selector selectors.Selector) ([]data.Collection, error) { +func (gc *GraphConnector) ExchangeDataCollection( + ctx context.Context, + selector selectors.Selector, +) ([]data.Collection, error) { eb, err := selector.ToExchangeBackup() if err != nil { return nil, errors.Wrap(err, "collecting exchange data") diff --git a/src/internal/connector/graph_connector_disconnected_test.go b/src/internal/connector/graph_connector_disconnected_test.go index 769e028bf..97922e497 100644 --- a/src/internal/connector/graph_connector_disconnected_test.go +++ b/src/internal/connector/graph_connector_disconnected_test.go @@ -100,7 +100,12 @@ func (suite *DisconnectedGraphConnectorSuite) TestGraphConnector_Status() { context.Background(), support.Restore, 12, 9, 8, - support.WrapAndAppend("tres", errors.New("three"), support.WrapAndAppend("arc376", errors.New("one"), errors.New("two")))) + support.WrapAndAppend( + "tres", + errors.New("three"), + support.WrapAndAppend("arc376", errors.New("one"), errors.New("two")), + ), + ) gc.statusCh <- status }() gc.AwaitStatus() diff --git a/src/internal/connector/mockconnector/mock_data_collection.go b/src/internal/connector/mockconnector/mock_data_collection.go index 36f5cdc60..3360795bc 100644 --- a/src/internal/connector/mockconnector/mock_data_collection.go +++ b/src/internal/connector/mockconnector/mock_data_collection.go @@ -81,7 +81,13 @@ func (med *MockExchangeData) ToReader() io.ReadCloser { } func (med *MockExchangeData) Info() details.ItemInfo { - return details.ItemInfo{Exchange: &details.ExchangeInfo{Sender: "foo@bar.com", Subject: "Hello world!", Received: time.Now()}} + return details.ItemInfo{ + Exchange: &details.ExchangeInfo{ + Sender: "foo@bar.com", + Subject: "Hello world!", + Received: time.Now(), + }, + } } // GetMockMessageBytes returns bytes for Messageable item. @@ -89,7 +95,9 @@ func (med *MockExchangeData) Info() details.ItemInfo { func GetMockMessageBytes(subject string) []byte { userID := "foobar@8qzvrj.onmicrosoft.com" + //nolint:lll message := "{\n \"@odata.etag\": \"W/\\\"CQAAABYAAAB8wYc0thTTTYl3RpEYIUq+AAAZ0f0I\\\"\",\n \"id\": \"AAMkAGQ1NzViZTdhLTEwMTMtNGJjNi05YWI2LTg4NWRlZDA2Y2UxOABGAAAAAAAPvVwUramXT7jlSGpVU8_7BwB8wYc0thTTTYl3RpEYIUq_AAAAAAEMAAB8wYc0thTTTYl3RpEYIUq_AAAZ3wG3AAA=\",\n \"createdDateTime\": \"2022-04-08T18:08:02Z\",\n \"lastModifiedDateTime\": \"2022-05-17T13:46:55Z\",\n \"changeKey\": \"CQAAABYAAAB8wYc0thTTTYl3RpEYIUq+AAAZ0f0I\",\n \"categories\": [],\n \"receivedDateTime\": \"2022-04-08T18:08:02Z\",\n \"sentDateTime\": \"2022-04-08T18:07:53Z\",\n \"hasAttachments\": false,\n \"internetMessageId\": \"\",\n \"subject\": \"" + + //nolint:lll subject + " " + common.FormatNow(common.SimpleDateTimeFormat) + " Different\",\n \"bodyPreview\": \"Who is coming to next week's party? I cannot imagine it is July soon\",\n \"importance\": \"normal\",\n \"parentFolderId\": \"AQMkAGQ1NzViZTdhLTEwMTMtNGJjNi05YWI2LTg4ADVkZWQwNmNlMTgALgAAAw_9XBStqZdPuOVIalVTz7sBAHzBhzS2FNNNiXdGkRghSr4AAAIBDAAAAA==\",\n \"conversationId\": \"AAQkAGQ1NzViZTdhLTEwMTMtNGJjNi05YWI2LTg4NWRlZDA2Y2UxOAAQAI7SSzmEPaRJsY-TWIALn1g=\",\n \"conversationIndex\": \"AQHYS3N3jtJLOYQ9pEmxj9NYgAufWA==\",\n \"isDeliveryReceiptRequested\": null,\n \"isReadReceiptRequested\": false,\n \"isRead\": true,\n \"isDraft\": false,\n \"webLink\": \"https://outlook.office365.com/owa/?ItemID=AAMkAGQ1NzViZTdhLTEwMTMtNGJjNi05YWI2LTg4NWRlZDA2Y2UxOABGAAAAAAAPvVwUramXT7jlSGpVU8%2B7BwB8wYc0thTTTYl3RpEYIUq%2BAAAAAAEMAAB8wYc0thTTTYl3RpEYIUq%2BAAAZ3wG3AAA%3D&exvsurl=1&viewmodel=ReadMessageItem\",\n \"inferenceClassification\": \"focused\",\n \"body\": {\n \"contentType\": \"html\",\n \"content\": \"

I've been going through with the changing of messages. It shouldn't have the same calls, right? Call Me?

 

We want to be able to send multiple messages and we want to be able to respond and do other things that make sense for our users. In this case. Let’s consider a Mailbox

\"\n },\n \"sender\": {\n \"emailAddress\": {\n \"name\": \"Lidia Holloway\",\n \"address\": \"" + userID + "\"\n }\n },\n \"from\": {\n \"emailAddress\": {\n \"name\": \"Lidia Holloway\",\n \"address\": \"lidiah@8qzvrj.onmicrosoft.com\"\n }\n },\n \"toRecipients\": [\n {\n \"emailAddress\": {\n \"name\": \"Dustin Abbot\",\n \"address\": \"dustina@8qzvrj.onmicrosoft.com\"\n }\n }\n ],\n \"ccRecipients\": [],\n \"bccRecipients\": [],\n \"replyTo\": [],\n \"flag\": {\n \"flagStatus\": \"notFlagged\"\n }\n}\n" return []byte(message) diff --git a/src/internal/connector/support/m365Transform.go b/src/internal/connector/support/m365Transform.go index a02ddd2ad..2554f887e 100644 --- a/src/internal/connector/support/m365Transform.go +++ b/src/internal/connector/support/m365Transform.go @@ -112,7 +112,12 @@ func SetEventMessageResponse(orig models.Messageable, adtl map[string]any) (mode } rType, ok := temp.(*models.ResponseType) if !ok { - return nil, fmt.Errorf("%s : responseType not returned from models.ParseResponseType: %v\t%T", *orig.GetId(), temp, temp) + return nil, fmt.Errorf( + "%s : responseType not returned from models.ParseResponseType: %v\t%T", + *orig.GetId(), + temp, + temp, + ) } message.SetResponseType(rType) default: @@ -214,7 +219,10 @@ func setEventRequestableFields( } // SetAdditionalDataToEventMessage sets shared fields for 2 types of EventMessage: Response and Request -func SetAdditionalDataToEventMessage(adtl map[string]any, newMessage models.EventMessageable) (models.EventMessageable, error) { +func SetAdditionalDataToEventMessage( + adtl map[string]any, + newMessage models.EventMessageable, +) (models.EventMessageable, error) { for key, entry := range adtl { if key == "endDateTime" { dateTime := models.NewDateTimeTimeZone() diff --git a/src/internal/connector/support/status.go b/src/internal/connector/support/status.go index 798214cf4..928355ba1 100644 --- a/src/internal/connector/support/status.go +++ b/src/internal/connector/support/status.go @@ -27,7 +27,12 @@ const ( ) // Constructor for ConnectorOperationStatus. If the counts do not agree, an error is returned. -func CreateStatus(ctx context.Context, op Operation, objects, success, folders int, err error) *ConnectorOperationStatus { +func CreateStatus( + ctx context.Context, + op Operation, + objects, success, folders int, + err error, +) *ConnectorOperationStatus { hasErrors := err != nil var reason string if err != nil { diff --git a/src/internal/connector/support/status_test.go b/src/internal/connector/support/status_test.go index 283cf45d8..36191a44b 100644 --- a/src/internal/connector/support/status_test.go +++ b/src/internal/connector/support/status_test.go @@ -40,8 +40,12 @@ func (suite *GCStatusTestSuite) TestCreateStatus() { expect: assert.False, }, { - name: "Test: Status Failed", - params: statusParams{Restore, 12, 9, 8, WrapAndAppend("tres", errors.New("three"), WrapAndAppend("arc376", errors.New("one"), errors.New("two")))}, + name: "Test: Status Failed", + params: statusParams{ + Restore, + 12, 9, 8, + WrapAndAppend("tres", errors.New("three"), WrapAndAppend("arc376", errors.New("one"), errors.New("two"))), + }, expect: assert.True, }, } diff --git a/src/internal/kopia/wrapper.go b/src/internal/kopia/wrapper.go index 60089f23f..d03c2a1e0 100644 --- a/src/internal/kopia/wrapper.go +++ b/src/internal/kopia/wrapper.go @@ -159,7 +159,11 @@ func newTreeMap() *treeMap { // ancestor of the streams and uses virtualfs.StaticDirectory for internal nodes // in the hierarchy. Leaf nodes are virtualfs.StreamingDirectory with the given // DataCollections. -func inflateDirTree(ctx context.Context, collections []data.Collection, snapshotDetails *details.Details) (fs.Directory, error) { +func inflateDirTree( + ctx context.Context, + collections []data.Collection, + snapshotDetails *details.Details, +) (fs.Directory, error) { roots := make(map[string]*treeMap) for _, s := range collections { diff --git a/src/internal/operations/backup.go b/src/internal/operations/backup.go index 7476558bc..267b3e394 100644 --- a/src/internal/operations/backup.go +++ b/src/internal/operations/backup.go @@ -144,7 +144,11 @@ func (op *BackupOperation) persistResults( } // stores the operation details, results, and selectors in the backup manifest. -func (op *BackupOperation) createBackupModels(ctx context.Context, snapID string, backupDetails *details.Details) error { +func (op *BackupOperation) createBackupModels( + ctx context.Context, + snapID string, + backupDetails *details.Details, +) error { err := op.store.Put(ctx, model.BackupDetailsSchema, &backupDetails.DetailsModel) if err != nil { return errors.Wrap(err, "creating backupdetails model") diff --git a/src/internal/tester/config.go b/src/internal/tester/config.go index 04cc2c5a9..ef97c4170 100644 --- a/src/internal/tester/config.go +++ b/src/internal/tester/config.go @@ -98,7 +98,13 @@ func readTestConfig() (map[string]string, error) { fallbackTo(testEnv, TestCfgEndpoint, vpr.GetString(TestCfgEndpoint), "s3.amazonaws.com") fallbackTo(testEnv, TestCfgPrefix, vpr.GetString(TestCfgPrefix)) fallbackTo(testEnv, TestCfgTenantID, os.Getenv(account.TenantID), vpr.GetString(TestCfgTenantID)) - fallbackTo(testEnv, TestCfgUserID, os.Getenv(EnvCorsoM365TestUserID), vpr.GetString(TestCfgTenantID), "lidiah@8qzvrj.onmicrosoft.com") + fallbackTo( + testEnv, + TestCfgUserID, + os.Getenv(EnvCorsoM365TestUserID), + vpr.GetString(TestCfgTenantID), + "lidiah@8qzvrj.onmicrosoft.com", + ) testEnv[EnvCorsoTestConfigFilePath] = os.Getenv(EnvCorsoTestConfigFilePath) testConfig = testEnv diff --git a/src/pkg/repository/repository.go b/src/pkg/repository/repository.go index b6aa701eb..5f1d44a43 100644 --- a/src/pkg/repository/repository.go +++ b/src/pkg/repository/repository.go @@ -130,7 +130,11 @@ func (r *Repository) Close(ctx context.Context) error { } // NewBackup generates a BackupOperation runner. -func (r Repository) NewBackup(ctx context.Context, selector selectors.Selector, opts control.Options) (operations.BackupOperation, error) { +func (r Repository) NewBackup( + ctx context.Context, + selector selectors.Selector, + opts control.Options, +) (operations.BackupOperation, error) { return operations.NewBackupOperation( ctx, opts, diff --git a/src/pkg/selectors/selectors.go b/src/pkg/selectors/selectors.go index 57ac17878..e508f8685 100644 --- a/src/pkg/selectors/selectors.go +++ b/src/pkg/selectors/selectors.go @@ -63,10 +63,16 @@ const All = "All" // The core selector. Has no api for setting or retrieving data. // Is only used to pass along more specific selector instances. type Selector struct { - Service service `json:"service,omitempty"` // The service scope of the data. Exchange, Teams, Sharepoint, etc. - Excludes []map[string]string `json:"exclusions,omitempty"` // A slice of exclusion scopes. Exclusions apply globally to all inclusions/filters, with any-match behavior. - Filters []map[string]string `json:"filters,omitempty"` // A slice of filter scopes. All inclusions must also match ALL filters. - Includes []map[string]string `json:"includes,omitempty"` // A slice of inclusion scopes. Comparators must match either one of these, or all filters, to be included. + // The service scope of the data. Exchange, Teams, Sharepoint, etc. + Service service `json:"service,omitempty"` + // A slice of exclusion scopes. Exclusions apply globally to all + // inclusions/filters, with any-match behavior. + Excludes []map[string]string `json:"exclusions,omitempty"` + // A slice of filter scopes. All inclusions must also match ALL filters. + Filters []map[string]string `json:"filters,omitempty"` + // A slice of inclusion scopes. Comparators must match either one of these, + // or all filters, to be included. + Includes []map[string]string `json:"includes,omitempty"` } // helper for specific selector instance constructors. diff --git a/src/pkg/store/backup.go b/src/pkg/store/backup.go index 994bcc31e..3c2366a06 100644 --- a/src/pkg/store/backup.go +++ b/src/pkg/store/backup.go @@ -50,7 +50,10 @@ func (w Wrapper) GetDetails(ctx context.Context, detailsID manifest.ID) (*detail } // GetDetailsFromBackupID retrieves the backup.Details within the specified backup. -func (w Wrapper) GetDetailsFromBackupID(ctx context.Context, backupID model.StableID) (*details.Details, *backup.Backup, error) { +func (w Wrapper) GetDetailsFromBackupID( + ctx context.Context, + backupID model.StableID, +) (*details.Details, *backup.Backup, error) { b, err := w.GetBackup(ctx, backupID) if err != nil { return nil, nil, err