diff --git a/cmd/piwigo-cli/categories.go b/cmd/piwigo-cli/categories.go index 26d3db2..a3be9a0 100644 --- a/cmd/piwigo-cli/categories.go +++ b/cmd/piwigo-cli/categories.go @@ -7,5 +7,8 @@ type CategoriesGroup struct { var categoriesGroup CategoriesGroup func init() { - parser.AddCommand("categories", "Categories management", "", &categoriesGroup) + _, err := parser.AddCommand("categories", "Categories management", "", &categoriesGroup) + if err != nil { + panic(err) + } } diff --git a/cmd/piwigo-cli/general.go b/cmd/piwigo-cli/general.go index 8c3b86a..51b37ee 100644 --- a/cmd/piwigo-cli/general.go +++ b/cmd/piwigo-cli/general.go @@ -55,5 +55,8 @@ func (c *GetInfosCommand) Execute(args []string) error { } func init() { - parser.AddCommand("getinfos", "Get general information", "", &getInfosCommand) + _, err := parser.AddCommand("getinfos", "Get general information", "", &getInfosCommand) + if err != nil { + panic(err) + } } diff --git a/cmd/piwigo-cli/images.go b/cmd/piwigo-cli/images.go index 30fead8..a40fff9 100644 --- a/cmd/piwigo-cli/images.go +++ b/cmd/piwigo-cli/images.go @@ -11,5 +11,8 @@ type ImagesGroup struct { var imagesGroup ImagesGroup func init() { - parser.AddCommand("images", "Images management", "", &imagesGroup) + _, err := parser.AddCommand("images", "Images management", "", &imagesGroup) + if err != nil { + panic(err) + } } diff --git a/cmd/piwigo-cli/images_list.go b/cmd/piwigo-cli/images_list.go index e88454f..cefa9a5 100644 --- a/cmd/piwigo-cli/images_list.go +++ b/cmd/piwigo-cli/images_list.go @@ -64,7 +64,7 @@ func (c *ImagesListCommand) Execute(args []string) error { bar := progressbar.Default(1, "listing") progressbar.OptionOnCompletion(func() { - os.Stderr.WriteString("\n") + _, _ = os.Stderr.WriteString("\n") })(bar) for page := 0; ; page++ { var resp ImagesListResult @@ -95,14 +95,14 @@ func (c *ImagesListCommand) Execute(args []string) error { } rootTree.AddPath(filename) } - bar.Add(1) + _ = bar.Add(1) } if resp.Paging.Count < resp.Paging.PerPage { break } } - bar.Close() + _ = bar.Close() var results chan string if c.Tree { diff --git a/cmd/piwigo-cli/images_tag.go b/cmd/piwigo-cli/images_tag.go index f424a11..7716761 100644 --- a/cmd/piwigo-cli/images_tag.go +++ b/cmd/piwigo-cli/images_tag.go @@ -134,7 +134,7 @@ func (c *ImagesTagCommand) Execute(args []string) error { if len(sel) == 0 { exit := false - survey.AskOne(&survey.Confirm{ + _ = survey.AskOne(&survey.Confirm{ Message: "Selection is empty, exit:", Default: false, }, &exit) @@ -144,7 +144,7 @@ func (c *ImagesTagCommand) Execute(args []string) error { } confirmSel := false - survey.AskOne(&survey.Confirm{ + _ = survey.AskOne(&survey.Confirm{ Message: "Confirm:", Default: true, }, &confirmSel) diff --git a/cmd/piwigo-cli/method.go b/cmd/piwigo-cli/method.go index fcf97c0..1b65d56 100644 --- a/cmd/piwigo-cli/method.go +++ b/cmd/piwigo-cli/method.go @@ -9,5 +9,8 @@ type MethodGroup struct { var methodGroup MethodGroup func init() { - parser.AddCommand("method", "Reflexion management", "", &methodGroup) + _, err := parser.AddCommand("method", "Reflexion management", "", &methodGroup) + if err != nil { + panic(err) + } } diff --git a/cmd/piwigo-cli/session.go b/cmd/piwigo-cli/session.go index 5b7487a..d1d5abd 100644 --- a/cmd/piwigo-cli/session.go +++ b/cmd/piwigo-cli/session.go @@ -8,5 +8,8 @@ type SessionGroup struct { var sessionGroup SessionGroup func init() { - parser.AddCommand("session", "Session management", "", &sessionGroup) + _, err := parser.AddCommand("session", "Session management", "", &sessionGroup) + if err != nil { + panic(err) + } } diff --git a/internal/piwigo/files.go b/internal/piwigo/files.go index f6d43cd..b07b090 100644 --- a/internal/piwigo/files.go +++ b/internal/piwigo/files.go @@ -106,7 +106,9 @@ func (p *Piwigo) Upload(file *piwigotools.FileToUpload, stat *piwigotools.FileTo if hasVideoJS { switch *file.Ext() { case "ogg", "ogv", "mp4", "m4v", "webm", "webmv": - p.VideoJSSync(resp.ImageId) + if err := p.VideoJSSync(resp.ImageId); err != nil { + stat.Error("VideoJSSync", *file.FullPath(), err) + } } } diff --git a/internal/piwigo/login.go b/internal/piwigo/login.go index e88d657..19cbf28 100644 --- a/internal/piwigo/login.go +++ b/internal/piwigo/login.go @@ -28,7 +28,9 @@ func (p *Piwigo) GetStatus() (*StatusResponse, error) { return nil, err } - p.Post("pwg.plugins.getList", nil, &resp.Plugins) + if err := p.Post("pwg.plugins.getList", nil, &resp.Plugins); err != nil { + return nil, err + } if resp.User == p.Username { return resp, nil diff --git a/internal/piwigo/piwigotools/file_to_upload.go b/internal/piwigo/piwigotools/file_to_upload.go index 742f1c4..25d0817 100644 --- a/internal/piwigo/piwigotools/file_to_upload.go +++ b/internal/piwigo/piwigotools/file_to_upload.go @@ -178,9 +178,9 @@ func (f *FileToUpload) Base64BuildChunk() (chan *FileToUploadChunk, error) { break } bf.Size += int64(n) - b64.Write(b[:n]) + _, _ = b64.Write(b[:n]) } - b64.Close() + _ = b64.Close() if bf.Size > 0 { out <- bf } diff --git a/internal/piwigo/piwigotools/tags.go b/internal/piwigo/piwigotools/tags.go index 13b502a..8b99422 100644 --- a/internal/piwigo/piwigotools/tags.go +++ b/internal/piwigo/piwigotools/tags.go @@ -67,7 +67,7 @@ func (t Tags) Selector(exclude *regexp.Regexp, keepFilter bool, keepPreviousAnsw return func() Tags { answer := []string{} - survey.AskOne(&survey.MultiSelect{ + _ = survey.AskOne(&survey.MultiSelect{ Message: "Tags:", Options: options, PageSize: 20,