summaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-07-14 20:06:44 -0500
committerChristian Cleberg <[email protected]>2026-07-14 20:09:30 -0500
commitb97e7e1281bc33b873532938495aa02ed5cbb418 (patch)
tree4aaa8b4b9235c282a2008d0ef7a903573313d0dd /util.go
parentb9ef09f5e2639cdf77859fcf141ef5fd17a23721 (diff)
downloaddevianter-b97e7e1281bc33b873532938495aa02ed5cbb418.tar.gz
devianter-b97e7e1281bc33b873532938495aa02ed5cbb418.tar.bz2
devianter-b97e7e1281bc33b873532938495aa02ed5cbb418.zip
fix: restore optional username in PerformSearch, apply gofmtv0.3.1
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.
Diffstat (limited to 'util.go')
-rw-r--r--util.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/util.go b/util.go
index ac3e3e4..1f5c0e3 100644
--- a/util.go
+++ b/util.go
@@ -27,9 +27,10 @@ func ujson(data string, output any) Error {
type Error struct {
Reason string `json:"error"`
- Error string `json:"errorDescription"`
- RAW []byte `json:"-"`
+ Error string `json:"errorDescription"`
+ RAW []byte `json:"-"`
}
+
func APIError(inputError error) (err Error) {
if inputError != nil {
err.RAW = []byte(inputError.Error())
@@ -94,11 +95,11 @@ func request(uri string, other ...string) reqrt {
r.Err = e
return r
}
- defer func() {
- if err := resp.Body.Close(); err != nil {
- try(err)
- }
- }()
+ defer func() {
+ if err := resp.Body.Close(); err != nil {
+ try(err)
+ }
+ }()
body, e := io.ReadAll(resp.Body)
if e != nil {