From b97e7e1281bc33b873532938495aa02ed5cbb418 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Tue, 14 Jul 2026 20:06:44 -0500 Subject: fix: restore optional username in PerformSearch, apply gofmt The golangci-lint cleanup added a top-level `user == nil` guard to PerformSearch, but `user` is variadic and only required for the 'g' and 'f' scopes. The guard made every 'a'/'t' search fail with "missing username" before issuing a request, breaking general search for all callers. The correctly scoped check inside the 'g','f' case already covers the case that needs it. Also run gofmt: the same cleanup introduced space indentation in deviantion.go, user-group.go, and util.go, which fails the gofmt CI step. --- user-group.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'user-group.go') diff --git a/user-group.go b/user-group.go index d84c2c8..dba8a91 100644 --- a/user-group.go +++ b/user-group.go @@ -76,12 +76,12 @@ type Group struct { // подходит как группа, так и пользователь func (s Group) Get() (g GRuser, daError Error, err error) { - if s.Name == "" { - return g, daError, errors.New("missing Name field") - } - daError = ujson("dauserprofile/init/about?username="+s.Name, &g) + if s.Name == "" { + return g, daError, errors.New("missing Name field") + } + daError = ujson("dauserprofile/init/about?username="+s.Name, &g) - return + return } func (s Group) Favourites(page int, all bool, folderid ...int) (g Group, err Error) { @@ -111,9 +111,9 @@ func (s Group) Favourites(page int, all bool, folderid ...int) (g Group, err Err // гарелея пользователя или группы func (s Group) Gallery(page int, folderid ...int) (g Group, daError Error, err error) { - if s.Name == "" { - return g, daError, errors.New("missing Name field") - } + if s.Name == "" { + return g, daError, errors.New("missing Name field") + } var url strings.Builder if folderid[0] > 0 { @@ -135,8 +135,8 @@ func (s Group) Gallery(page int, folderid ...int) (g Group, daError Error, err e url.WriteString("limit=50") url.WriteString("&with_subfolders=false") - daError = ujson(url.String(), &g.Content) - return + daError = ujson(url.String(), &g.Content) + return } type GroupAbout struct { -- cgit v1.2.3