avoid having package name in local struct

This commit is contained in:
Celogeek 2024-03-03 12:28:00 +01:00
parent d1dc0e72f6
commit f8b76a3725
Signed by: celogeek
SSH Key Fingerprint: SHA256:njNJLzoLQdbV9PC6ehcruRb0QnEgxABoCYZ+0+aUIYc

View File

@ -14,7 +14,7 @@ import (
"github.com/celogeek/piwigo-cli/internal/debug"
)
type PiwigoResult struct {
type PostResult struct {
Stat string `json:"stat"`
Err int `json:"err"`
ErrMessage string `json:"message"`
@ -46,7 +46,7 @@ func (p *Piwigo) Post(method string, form *url.Values, resp interface{}) error {
encodedForm = form.Encode()
}
Result := PiwigoResult{
result := PostResult{
Result: resp,
}
@ -81,7 +81,7 @@ func (p *Piwigo) Post(method string, form *url.Values, resp interface{}) error {
continue
}
err = json.Unmarshal(raw.Bytes(), &Result)
err = json.Unmarshal(raw.Bytes(), &result)
if err != nil {
_ = r.Body.Close()
continue
@ -112,8 +112,8 @@ func (p *Piwigo) Post(method string, form *url.Values, resp interface{}) error {
fmt.Println(debug.Dump(RawResult))
}
if Result.Stat != "ok" {
return fmt.Errorf("[Error %d] %s", Result.Err, Result.ErrMessage)
if result.Stat != "ok" {
return fmt.Errorf("[Error %d] %s", result.Err, result.ErrMessage)
}
return nil