Pull request 2028: upd-golibs

Squashed commit of the following:

commit cdb77df24d1f62b2cf4b26a6e65342e6362d2091
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Oct 6 16:31:11 2023 +0300

    all: upd golibs
This commit is contained in:
Ainar Garipov
2023-10-06 16:45:48 +03:00
parent ef88f7462f
commit 8b6c260de8
15 changed files with 36 additions and 231 deletions

View File

@@ -12,8 +12,8 @@ import (
"sync"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghio"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/ioutil"
"github.com/AdguardTeam/golibs/log"
"golang.org/x/exp/slices"
)
@@ -148,12 +148,7 @@ func getTranslation(client *http.Client, url string) (data []byte, err error) {
// Go on and download the body for inspection.
}
limitReader, lrErr := aghio.LimitReader(resp.Body, readLimit)
if lrErr != nil {
// Generally shouldn't happen, since the only error returned by
// [aghio.LimitReader] is an argument error.
panic(fmt.Errorf("limit reading: %w", lrErr))
}
limitReader := ioutil.LimitReader(resp.Body, readLimit)
data, readErr := io.ReadAll(limitReader)