From ef398a04023870bbddb62967b4138bdbf4015151 Mon Sep 17 00:00:00 2001 From: pacoorozco Date: Wed, 16 Oct 2024 09:11:59 +0200 Subject: [PATCH 1/3] Remove 'Album:auto:' and 'CreateAlbums' deprecated options Signed-off-by: pacoorozco --- CHANGELOG.md | 6 +++ internal/config/config.go | 16 +----- internal/config/config_test.go | 49 ++----------------- internal/config/schema.go | 12 +---- ...DeprecatedAlbumAutoFolderNameOption.hjson} | 0 ...DeprecatedAlbumAutoFolderPathOption.hjson} | 0 .../DeprecatedCreateAlbumsOption.hjson} | 0 .../configWithoutAlbumOption.hjson} | 3 +- 8 files changed, 15 insertions(+), 71 deletions(-) rename internal/config/testdata/{valid-config/configWithDeprecatedAlbumAutoFolderNameOption.hjson => invalid-config/DeprecatedAlbumAutoFolderNameOption.hjson} (100%) rename internal/config/testdata/{valid-config/configWithDeprecatedAlbumAutoFolderPathOption.hjson => invalid-config/DeprecatedAlbumAutoFolderPathOption.hjson} (100%) rename internal/config/testdata/{valid-config/configWithDeprecatedCreateAlbumsOption.hjson => invalid-config/DeprecatedCreateAlbumsOption.hjson} (100%) rename internal/config/testdata/{invalid-config/DeprecatedCreateAlbums.hjson => valid-config/configWithoutAlbumOption.hjson} (90%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19ad695..b0d1a2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/). +## 5.0.0 +### Removed +- The deprecated `Album: auto:folderName` and `Album: auto:folderPath` options have been removed. Use the `Album: template:%_directory%` and `Album: template:%_folderpath%` options instead. +- The deprecated `Jobs: CreateAlbums` option has been removed. Use the `Jobs: Album` option instead. +- + ## 4.6.0 ### Added - Support for the latest published Go version (1.23). This project will maintain compatibility with the latest **two major versions** published. diff --git a/internal/config/config.go b/internal/config/config.go index 1b8f2f2..77a90c1 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -168,11 +168,8 @@ func (c Config) validateJob(fs afero.Fs, job FolderUploadJob, logger log.Logger) } func (c Config) checkDeprecatedCreateAlbums(job FolderUploadJob, logger log.Logger) error { - // TODO: 'CreateAlbums' is deprecated. It should be removed on version 5.x + // 'CreateAlbums' is deprecated and it should not be used. if job.CreateAlbums != "" { - logger.Warnf("Deprecation Notice: The configuration option 'CreateAlbums' is deprecated and will be removed in a future version. Please update your configuration accordingly.") - } - if job.Album == "" && !isValidCreateAlbums(job.CreateAlbums) { return fmt.Errorf("option CreateAlbums is invalid, '%s", job.CreateAlbums) } return nil @@ -232,7 +229,7 @@ func validateAlbumOption(value string, logger log.Logger) error { case "name": return validateNameOption() case "auto": - return validateAutoOption(after, logger) + return fmt.Errorf("option Album is invalid, '%s", value) case "template": return validateTemplateOption(after) } @@ -243,15 +240,6 @@ func validateNameOption() error { return nil } -func validateAutoOption(after string, logger log.Logger) error { - // TODO: 'auto:' is deprecated. It should be removed on version 5.x - logger.Warnf("Deprecation Notice: The configuration option 'auto:%s' is deprecated and will be removed in a future version. Please update your configuration accordingly.", after) - if !isValidAlbumGenerationMethod(after) { - return fmt.Errorf("option Album is invalid: unknown album generation method '%s'", after) - } - return nil -} - func validateTemplateOption(after string) error { err := upload.ValidateAlbumNameTemplate(after) if err != nil { diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 1dc7224..2f46817 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/gphotosuploader/gphotos-uploader-cli/internal/log" "path/filepath" - "strings" "testing" "github.com/spf13/afero" @@ -68,9 +67,7 @@ func TestFromFile(t *testing.T) { }{ {"Should success with Album's name option", "testdata/valid-config/configWithAlbumNameOption.hjson", "youremail@domain.com", false}, {"Should success with Album's template containing token", "testdata/valid-config/configWithAlbumTemplateToken.hjson", "youremail@domain.com", false}, - {"Should success with deprecated Album's auto folderName option", "testdata/valid-config/configWithDeprecatedAlbumAutoFolderNameOption.hjson", "youremail@domain.com", false}, - {"Should success with deprecated Album's auto folderPath option", "testdata/valid-config/configWithDeprecatedAlbumAutoFolderPathOption.hjson", "youremail@domain.com", false}, - {"Should success with deprecated CreateAlbums option", "testdata/valid-config/configWithDeprecatedCreateAlbumsOption.hjson", "youremail@domain.com", false}, + {"Should success without Album option", "testdata/valid-config/configWithoutAlbumOption.hjson", "youremail@domain.com", false}, {"Should fail if config dir does not exist", "testdata/non-existent/config.hjson", "", true}, {"Should fail if Account is invalid", "testdata/invalid-config/EmptyAccount.hjson", "", true}, @@ -85,7 +82,9 @@ func TestFromFile(t *testing.T) { {"Should fail if Album's key is invalid", "testdata/invalid-config/AlbumBadKey.hjson", "", true}, {"Should fail if Album's name is invalid", "testdata/invalid-config/AlbumEmptyName.hjson", "", true}, {"Should fail if Album's auto value is invalid", "testdata/invalid-config/AlbumBadAutoValue.hjson", "", true}, - {"Should fail if deprecated CreateAlbums is invalid", "testdata/invalid-config/DeprecatedCreateAlbums.hjson", "", true}, + {"Should fail if deprecated CreateAlbums option is used", "testdata/invalid-config/DeprecatedCreateAlbumsOption.hjson", "", true}, + {"Should fail if deprecated Album's auto folderName option is used", "testdata/invalid-config/DeprecatedAlbumAutoFolderNameOption.hjson", "", true}, + {"Should fail if deprecated Album's auto folderPath option is used", "testdata/invalid-config/DeprecatedAlbumAutoFolderPathOption.hjson", "", true}, } for _, tc := range testCases { @@ -113,43 +112,6 @@ func (m *mockLogger) Warnf(format string, args ...interface{}) { m.messages = append(m.messages, fmt.Sprintf(format, args...)) } -func TestDeprecationNotices(t *testing.T) { - testCases := []struct { - name string - path string - want string - }{ - {"CreateAlbums option", "testdata/valid-config/configWithDeprecatedCreateAlbumsOption.hjson", "CreateAlbums"}, - {"auto:folderPath option", "testdata/valid-config/configWithDeprecatedAlbumAutoFolderPathOption.hjson", "auto:folderPath"}, - {"auto:folderName option", "testdata/valid-config/configWithDeprecatedAlbumAutoFolderNameOption.hjson", "auto:folderName"}, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - fs := afero.OsFs{} - logger := &mockLogger{} - _, err := config.FromFile(fs, tc.path, logger) - if err != nil { - t.Fatalf("Expected no error, got %v", err) - } - // Check that the deprecation notice was logged - if !contains(logger.messages, tc.want) { - t.Errorf("Expected deprecation notice for '%s', got %v", tc.want, logger.messages) - } - }) - } -} - -// contains checks if a slice contains a string -func contains(slice []string, str string) bool { - for _, v := range slice { - if strings.Contains(v, str) { - return true - } - } - return false -} - func TestConfig_SafePrint(t *testing.T) { cfg := config.Config{ APIAppCredentials: config.APIAppCredentials{ @@ -162,14 +124,13 @@ func TestConfig_SafePrint(t *testing.T) { { SourceFolder: "foo", Album: "name:albumName", - CreateAlbums: "folderPath", DeleteAfterUpload: false, IncludePatterns: []string{}, ExcludePatterns: []string{}, }, }, } - want := `{"APIAppCredentials":{"ClientID":"client-id","ClientSecret":"REMOVED"},"Account":"account","SecretsBackendType":"auto","Jobs":[{"SourceFolder":"foo","Album":"name:albumName","CreateAlbums":"folderPath","DeleteAfterUpload":false,"IncludePatterns":[],"ExcludePatterns":[]}]}` + want := `{"APIAppCredentials":{"ClientID":"client-id","ClientSecret":"REMOVED"},"Account":"account","SecretsBackendType":"auto","Jobs":[{"SourceFolder":"foo","Album":"name:albumName","DeleteAfterUpload":false,"IncludePatterns":[],"ExcludePatterns":[]}]}` if want != cfg.SafePrint() { t.Errorf("want: %s, got: %s", want, cfg.SafePrint()) diff --git a/internal/config/schema.go b/internal/config/schema.go index 39a5c18..2f7d444 100644 --- a/internal/config/schema.go +++ b/internal/config/schema.go @@ -35,8 +35,6 @@ type FolderUploadJob struct { // These are the valid values: "name:", "auto:", "template". // "name:" : Followed by the album name in Google Photos (album names are not unique, so the first to match // will be selected) - // "auto:" : (deprecated) Followed either "folderPath" or "folderName" will use an autogenerated album name based on the - // object's folder path or object's folder name. Use `template` instead. // "template": Followed by a template string that can contain the following predefine tokens and functions: // Tokens: // %_folderpath% - full path of the folder containing the file. @@ -60,15 +58,7 @@ type FolderUploadJob struct { Album string `json:"Album,omitempty"` - // CreateAlbums is the parameter to create albums on Google Photos. - // - // Deprecated: CreateAlbums exists to maintain backwards compatibility with version 4.x. It should not be used in - // favor of the Album option. - // - // Valid options were: - // Off: Disable album creation (default). - // folderPath: Creates album with the name based on full folder path. - // folderName: Creates album with the name based on the folder name. + // CreateAlbums exists to notice users about its deprecation. It should not be used in favor of the Album option. CreateAlbums string `json:"CreateAlbums,omitempty"` // DeleteAfterUpload if it is true, the app will remove files after upload them. diff --git a/internal/config/testdata/valid-config/configWithDeprecatedAlbumAutoFolderNameOption.hjson b/internal/config/testdata/invalid-config/DeprecatedAlbumAutoFolderNameOption.hjson similarity index 100% rename from internal/config/testdata/valid-config/configWithDeprecatedAlbumAutoFolderNameOption.hjson rename to internal/config/testdata/invalid-config/DeprecatedAlbumAutoFolderNameOption.hjson diff --git a/internal/config/testdata/valid-config/configWithDeprecatedAlbumAutoFolderPathOption.hjson b/internal/config/testdata/invalid-config/DeprecatedAlbumAutoFolderPathOption.hjson similarity index 100% rename from internal/config/testdata/valid-config/configWithDeprecatedAlbumAutoFolderPathOption.hjson rename to internal/config/testdata/invalid-config/DeprecatedAlbumAutoFolderPathOption.hjson diff --git a/internal/config/testdata/valid-config/configWithDeprecatedCreateAlbumsOption.hjson b/internal/config/testdata/invalid-config/DeprecatedCreateAlbumsOption.hjson similarity index 100% rename from internal/config/testdata/valid-config/configWithDeprecatedCreateAlbumsOption.hjson rename to internal/config/testdata/invalid-config/DeprecatedCreateAlbumsOption.hjson diff --git a/internal/config/testdata/invalid-config/DeprecatedCreateAlbums.hjson b/internal/config/testdata/valid-config/configWithoutAlbumOption.hjson similarity index 90% rename from internal/config/testdata/invalid-config/DeprecatedCreateAlbums.hjson rename to internal/config/testdata/valid-config/configWithoutAlbumOption.hjson index 05d44d7..5b07919 100644 --- a/internal/config/testdata/invalid-config/DeprecatedCreateAlbums.hjson +++ b/internal/config/testdata/valid-config/configWithoutAlbumOption.hjson @@ -10,10 +10,9 @@ [ { SourceFolder: ./testdata - CreateAlbums: invalid DeleteAfterUpload: false IncludePatterns: [] ExcludePatterns: [] } ] -} \ No newline at end of file +} From 8044f741b8595acf93ba8df073fb4b86ec6c91b9 Mon Sep 17 00:00:00 2001 From: pacoorozco Date: Wed, 16 Oct 2024 09:19:58 +0200 Subject: [PATCH 2/3] Update dependencies Signed-off-by: pacoorozco --- CHANGELOG.md | 14 +++++++++++++- go.mod | 12 +++++++----- go.sum | 21 ++++++++++++--------- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0d1a2c..360b9df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,22 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/). ## 5.0.0 +### Added +- Google Photos scopes have changed, some of them have been removed. The CLI will use the new ones. ([#474][i474]) + +### Changed +- Bump `golang.org/x/text` to 0.19.0 ([#479][i479]) +- Bump `golang.org/x/term` to 0.25.0 ([#478][i478]) +- Bump `github.com/schollz/progressbar/v3` to 3.16.1 ([#477][i477]) + ### Removed - The deprecated `Album: auto:folderName` and `Album: auto:folderPath` options have been removed. Use the `Album: template:%_directory%` and `Album: template:%_folderpath%` options instead. - The deprecated `Jobs: CreateAlbums` option has been removed. Use the `Jobs: Album` option instead. -- + +[i474]: https://github.com/gphotosuploader/gphotos-uploader-cli/issues/474 +[i479]: https://github.com/gphotosuploader/gphotos-uploader-cli/pull/479 +[i478]: https://github.com/gphotosuploader/gphotos-uploader-cli/pull/478 +[i477]: https://github.com/gphotosuploader/gphotos-uploader-cli/pull/477 ## 4.6.0 ### Added diff --git a/go.mod b/go.mod index 028c1b6..51fecdc 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/gphotosuploader/gphotos-uploader-cli -go 1.21 +go 1.22 + +toolchain go1.23.2 require ( github.com/99designs/keyring v1.2.2 @@ -14,7 +16,7 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/pierrec/xxHash v0.1.5 github.com/pkg/errors v0.9.1 - github.com/schollz/progressbar/v3 v3.15.0 + github.com/schollz/progressbar/v3 v3.16.1 github.com/sirupsen/logrus v1.9.3 github.com/spf13/afero v1.11.0 github.com/spf13/cobra v1.8.1 @@ -23,8 +25,8 @@ require ( github.com/syndtr/goleveldb v1.0.0 golang.org/x/oauth2 v0.23.0 golang.org/x/sync v0.8.0 - golang.org/x/term v0.24.0 - golang.org/x/text v0.18.0 + golang.org/x/term v0.25.0 + golang.org/x/text v0.19.0 ) require ( @@ -51,7 +53,7 @@ require ( github.com/mtibben/percent v0.2.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect google.golang.org/api v0.198.0 // indirect gopkg.in/yaml.v2 v2.3.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 6d32673..4ae95e7 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/bmatcuk/doublestar/v2 v2.0.4 h1:6I6oUiT/sU27eE2OFcWqBhL1SwjyvQuOssxT4a1yidI= github.com/bmatcuk/doublestar/v2 v2.0.4/go.mod h1:QMmcs3H2AUQICWhfzLXz+IYln8lRQmTZRptLie8RgRw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/chengxilo/virtualterm v1.0.4 h1:Z6IpERbRVlfB8WkOmtbHiDbBANU7cimRIof7mk9/PwM= +github.com/chengxilo/virtualterm v1.0.4/go.mod h1:DyxxBZz/x1iqJjFxTFcr6/x+jSpqN0iwWCOK1q10rlY= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -169,6 +171,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= @@ -196,8 +200,8 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/schollz/progressbar/v3 v3.15.0 h1:cNZmcNiVyea6oofBTg80ZhVXxf3wG/JoAhqCCwopkQo= -github.com/schollz/progressbar/v3 v3.15.0/go.mod h1:ncBdc++eweU0dQoeZJ3loXoAc+bjaallHRIm8pVVeQM= +github.com/schollz/progressbar/v3 v3.16.1 h1:RnF1neWZFzLCoGx8yp1yF7SDl4AzNDI5y4I0aUJRrZQ= +github.com/schollz/progressbar/v3 v3.16.1/go.mod h1:I2ILR76gz5VXqYMIY/LdLecvMHDPVcQm3W/MSKi1TME= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= @@ -209,7 +213,6 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= @@ -337,17 +340,17 @@ golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= -golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From f85086a58929a8b8b6bda4c79c740008baf873fe Mon Sep 17 00:00:00 2001 From: pacoorozco Date: Wed, 16 Oct 2024 09:23:23 +0200 Subject: [PATCH 3/3] Remove unused code Signed-off-by: pacoorozco --- internal/config/config.go | 17 ----------------- internal/config/config_test.go | 10 ---------- 2 files changed, 27 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 77a90c1..9990d7b 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -207,13 +207,6 @@ func (c Config) ensureSourceFolderAbsolutePaths() error { return nil } -func isValidAlbumGenerationMethod(method string) bool { - if method != "folderPath" && method != "folderName" { - return false - } - return true -} - // ValidateAlbumOption checks if the value is a valid Album option. func validateAlbumOption(value string, logger log.Logger) error { if value == "" { @@ -248,16 +241,6 @@ func validateTemplateOption(after string) error { return nil } -// isValidCreateAlbums checks if the value is a valid CreateAlbums option. -func isValidCreateAlbums(value string) bool { - switch value { - case "Off", "folderPath", "folderName": - return true - default: - } - return false -} - // unmarshalReader unmarshal HJSON data into the provided interface. func unmarshalReader(in io.Reader, c interface{}) error { buf := new(bytes.Buffer) diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 2f46817..1bdd8d4 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -1,7 +1,6 @@ package config_test import ( - "fmt" "github.com/gphotosuploader/gphotos-uploader-cli/internal/log" "path/filepath" "testing" @@ -103,15 +102,6 @@ func TestFromFile(t *testing.T) { } } -type mockLogger struct { - log.Logger - messages []string -} - -func (m *mockLogger) Warnf(format string, args ...interface{}) { - m.messages = append(m.messages, fmt.Sprintf(format, args...)) -} - func TestConfig_SafePrint(t *testing.T) { cfg := config.Config{ APIAppCredentials: config.APIAppCredentials{