docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
sequencelengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
return h, errors.Error("could not find hardware port info")
<mask> re := regexp.MustCompile("IP address: (.*?)\nSubnet mask: (.*?)\nRouter: (.*?)\n") <mask> <mask> match := re.FindStringSubmatch(out) <mask> if len(match) == 0 { <mask> return h, errors.New("could not find hardware port info") <mask> } <mask> <mask> h.name = hardwarePort <mask> h.ip = match[1] <mask> h.subnet = match[2] </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return nil, errors.New("couldn't find any legible interface") </s> add return nil, errors.Error("couldn't find any legible interface") </s> remove return nil, errors.New("found no DNS servers in /etc/resolv.conf") </s> add return nil, errors.Error("found no DNS servers in /etc/resolv.conf") </s> remove return nil, errors.New("newBroadcastPacketConn(): not supported on Windows") </s> add return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows") </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove defer agherr.Annotate("validating hardware address %q: %w", &err, hwa) </s> add defer func() { err = errors.Annotate(err, "validating hardware address %q: %w", hwa) }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/net_darwin.go
return errors.Error("IP address is already static")
<mask> return err <mask> } <mask> <mask> if portInfo.static { <mask> return errors.New("IP address is already static") <mask> } <mask> <mask> dnsAddrs, err := getEtcResolvConfServers() <mask> if err != nil { <mask> return err </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("static lease already exists") </s> add return errors.Error("static lease already exists") </s> remove return agherr.Error("static lease already exists") </s> add return errors.Error("static lease already exists") </s> remove return agherr.Error("client already exists") </s> add return errors.Error("client already exists") </s> remove } </s> add } else if err != nil { err = fmt.Errorf("tarReader.Next(): %w", err) </s> remove defer conn.Close() </s> add defer func() { err = errors.WithDeferred(err, conn.Close()) }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/net_darwin.go
return nil, errors.Error("found no DNS servers in /etc/resolv.conf")
<mask> re := regexp.MustCompile("nameserver ([a-zA-Z0-9.:]+)") <mask> <mask> matches := re.FindAllStringSubmatch(string(body), -1) <mask> if len(matches) == 0 { <mask> return nil, errors.New("found no DNS servers in /etc/resolv.conf") <mask> } <mask> <mask> addrs := make([]string, 0) <mask> for i := range matches { <mask> addrs = append(addrs, matches[i][1]) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return nil, errors.New("couldn't find any legible interface") </s> add return nil, errors.Error("couldn't find any legible interface") </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove return agherr.Error("label is empty") </s> add return errors.Error("label is empty") </s> remove return proxyConfig, errors.New("no default upstream servers configured") </s> add return proxyConfig, errors.Error("no default upstream servers configured") </s> remove return agherr.Error("no dns rewrite rule responses") </s> add return errors.Error("no dns rewrite rule responses")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/net_darwin.go
<mask> package aghnet <mask> <mask> import ( <mask> "bufio" <mask> "errors" <mask> "fmt" <mask> "io" <mask> "net" <mask> "os" <mask> "strings" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/net_linux.go
"github.com/AdguardTeam/golibs/errors"
<mask> "os" <mask> "strings" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghio" <mask> "github.com/google/renameio/maybe" <mask> ) <mask> <mask> // maxConfigFileSize is the maximum length of interfaces configuration file. <mask> const maxConfigFileSize = 1024 * 1024 <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove func (u *Updater) downloadPackageFile(url, filename string) error { resp, err := u.client.Get(url) </s> add func (u *Updater) downloadPackageFile(url, filename string) (err error) { var resp *http.Response resp, err = u.client.Get(url) </s> remove ErrTSNotFound agherr.Error = "ts not found" ErrTSTooLate agherr.Error = "ts too late" ErrTSTooEarly agherr.Error = "ts too early" </s> add ErrTSNotFound errors.Error = "ts not found" ErrTSTooLate errors.Error = "ts too late" ErrTSTooEarly errors.Error = "ts too early" </s> remove func (u *Updater) VersionInfo(forceRecheck bool) (VersionInfo, error) { </s> add func (u *Updater) VersionInfo(forceRecheck bool) (vi VersionInfo, err error) {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/net_linux.go
defer func() { err = errors.WithDeferred(err, f.Close()) }()
<mask> } <mask> <mask> return false, err <mask> } <mask> defer f.Close() <mask> <mask> var fileReadCloser io.ReadCloser <mask> fileReadCloser, err = aghio.LimitReadCloser(f, maxConfigFileSize) <mask> if err != nil { <mask> return false, err </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove var fileReadCloser io.ReadCloser fileReadCloser, err = aghio.LimitReadCloser(f, maxConfigFileSize) </s> add var fileReader io.Reader fileReader, err = aghio.LimitReader(f, maxConfigFileSize) </s> remove defer fileReadCloser.Close() </s> add </s> remove has, err = check.checker(fileReadCloser, ifaceName) </s> add has, err = check.checker(fileReader, ifaceName) </s> remove defer f.Close() fileReadCloser, err := aghio.LimitReadCloser(f, MaxFileSize) </s> add defer func() { derr := f.Close() if derr != nil { log.Error("glinet: closing file: %s", err) } }() fileReader, err := aghio.LimitReader(f, MaxFileSize) </s> remove defer c.Close() </s> add defer func() { err = errors.WithDeferred(err, c.Close()) }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/net_linux.go
var fileReader io.Reader fileReader, err = aghio.LimitReader(f, maxConfigFileSize)
<mask> return false, err <mask> } <mask> defer f.Close() <mask> <mask> var fileReadCloser io.ReadCloser <mask> fileReadCloser, err = aghio.LimitReadCloser(f, maxConfigFileSize) <mask> if err != nil { <mask> return false, err <mask> } <mask> defer fileReadCloser.Close() <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer f.Close() </s> add defer func() { err = errors.WithDeferred(err, f.Close()) }() </s> remove defer fileReadCloser.Close() </s> add </s> remove has, err = check.checker(fileReadCloser, ifaceName) </s> add has, err = check.checker(fileReader, ifaceName) </s> remove defer f.Close() fileReadCloser, err := aghio.LimitReadCloser(f, MaxFileSize) </s> add defer func() { derr := f.Close() if derr != nil { log.Error("glinet: closing file: %s", err) } }() fileReader, err := aghio.LimitReader(f, MaxFileSize) </s> remove defer c.Close() </s> add defer func() { err = errors.WithDeferred(err, c.Close()) }()
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/net_linux.go
<mask> fileReadCloser, err = aghio.LimitReadCloser(f, maxConfigFileSize) <mask> if err != nil { <mask> return false, err <mask> } <mask> defer fileReadCloser.Close() <mask> <mask> has, err = check.checker(fileReadCloser, ifaceName) <mask> if err != nil { <mask> return false, err <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove has, err = check.checker(fileReadCloser, ifaceName) </s> add has, err = check.checker(fileReader, ifaceName) </s> remove var fileReadCloser io.ReadCloser fileReadCloser, err = aghio.LimitReadCloser(f, maxConfigFileSize) </s> add var fileReader io.Reader fileReader, err = aghio.LimitReader(f, maxConfigFileSize) </s> remove defer f.Close() </s> add defer func() { err = errors.WithDeferred(err, f.Close()) }() </s> remove defer c.Close() </s> add defer func() { err = errors.WithDeferred(err, c.Close()) }() </s> remove defer c.Close() </s> add defer func() { err = errors.WithDeferred(err, c.Close()) }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/net_linux.go
has, err = check.checker(fileReader, ifaceName)
<mask> return false, err <mask> } <mask> defer fileReadCloser.Close() <mask> <mask> has, err = check.checker(fileReadCloser, ifaceName) <mask> if err != nil { <mask> return false, err <mask> } <mask> <mask> return has, nil </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer fileReadCloser.Close() </s> add </s> remove var fileReadCloser io.ReadCloser fileReadCloser, err = aghio.LimitReadCloser(f, maxConfigFileSize) </s> add var fileReader io.Reader fileReader, err = aghio.LimitReader(f, maxConfigFileSize) </s> remove defer f.Close() </s> add defer func() { err = errors.WithDeferred(err, f.Close()) }() </s> remove defer c.Close() </s> add defer func() { err = errors.WithDeferred(err, c.Close()) }() </s> remove defer c.Close() </s> add defer func() { err = errors.WithDeferred(err, c.Close()) }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/net_linux.go
return errors.Error("can't get IP address")
<mask> <mask> func ifaceSetStaticIP(ifaceName string) (err error) { <mask> ipNet := GetSubnet(ifaceName) <mask> if ipNet.IP == nil { <mask> return errors.New("can't get IP address") <mask> } <mask> <mask> gatewayIP := GatewayIP(ifaceName) <mask> add := updateStaticIPdhcpcdConf(ifaceName, ipNet.String(), gatewayIP, ipNet.IP) <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("systemResolvers: %w", &err) </s> add defer func() { err = errors.Annotate(err, "systemResolvers: %w") }() </s> remove func (l *queryLog) flushToFile(buffer []*logEntry) error { </s> add func (l *queryLog) flushToFile(buffer []*logEntry) (err error) { </s> remove defer agherr.Annotate("systemResolvers: %w", &err) </s> add defer func() { err = errors.Annotate(err, "systemResolvers: %w") }() </s> remove return agherr.Error("no dns rewrite rule content") </s> add return errors.Error("no dns rewrite rule content") </s> remove defer agherr.Annotate("parsing %q: %w", &err, host) </s> add defer func() { err = errors.Annotate(err, "parsing %q: %w", host) }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/net_linux.go
"github.com/AdguardTeam/golibs/errors"
<mask> <mask> import ( <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> // DefaultRefreshIvl is the default period of time between refreshing cached <mask> // addresses. </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers.go
errBadAddrPassed errors.Error = "the passed string is not a valid IP address"
<mask> } <mask> <mask> const ( <mask> // errBadAddrPassed is returned when dialFunc can't parse an IP address. <mask> errBadAddrPassed agherr.Error = "the passed string is not a valid IP address" <mask> <mask> // errFakeDial is an error which dialFunc is expected to return. <mask> errFakeDial agherr.Error = "this error signals the successful dialFunc work" <mask> <mask> // errUnexpectedHostFormat is returned by validateDialedHost when the host has </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove errFakeDial agherr.Error = "this error signals the successful dialFunc work" </s> add errFakeDial errors.Error = "this error signals the successful dialFunc work" </s> remove errUnexpectedHostFormat agherr.Error = "unexpected host format" </s> add errUnexpectedHostFormat errors.Error = "unexpected host format" </s> remove rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" </s> add rDNSEmptyAnswerErr errors.Error = "the answer section is empty" </s> remove const ErrNoStaticIPInfo agherr.Error = "no information about static ip" </s> add const ErrNoStaticIPInfo errors.Error = "no information about static ip" </s> remove rDNSNotPTRErr agherr.Error = "the response is not a ptr" </s> add rDNSNotPTRErr errors.Error = "the response is not a ptr"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers.go
errFakeDial errors.Error = "this error signals the successful dialFunc work"
<mask> // errBadAddrPassed is returned when dialFunc can't parse an IP address. <mask> errBadAddrPassed agherr.Error = "the passed string is not a valid IP address" <mask> <mask> // errFakeDial is an error which dialFunc is expected to return. <mask> errFakeDial agherr.Error = "this error signals the successful dialFunc work" <mask> <mask> // errUnexpectedHostFormat is returned by validateDialedHost when the host has <mask> // more than one percent sign. <mask> errUnexpectedHostFormat agherr.Error = "unexpected host format" <mask> ) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove errBadAddrPassed agherr.Error = "the passed string is not a valid IP address" </s> add errBadAddrPassed errors.Error = "the passed string is not a valid IP address" </s> remove errUnexpectedHostFormat agherr.Error = "unexpected host format" </s> add errUnexpectedHostFormat errors.Error = "unexpected host format" </s> remove rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" </s> add rDNSEmptyAnswerErr errors.Error = "the answer section is empty" </s> remove const ErrNoStaticIPInfo agherr.Error = "no information about static ip" </s> add const ErrNoStaticIPInfo errors.Error = "no information about static ip" </s> remove rDNSNotPTRErr agherr.Error = "the response is not a ptr" </s> add rDNSNotPTRErr errors.Error = "the response is not a ptr"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers.go
errUnexpectedHostFormat errors.Error = "unexpected host format"
<mask> errFakeDial agherr.Error = "this error signals the successful dialFunc work" <mask> <mask> // errUnexpectedHostFormat is returned by validateDialedHost when the host has <mask> // more than one percent sign. <mask> errUnexpectedHostFormat agherr.Error = "unexpected host format" <mask> ) <mask> <mask> // refreshWithTicker refreshes the cache of sr after each tick form tickCh. <mask> func refreshWithTicker(sr SystemResolvers, tickCh <-chan time.Time) { <mask> defer agherr.LogPanic("systemResolvers") </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove errFakeDial agherr.Error = "this error signals the successful dialFunc work" </s> add errFakeDial errors.Error = "this error signals the successful dialFunc work" </s> remove defer agherr.LogPanic("systemResolvers") </s> add defer log.OnPanic("systemResolvers") </s> remove errBadAddrPassed agherr.Error = "the passed string is not a valid IP address" </s> add errBadAddrPassed errors.Error = "the passed string is not a valid IP address" </s> remove rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" </s> add rDNSEmptyAnswerErr errors.Error = "the answer section is empty" </s> remove rDNSNotPTRErr agherr.Error = "the response is not a ptr" </s> add rDNSNotPTRErr errors.Error = "the response is not a ptr"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers.go
defer log.OnPanic("systemResolvers")
<mask> ) <mask> <mask> // refreshWithTicker refreshes the cache of sr after each tick form tickCh. <mask> func refreshWithTicker(sr SystemResolvers, tickCh <-chan time.Time) { <mask> defer agherr.LogPanic("systemResolvers") <mask> <mask> // TODO(e.burkov): Implement a functionality to stop ticker. <mask> for range tickCh { <mask> err := sr.refresh() <mask> if err != nil { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove errUnexpectedHostFormat agherr.Error = "unexpected host format" </s> add errUnexpectedHostFormat errors.Error = "unexpected host format" </s> remove defer agherr.LogPanic("rdns") </s> add defer log.OnPanic("rdns") </s> remove err := e.Encode(entry) </s> add err = e.Encode(entry) </s> remove func (l *queryLog) flushToFile(buffer []*logEntry) error { </s> add func (l *queryLog) flushToFile(buffer []*logEntry) (err error) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers.go
<mask> package aghnet <mask> <mask> import ( <mask> "context" <mask> "errors" <mask> "fmt" <mask> "net" <mask> "strings" <mask> "sync" <mask> "time" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers_others.go
<mask> "strings" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghstrings" <mask> ) <mask> <mask> // defaultHostGen is the default method of generating host for Refresh. <mask> func defaultHostGen() (host string) { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers_others.go
"github.com/AdguardTeam/golibs/errors"
<mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghstrings" <mask> ) <mask> <mask> // defaultHostGen is the default method of generating host for Refresh. <mask> func defaultHostGen() (host string) { <mask> // TODO(e.burkov): Use strings.Builder. <mask> return fmt.Sprintf("test%d.org", time.Now().UnixNano()) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove rDNSNotPTRErr agherr.Error = "the response is not a ptr" </s> add rDNSNotPTRErr errors.Error = "the response is not a ptr" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove defer agherr.LogPanic("systemResolvers") </s> add defer log.OnPanic("systemResolvers") </s> remove rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" </s> add rDNSEmptyAnswerErr errors.Error = "the answer section is empty"
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers_others.go
defer func() { err = errors.Annotate(err, "systemResolvers: %w") }()
<mask> addrsLock sync.RWMutex <mask> } <mask> <mask> func (sr *systemResolvers) refresh() (err error) { <mask> defer agherr.Annotate("systemResolvers: %w", &err) <mask> <mask> _, err = sr.resolver.LookupHost(context.Background(), sr.hostGenFunc()) <mask> dnserr := &net.DNSError{} <mask> if errors.As(err, &dnserr) && dnserr.Err == errFakeDial.Error() { <mask> return nil </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("systemResolvers: %w", &err) </s> add defer func() { err = errors.Annotate(err, "systemResolvers: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }() </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }() </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers_others.go
defer func() { err = errors.Annotate(err, "parsing %q: %w", host) }()
<mask> } <mask> <mask> // validateDialedHost validated the host used by resolvers in dialFunc. <mask> func validateDialedHost(host string) (err error) { <mask> defer agherr.Annotate("parsing %q: %w", &err, host) <mask> <mask> var ipStr string <mask> parts := strings.Split(host, "%") <mask> switch len(parts) { <mask> case 1: </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("invalid option string %q: %w", &err, s) </s> add defer func() { err = errors.Annotate(err, "invalid option string %q: %w", s) }() </s> remove return agherr.Error("question is nil") </s> add return errors.Error("question is nil") </s> remove defer agherr.Annotate("validating hardware address %q: %w", &err, hwa) </s> add defer func() { err = errors.Annotate(err, "validating hardware address %q: %w", hwa) }() </s> remove defer agherr.Annotate("normalizing %q: %w", &err, hostname) </s> add defer func() { err = errors.Annotate(err, "normalizing %q: %w", hostname) }() </s> remove defer agherr.Annotate("validating domain name %q: %w", &err, name) </s> add defer func() { err = errors.Annotate(err, "validating domain name %q: %w", name) }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers_others.go
<mask> "strings" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghio" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers_windows.go
"github.com/AdguardTeam/golibs/errors"
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghio" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> // systemResolvers implementation differs for Windows since Go's resolver </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers_windows.go
var stdoutLimited io.Reader stdoutLimited, err = aghio.LimitReader(stdout, aghos.MaxCmdOutputSize)
<mask> if err != nil { <mask> return nil, fmt.Errorf("getting the command's stdout pipe: %w", err) <mask> } <mask> <mask> var stdoutLimited io.ReadCloser <mask> stdoutLimited, err = aghio.LimitReadCloser(stdout, aghos.MaxCmdOutputSize) <mask> if err != nil { <mask> return nil, fmt.Errorf("limiting stdout reader: %w", err) <mask> } <mask> <mask> go func() { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.LogPanic("systemResolvers") </s> add defer log.OnPanic("systemResolvers") </s> remove defer func() { _ = f.Close() }() </s> add defer func() { err = errors.WithDeferred(err, f.Close()) }() </s> remove defer r.Close() </s> add defer func() { err = errors.WithDeferred(err, zrc.Close()) }() </s> remove var files []string var err2 error var zr io.ReadCloser for _, zf := range r.File { zr, err = zf.Open() </s> add for _, zf := range zrc.File { var name string name, err = zipFileUnpackOne(outDir, zf)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers_windows.go
defer log.OnPanic("systemResolvers")
<mask> return nil, fmt.Errorf("limiting stdout reader: %w", err) <mask> } <mask> <mask> go func() { <mask> defer agherr.LogPanic("systemResolvers") <mask> defer func() { <mask> derr := stdin.Close() <mask> if derr != nil { <mask> log.Error("systemResolvers: closing stdin pipe: %s", derr) <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove var stdoutLimited io.ReadCloser stdoutLimited, err = aghio.LimitReadCloser(stdout, aghos.MaxCmdOutputSize) </s> add var stdoutLimited io.Reader stdoutLimited, err = aghio.LimitReader(stdout, aghos.MaxCmdOutputSize) </s> remove defer r.Close() </s> add defer func() { derr := r.Close() if derr != nil { log.Error("querylog: closing file: %s", err) } }() </s> remove defer f.Close() fileReadCloser, err := aghio.LimitReadCloser(f, MaxFileSize) </s> add defer func() { derr := f.Close() if derr != nil { log.Error("glinet: closing file: %s", err) } }() fileReader, err := aghio.LimitReader(f, MaxFileSize) </s> remove defer f.Close() </s> add defer func() { derr := f.Close() if derr != nil { log.Error("querylog: closing file: %s", derr) } }() </s> remove defer f.Close() </s> add defer func() { derr := f.Close() if derr != nil { log.Error("etchostscontainer: closing file: %s", err) } }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers_windows.go
defer func() { err = errors.Annotate(err, "systemResolvers: %w") }()
<mask> return addrs, nil <mask> } <mask> <mask> func (sr *systemResolvers) refresh() (err error) { <mask> defer agherr.Annotate("systemResolvers: %w", &err) <mask> <mask> got, err := sr.getAddrs() <mask> if err != nil { <mask> return fmt.Errorf("can't get addresses: %w", err) <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("systemResolvers: %w", &err) </s> add defer func() { err = errors.Annotate(err, "systemResolvers: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }() </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }() </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghnet/systemresolvers_windows.go
func ReplaceLogLevel(t *testing.T, l log.Level) {
<mask> } <mask> <mask> // ReplaceLogLevel sets logging level to l and uses Cleanup method of t to <mask> // revert changes. <mask> func ReplaceLogLevel(t *testing.T, l int) { <mask> switch l { <mask> case log.INFO, log.DEBUG, log.ERROR: <mask> // Go on. <mask> default: <mask> t.Fatalf("wrong l value (must be one of %v, %v, %v)", log.INFO, log.DEBUG, log.ERROR) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("address is empty") </s> add return errors.Error("address is empty") </s> remove defer agherr.Annotate("validating label %q: %w", &err, label) </s> add defer func() { err = errors.Annotate(err, "validating label %q: %w", label) }() </s> remove return agherr.Error("label is empty") </s> add return errors.Error("label is empty") </s> remove return agherr.Error("domain name is empty") </s> add return errors.Error("domain name is empty") </s> remove defer agherr.Annotate("validating hardware address %q: %w", &err, hwa) </s> add defer func() { err = errors.Annotate(err, "validating hardware address %q: %w", hwa) }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghtest/aghtest.go
<mask> } <mask> <mask> // Exchange always returns nil Msg and non-nil error. <mask> func (u *TestErrUpstream) Exchange(*dns.Msg) (*dns.Msg, error) { <mask> // We don't use an agherr.Error to avoid the import cycle since aghtests <mask> // used to provide the utilities for testing which agherr (and any other <mask> // testable package) should be able to use. <mask> return nil, fmt.Errorf("errupstream: %w", u.Err) <mask> } <mask> <mask> // Address always returns an empty string. <mask> func (u *TestErrUpstream) Address() string { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove func (u *Updater) downloadPackageFile(url, filename string) error { resp, err := u.client.Get(url) </s> add func (u *Updater) downloadPackageFile(url, filename string) (err error) { var resp *http.Response resp, err = u.client.Get(url) </s> remove const ErrNoStaticIPInfo agherr.Error = "no information about static ip" </s> add const ErrNoStaticIPInfo errors.Error = "no information about static ip" </s> remove defer agherr.Annotate("normalizing %q: %w", &err, hostname) </s> add defer func() { err = errors.Annotate(err, "normalizing %q: %w", hostname) }() </s> remove errBadAddrPassed agherr.Error = "the passed string is not a valid IP address" </s> add errBadAddrPassed errors.Error = "the passed string is not a valid IP address" </s> remove func (l *queryLog) flushToFile(buffer []*logEntry) error { </s> add func (l *queryLog) flushToFile(buffer []*logEntry) (err error) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/aghtest/upstream.go
"github.com/AdguardTeam/golibs/errors"
<mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/insomniacslk/dhcp/dhcpv4" <mask> "github.com/insomniacslk/dhcp/dhcpv4/nclient4" <mask> "github.com/insomniacslk/dhcp/dhcpv6" <mask> "github.com/insomniacslk/dhcp/dhcpv6/nclient6" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/checkother.go
defer func() { err = errors.WithDeferred(err, c.Close()) }()
<mask> if err != nil { <mask> return false, fmt.Errorf("couldn't listen on :68: %w", err) <mask> } <mask> if c != nil { <mask> defer c.Close() <mask> } <mask> <mask> // send to 255.255.255.255:67 <mask> _, err = c.WriteTo(req.ToBytes(), dstAddr) <mask> if err != nil { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer c.Close() </s> add defer func() { err = errors.WithDeferred(err, c.Close()) }() </s> remove defer fileReadCloser.Close() </s> add </s> remove } </s> add } else if err != nil { err = fmt.Errorf("tarReader.Next(): %w", err) </s> remove defer f.Close() </s> add defer func() { err = errors.WithDeferred(err, f.Close()) }() </s> remove return nil, errors.New("couldn't find any legible interface") </s> add return nil, errors.Error("couldn't find any legible interface")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/checkother.go
defer func() { err = errors.WithDeferred(err, c.Close()) }()
<mask> if err != nil { <mask> return false, fmt.Errorf("dhcpv6: Couldn't listen on :546: %w", err) <mask> } <mask> if c != nil { <mask> defer c.Close() <mask> } <mask> <mask> _, err = c.WriteTo(req.ToBytes(), dstAddr) <mask> if err != nil { <mask> return false, fmt.Errorf("dhcpv6: Couldn't send a packet to %s: %w", dst, err) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer c.Close() </s> add defer func() { err = errors.WithDeferred(err, c.Close()) }() </s> remove defer fileReadCloser.Close() </s> add </s> remove defer f.Close() </s> add defer func() { err = errors.WithDeferred(err, f.Close()) }() </s> remove has, err = check.checker(fileReadCloser, ifaceName) </s> add has, err = check.checker(fileReader, ifaceName) </s> remove } </s> add } else if err != nil { err = fmt.Errorf("tarReader.Next(): %w", err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/checkother.go
<mask> package dhcpd <mask> <mask> import ( <mask> "encoding/json" <mask> "errors" <mask> "net" <mask> "os" <mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/db.go
"github.com/AdguardTeam/golibs/errors"
<mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/google/renameio/maybe" <mask> ) <mask> <mask> const dbFilename = "leases.db" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors"
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/db.go
<mask> package dhcpd <mask> <mask> import ( <mask> "encoding/json" <mask> "errors" <mask> "fmt" <mask> "io" <mask> "net" <mask> "net/http" <mask> "os" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/http.go
"github.com/AdguardTeam/golibs/errors"
<mask> "strings" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> func httpError(r *http.Request, w http.ResponseWriter, code int, format string, args ...interface{}) { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/http.go
"github.com/AdguardTeam/golibs/errors"
<mask> "math" <mask> "math/big" <mask> "net" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> ) <mask> <mask> // ipRange is an inclusive range of IP addresses. A nil range is a range that <mask> // doesn't contain any IP addresses. <mask> // </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove errBadAddrPassed agherr.Error = "the passed string is not a valid IP address" </s> add errBadAddrPassed errors.Error = "the passed string is not a valid IP address" </s> remove errFakeDial agherr.Error = "this error signals the successful dialFunc work" </s> add errFakeDial errors.Error = "this error signals the successful dialFunc work" </s> remove const ErrNoStaticIPInfo agherr.Error = "no information about static ip" </s> add const ErrNoStaticIPInfo errors.Error = "no information about static ip" </s> remove defer agherr.Annotate("invalid ip range: %w", &err) </s> add defer func() { err = errors.Annotate(err, "invalid ip range: %w") }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/iprange.go
defer func() { err = errors.Annotate(err, "invalid ip range: %w") }()
<mask> <mask> // newIPRange creates a new IP address range. start must be less than end. The <mask> // resulting range must not be greater than maxRangeLen. <mask> func newIPRange(start, end net.IP) (r *ipRange, err error) { <mask> defer agherr.Annotate("invalid ip range: %w", &err) <mask> <mask> // Make sure that both are 16 bytes long to simplify handling in <mask> // methods. <mask> start, end = start.To16(), end.To16() <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("bad upstream for domain spec %q: %w", &err, upstreamStr) </s> add defer func() { err = errors.Annotate(err, "bad upstream for domain spec %q: %w", upstreamStr) }() </s> remove defer agherr.LogPanic("rdns") </s> add defer log.OnPanic("rdns") </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove h.ServeHTTP(w, r) </s> add // HTTP handlers aren't supposed to call r.Body.Close(), so just // replace the body in a clone. rr := r.Clone(r.Context()) rr.Body = io.NopCloser(reader) h.ServeHTTP(w, rr) </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/iprange.go
"github.com/AdguardTeam/golibs/errors"
<mask> "net" <mask> "strconv" <mask> "strings" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> ) <mask> <mask> // hexDHCPOptionParserHandler parses a DHCP option as a hex-encoded string. <mask> // For example: <mask> // </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/options.go
return nil, errors.Error("invalid ip")
<mask> // <mask> func ipDHCPOptionParserHandler(s string) (data []byte, err error) { <mask> ip := net.ParseIP(s) <mask> if ip == nil { <mask> return nil, agherr.Error("invalid ip") <mask> } <mask> <mask> // Most DHCP options require IPv4, so do not put the 16-byte <mask> // version if we can. Otherwise, the clients will receive weird <mask> // data that looks like four IPv4 addresses. </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }() </s> remove func (w *Whois) query(ctx context.Context, target, serverAddr string) (string, error) { </s> add func (w *Whois) query(ctx context.Context, target, serverAddr string) (data string, err error) { </s> remove defer agherr.Annotate("invalid ip range: %w", &err) </s> add defer func() { err = errors.Annotate(err, "invalid ip range: %w") }() </s> remove func tarGzFileUnpack(tarfile, outdir string) ([]string, error) { </s> add func tarGzFileUnpack(tarfile, outDir string) (files []string, err error) { </s> remove defer agherr.Annotate("invalid option string %q: %w", &err, s) </s> add defer func() { err = errors.Annotate(err, "invalid option string %q: %w", s) }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/options.go
defer func() { err = errors.Annotate(err, "invalid option string %q: %w", s) }()
<mask> } <mask> <mask> // parse parses an option. See the handlers' documentation for more info. <mask> func (p *dhcpOptionParser) parse(s string) (code uint8, data []byte, err error) { <mask> defer agherr.Annotate("invalid option string %q: %w", &err, s) <mask> <mask> s = strings.TrimSpace(s) <mask> parts := strings.SplitN(s, " ", 3) <mask> if len(parts) < 3 { <mask> return 0, nil, agherr.Error("need at least three fields") </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return 0, nil, agherr.Error("need at least three fields") </s> add return 0, nil, errors.Error("need at least three fields") </s> remove defer agherr.Annotate("parsing %q: %w", &err, host) </s> add defer func() { err = errors.Annotate(err, "parsing %q: %w", host) }() </s> remove defer agherr.Annotate("normalizing %q: %w", &err, hostname) </s> add defer func() { err = errors.Annotate(err, "normalizing %q: %w", hostname) }() </s> remove defer agherr.Annotate("bad upstream for domain spec %q: %w", &err, upstreamStr) </s> add defer func() { err = errors.Annotate(err, "bad upstream for domain spec %q: %w", upstreamStr) }() </s> remove return nil, agherr.Error("invalid ip") </s> add return nil, errors.Error("invalid ip")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/options.go
return 0, nil, errors.Error("need at least three fields")
<mask> <mask> s = strings.TrimSpace(s) <mask> parts := strings.SplitN(s, " ", 3) <mask> if len(parts) < 3 { <mask> return 0, nil, agherr.Error("need at least three fields") <mask> } <mask> <mask> codeStr := parts[0] <mask> typ := parts[1] <mask> val := parts[2] </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("invalid option string %q: %w", &err, s) </s> add defer func() { err = errors.Annotate(err, "invalid option string %q: %w", s) }() </s> remove return "", false, agherr.Error("duplicated separator") </s> add return "", false, errors.Error("duplicated separator") </s> remove defer agherr.Annotate("parsing %q: %w", &err, host) </s> add defer func() { err = errors.Annotate(err, "parsing %q: %w", host) }() </s> remove const errTest agherr.Error = "test error" </s> add const errTest errors.Error = "test error" </s> remove return agherr.Error("label is empty") </s> add return errors.Error("label is empty")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/options.go
<mask> package dhcpd <mask> <mask> import ( <mask> "errors" <mask> "net" <mask> <mask> "golang.org/x/net/ipv4" <mask> ) <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
[ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/os_windows.go
"github.com/AdguardTeam/golibs/errors"
<mask> <mask> import ( <mask> "net" <mask> <mask> "golang.org/x/net/ipv4" <mask> ) <mask> <mask> // Create a socket for receiving broadcast packets <mask> func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return nil, errors.New("newBroadcastPacketConn(): not supported on Windows") </s> add return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows") </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/os_windows.go
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
<mask> ) <mask> <mask> // Create a socket for receiving broadcast packets <mask> func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) { <mask> return nil, errors.New("newBroadcastPacketConn(): not supported on Windows") <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("lease not found") </s> add return errors.Error("lease not found") </s> remove defer agherr.Annotate("normalizing %q: %w", &err, hostname) </s> add defer func() { err = errors.Annotate(err, "normalizing %q: %w", hostname) }() </s> remove func tarGzFileUnpack(tarfile, outdir string) ([]string, error) { </s> add func tarGzFileUnpack(tarfile, outDir string) (files []string, err error) { </s> remove return nil, agherr.Error("invalid ip") </s> add return nil, errors.Error("invalid ip")
[ "keep", "keep", "keep", "keep", "replace", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/os_windows.go
<mask> package dhcpd <mask> <mask> import ( <mask> "bytes" <mask> "errors" <mask> "fmt" <mask> "net" <mask> "strings" <mask> "sync" <mask> "time" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v4.go
<mask> "strings" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghstrings" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/go-ping/ping" <mask> "github.com/insomniacslk/dhcp/dhcpv4" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v4.go
"github.com/AdguardTeam/golibs/errors"
<mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghstrings" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/go-ping/ping" <mask> "github.com/insomniacslk/dhcp/dhcpv4" <mask> "github.com/insomniacslk/dhcp/dhcpv4/server4" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v4.go
defer func() { err = errors.Annotate(err, "normalizing %q: %w", hostname) }()
<mask> <mask> // normalizeHostname normalizes a hostname sent by the client. If err is not <mask> // nil, norm is an empty string. <mask> func normalizeHostname(hostname string) (norm string, err error) { <mask> defer agherr.Annotate("normalizing %q: %w", &err, hostname) <mask> <mask> if hostname == "" { <mask> return "", nil <mask> } <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("validating label %q: %w", &err, label) </s> add defer func() { err = errors.Annotate(err, "validating label %q: %w", label) }() </s> remove defer agherr.Annotate("bad upstream for domain spec %q: %w", &err, upstreamStr) </s> add defer func() { err = errors.Annotate(err, "bad upstream for domain spec %q: %w", upstreamStr) }() </s> remove defer agherr.Annotate("parsing %q: %w", &err, host) </s> add defer func() { err = errors.Annotate(err, "parsing %q: %w", host) }() </s> remove defer agherr.Annotate("validating hardware address %q: %w", &err, hwa) </s> add defer func() { err = errors.Annotate(err, "validating hardware address %q: %w", hwa) }() </s> remove rDNSNotPTRErr agherr.Error = "the response is not a ptr" </s> add rDNSNotPTRErr errors.Error = "the response is not a ptr"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v4.go
return errors.Error("static lease already exists")
<mask> l := s.leases[i] <mask> <mask> if bytes.Equal(l.HWAddr, lease.HWAddr) { <mask> if l.IsStatic() { <mask> return agherr.Error("static lease already exists") <mask> } <mask> <mask> s.rmLeaseByIndex(i) <mask> if i == len(s.leases) { <mask> break </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("static lease already exists") </s> add return errors.Error("static lease already exists") </s> remove return agherr.Error("client already exists") </s> add return errors.Error("client already exists") </s> remove return agherr.Error("label is empty") </s> add return errors.Error("label is empty") </s> remove return agherr.Error("domain name is empty") </s> add return errors.Error("domain name is empty") </s> remove _, inputNameOnly := filepath.Split(header.Name) if inputNameOnly == "" { continue </s> add break
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v4.go
return errors.Error("static lease already exists")
<mask> } <mask> <mask> if l.IP.Equal(lease.IP) { <mask> if l.IsStatic() { <mask> return agherr.Error("static lease already exists") <mask> } <mask> <mask> s.rmLeaseByIndex(i) <mask> if i == len(s.leases) { <mask> break </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("static lease already exists") </s> add return errors.Error("static lease already exists") </s> remove return agherr.Error("client already exists") </s> add return errors.Error("client already exists") </s> remove _, inputNameOnly := filepath.Split(header.Name) if inputNameOnly == "" { continue </s> add break </s> remove return errors.New("IP address is already static") </s> add return errors.Error("IP address is already static") </s> remove } </s> add } else if err != nil { err = fmt.Errorf("tarReader.Next(): %w", err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v4.go
return errors.Error("lease not found")
<mask> return nil <mask> } <mask> } <mask> <mask> return agherr.Error("lease not found") <mask> } <mask> <mask> // AddStaticLease adds a static lease. It is safe for concurrent use. <mask> func (s *v4Server) AddStaticLease(l Lease) (err error) { <mask> defer agherr.Annotate("dhcpv4: adding static lease: %w", &err) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("dhcpv4: adding static lease: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: adding static lease: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }() </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }() </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v4.go
defer func() { err = errors.Annotate(err, "dhcpv4: adding static lease: %w") }()
<mask> } <mask> <mask> // AddStaticLease adds a static lease. It is safe for concurrent use. <mask> func (s *v4Server) AddStaticLease(l Lease) (err error) { <mask> defer agherr.Annotate("dhcpv4: adding static lease: %w", &err) <mask> <mask> if ip4 := l.IP.To4(); ip4 == nil { <mask> return fmt.Errorf("invalid ip %q, only ipv4 is supported", l.IP) <mask> } <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("lease not found") </s> add return errors.Error("lease not found") </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }() </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }() </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v4.go
defer func() { err = errors.Annotate(err, "dhcpv4: %w") }()
<mask> } <mask> <mask> // RemoveStaticLease removes a static lease. It is safe for concurrent use. <mask> func (s *v4Server) RemoveStaticLease(l Lease) (err error) { <mask> defer agherr.Annotate("dhcpv4: %w", &err) <mask> <mask> if len(l.IP) != 4 { <mask> return fmt.Errorf("invalid IP") <mask> } <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }() </s> remove return agherr.Error("lease not found") </s> add return errors.Error("lease not found") </s> remove defer agherr.Annotate("dhcpv4: adding static lease: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: adding static lease: %w") }() </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v4.go
defer func() { err = errors.Annotate(err, "dhcpv4: %w") }()
<mask> } <mask> <mask> // Start starts the IPv4 DHCP server. <mask> func (s *v4Server) Start() (err error) { <mask> defer agherr.Annotate("dhcpv4: %w", &err) <mask> <mask> if !s.conf.Enabled { <mask> return nil <mask> } <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }() </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }() </s> remove return agherr.Error("lease not found") </s> add return errors.Error("lease not found") </s> remove defer agherr.Annotate("dhcpv4: adding static lease: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: adding static lease: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v4.go
<mask> package dhcpd <mask> <mask> import ( <mask> "errors" <mask> "net" <mask> "testing" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/stretchr/testify/assert" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "errors" </s> add </s> remove "errors" </s> add
[ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v46_test.go
"github.com/AdguardTeam/golibs/errors"
<mask> "errors" <mask> "net" <mask> "testing" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> type fakeIface struct { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v46_test.go
const errTest errors.Error = "test error"
<mask> return iface.addrs, nil <mask> } <mask> <mask> func TestIfaceIPAddrs(t *testing.T) { <mask> const errTest agherr.Error = "test error" <mask> <mask> ip4 := net.IP{1, 2, 3, 4} <mask> addr4 := &net.IPNet{IP: ip4} <mask> <mask> ip6 := net.IP{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6} </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove const errTest agherr.Error = "test error" </s> add const errTest errors.Error = "test error" </s> remove return agherr.Error("address is empty") </s> add return errors.Error("address is empty") </s> remove return 0, nil, agherr.Error("need at least three fields") </s> add return 0, nil, errors.Error("need at least three fields") </s> remove defer agherr.Annotate("dhcpv4: adding static lease: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: adding static lease: %w") }() </s> remove defer agherr.Annotate("validating hardware address %q: %w", &err, hwa) </s> add defer func() { err = errors.Annotate(err, "validating hardware address %q: %w", hwa) }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v46_test.go
const errTest errors.Error = "test error"
<mask> return nil, nil <mask> } <mask> <mask> func TestIfaceDNSIPAddrs(t *testing.T) { <mask> const errTest agherr.Error = "test error" <mask> <mask> ip4 := net.IP{1, 2, 3, 4} <mask> addr4 := &net.IPNet{IP: ip4} <mask> <mask> ip6 := net.IP{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6} </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove const errTest agherr.Error = "test error" </s> add const errTest errors.Error = "test error" </s> remove return 0, nil, agherr.Error("need at least three fields") </s> add return 0, nil, errors.Error("need at least three fields") </s> remove return agherr.Error("address is empty") </s> add return errors.Error("address is empty") </s> remove defer agherr.Annotate("dhcpv4: adding static lease: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: adding static lease: %w") }() </s> remove defer agherr.Annotate("validating hardware address %q: %w", &err, hwa) </s> add defer func() { err = errors.Annotate(err, "validating hardware address %q: %w", hwa) }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v46_test.go
<mask> "net" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/insomniacslk/dhcp/dhcpv6" <mask> "github.com/insomniacslk/dhcp/dhcpv6/server6" <mask> "github.com/insomniacslk/dhcp/iana" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v6.go
"github.com/AdguardTeam/golibs/errors"
<mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/insomniacslk/dhcp/dhcpv6" <mask> "github.com/insomniacslk/dhcp/dhcpv6/server6" <mask> "github.com/insomniacslk/dhcp/iana" <mask> ) <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v6.go
defer func() { err = errors.Annotate(err, "dhcpv6: %w") }()
<mask> } <mask> <mask> // AddStaticLease adds a static lease. It is safe for concurrent use. <mask> func (s *v6Server) AddStaticLease(l Lease) (err error) { <mask> defer agherr.Annotate("dhcpv6: %w", &err) <mask> <mask> if len(l.IP) != 16 { <mask> return fmt.Errorf("invalid IP") <mask> } <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }() </s> remove return agherr.Error("lease not found") </s> add return errors.Error("lease not found") </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }() </s> remove defer agherr.Annotate("dhcpv4: adding static lease: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: adding static lease: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v6.go
defer func() { err = errors.Annotate(err, "dhcpv6: %w") }()
<mask> } <mask> <mask> // RemoveStaticLease removes a static lease. It is safe for concurrent use. <mask> func (s *v6Server) RemoveStaticLease(l Lease) (err error) { <mask> defer agherr.Annotate("dhcpv6: %w", &err) <mask> <mask> if len(l.IP) != 16 { <mask> return fmt.Errorf("invalid IP") <mask> } <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }() </s> remove return agherr.Error("lease not found") </s> add return errors.Error("lease not found") </s> remove defer agherr.Annotate("dhcpv4: adding static lease: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: adding static lease: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v6.go
defer func() { err = errors.Annotate(err, "dhcpv6: %w") }()
<mask> } <mask> <mask> // Start starts the IPv6 DHCP server. <mask> func (s *v6Server) Start() (err error) { <mask> defer agherr.Annotate("dhcpv6: %w", &err) <mask> <mask> if !s.conf.Enabled { <mask> return nil <mask> } <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }() </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }() </s> remove return agherr.Error("lease not found") </s> add return errors.Error("lease not found")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dhcpd/v6.go
<mask> package dnsforward <mask> <mask> import ( <mask> "crypto/tls" <mask> "errors" <mask> "fmt" <mask> "path" <mask> "strings" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/clientid.go
"github.com/AdguardTeam/golibs/errors"
<mask> "strings" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/lucas-clemente/quic-go" <mask> ) <mask> <mask> // ValidateClientID returns an error if clientID is not a valid client ID. </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove errBadAddrPassed agherr.Error = "the passed string is not a valid IP address" </s> add errBadAddrPassed errors.Error = "the passed string is not a valid IP address" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove errFakeDial agherr.Error = "this error signals the successful dialFunc work" </s> add errFakeDial errors.Error = "this error signals the successful dialFunc work" </s> remove defer agherr.Annotate("validating label %q: %w", &err, label) </s> add defer func() { err = errors.Annotate(err, "validating label %q: %w", label) }() </s> remove defer agherr.Annotate("validating hardware address %q: %w", &err, hwa) </s> add defer func() { err = errors.Annotate(err, "validating hardware address %q: %w", hwa) }()
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/clientid.go
<mask> <mask> import ( <mask> "crypto/tls" <mask> "crypto/x509" <mask> "errors" <mask> "fmt" <mask> "net" <mask> "net/http" <mask> "os" <mask> "sort" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/config.go
"github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/ameshkov/dnscrypt/v2" <mask> ) <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/config.go
return proxyConfig, errors.Error("no default upstream servers configured")
<mask> } <mask> <mask> // Validate proxy config <mask> if proxyConfig.UpstreamConfig == nil || len(proxyConfig.UpstreamConfig.Upstreams) == 0 { <mask> return proxyConfig, errors.New("no default upstream servers configured") <mask> } <mask> <mask> return proxyConfig, nil <mask> } <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return nil, errors.New("found no DNS servers in /etc/resolv.conf") </s> add return nil, errors.Error("found no DNS servers in /etc/resolv.conf") </s> remove return set, agherr.Error("empty response or no family data") </s> add return set, errors.Error("empty response or no family data") </s> remove defer agherr.Annotate("bad upstream for domain spec %q: %w", &err, upstreamStr) </s> add defer func() { err = errors.Annotate(err, "bad upstream for domain spec %q: %w", upstreamStr) }() </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove if len(errors) != 0 { return agherr.Many("closing ipsets", errors...) </s> add if len(errs) != 0 { return errors.List("closing ipsets", errs...)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/config.go
<mask> // Package dnsforward contains a DNS forwarding server. <mask> package dnsforward <mask> <mask> import ( <mask> "errors" <mask> "fmt" <mask> "net" <mask> "net/http" <mask> "os" <mask> "runtime" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/dnsforward.go
<mask> "strings" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghstrings" <mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd" <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/AdGuardHome/internal/querylog" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/dnsforward.go
"github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/stats" <mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/miekg/dns" <mask> ) <mask> <mask> // DefaultTimeout is the default upstream timeout <mask> const DefaultTimeout = 10 * time.Second </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer agherr.LogPanic("") </s> add defer log.OnPanic("")
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/dnsforward.go
rDNSEmptyAnswerErr errors.Error = "the answer section is empty"
<mask> <mask> const ( <mask> // rDNSEmptyAnswerErr is returned by Exchange method when the answer <mask> // section of respond is empty. <mask> rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" <mask> <mask> // rDNSNotPTRErr is returned by Exchange method when the response is not <mask> // of PTR type. <mask> rDNSNotPTRErr agherr.Error = "the response is not a ptr" <mask> ) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove rDNSNotPTRErr agherr.Error = "the response is not a ptr" </s> add rDNSNotPTRErr errors.Error = "the response is not a ptr" </s> remove errBadAddrPassed agherr.Error = "the passed string is not a valid IP address" </s> add errBadAddrPassed errors.Error = "the passed string is not a valid IP address" </s> remove errFakeDial agherr.Error = "this error signals the successful dialFunc work" </s> add errFakeDial errors.Error = "this error signals the successful dialFunc work" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/dnsforward.go
rDNSNotPTRErr errors.Error = "the response is not a ptr"
<mask> rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" <mask> <mask> // rDNSNotPTRErr is returned by Exchange method when the response is not <mask> // of PTR type. <mask> rDNSNotPTRErr agherr.Error = "the response is not a ptr" <mask> ) <mask> <mask> // Exchange implements the RDNSExchanger interface for *Server. <mask> func (s *Server) Exchange(ip net.IP) (host string, err error) { <mask> s.RLock() </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" </s> add rDNSEmptyAnswerErr errors.Error = "the answer section is empty" </s> remove errBadAddrPassed agherr.Error = "the passed string is not a valid IP address" </s> add errBadAddrPassed errors.Error = "the passed string is not a valid IP address" </s> remove errFakeDial agherr.Error = "this error signals the successful dialFunc work" </s> add errFakeDial errors.Error = "this error signals the successful dialFunc work" </s> remove const ErrNoStaticIPInfo agherr.Error = "no information about static ip" </s> add const ErrNoStaticIPInfo errors.Error = "no information about static ip" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/dnsforward.go
<mask> "sync" <mask> "testing" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest" <mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd" <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/dnsproxy/proxy" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/dnsforward_test.go
"github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd" <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/miekg/dns" <mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> func TestMain(m *testing.M) { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/dnsforward_test.go
upstreamErr := errors.Error("upstream error")
<mask> "1.1.168.192.in-addr.arpa.": {"local.domain"}, <mask> "2.1.168.192.in-addr.arpa.": {}, <mask> }, <mask> } <mask> upstreamErr := agherr.Error("upstream error") <mask> errUpstream := &aghtest.TestErrUpstream{ <mask> Err: upstreamErr, <mask> } <mask> nonPtrUpstream := &aghtest.TestBlockUpstream{ <mask> Hostname: "some-host", </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove Err: errors.New("1234"), </s> add Err: errors.Error("1234"), </s> remove return agherr.Error("domain name is empty") </s> add return errors.Error("domain name is empty") </s> remove connReadCloser, err := aghio.LimitReadCloser(conn, MaxConnReadSize) </s> add r, err := aghio.LimitReader(conn, MaxConnReadSize) </s> remove err := e.Encode(entry) </s> add err = e.Encode(entry) </s> remove return agherr.Error("no dns rewrite rule responses") </s> add return errors.Error("no dns rewrite rule responses")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/dnsforward_test.go
<mask> import ( <mask> "fmt" <mask> "net" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/urlfilter/rules" <mask> "github.com/miekg/dns" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/dnsrewrite.go
"github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/urlfilter/rules" <mask> "github.com/miekg/dns" <mask> ) <mask> <mask> // filterDNSRewriteResponse handles a single DNS rewrite response entry. </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/dnsrewrite.go
return errors.Error("no dns rewrite rule content")
<mask> func (s *Server) filterDNSRewrite(req *dns.Msg, res filtering.Result, d *proxy.DNSContext) (err error) { <mask> resp := s.makeResponse(req) <mask> dnsrr := res.DNSRewriteResult <mask> if dnsrr == nil { <mask> return agherr.Error("no dns rewrite rule content") <mask> } <mask> <mask> resp.Rcode = dnsrr.RCode <mask> if resp.Rcode != dns.RcodeSuccess { <mask> d.Res = resp </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("no dns rewrite rule responses") </s> add return errors.Error("no dns rewrite rule responses") </s> remove defer f.Close() </s> add </s> remove func (u *Updater) downloadPackageFile(url, filename string) error { resp, err := u.client.Get(url) </s> add func (u *Updater) downloadPackageFile(url, filename string) (err error) { var resp *http.Response resp, err = u.client.Get(url) </s> remove defer agherr.Annotate("dhcpv4: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv4: %w") }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/dnsrewrite.go
return errors.Error("no dns rewrite rule responses")
<mask> return nil <mask> } <mask> <mask> if dnsrr.Response == nil { <mask> return agherr.Error("no dns rewrite rule responses") <mask> } <mask> <mask> rr := req.Question[0].Qtype <mask> values := dnsrr.Response[rr] <mask> for i, v := range values { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("no dns rewrite rule content") </s> add return errors.Error("no dns rewrite rule content") </s> remove return "", false, agherr.Error("duplicated separator") </s> add return "", false, errors.Error("duplicated separator") </s> remove return agherr.Error("id required") </s> add return errors.Error("id required") </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove err := e.Encode(entry) </s> add err = e.Encode(entry)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/dnsrewrite.go
<mask> "net/http" <mask> "strconv" <mask> "strings" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghstrings" <mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/log" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/http.go
"github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/miekg/dns" <mask> ) <mask> <mask> func httpError(r *http.Request, w http.ResponseWriter, code int, format string, args ...interface{}) { <mask> text := fmt.Sprintf(format, args...) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/http.go
defer func() { err = errors.Annotate(err, "bad upstream for domain spec %q: %w", upstreamStr) }()
<mask> <mask> // separateUpstream returns the upstream without the specified domains. <mask> // useDefault is true when a default upstream must be used. <mask> func separateUpstream(upstreamStr string) (upstream string, useDefault bool, err error) { <mask> defer agherr.Annotate("bad upstream for domain spec %q: %w", &err, upstreamStr) <mask> <mask> if !strings.HasPrefix(upstreamStr, "[/") { <mask> return upstreamStr, true, nil <mask> } <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return proxyConfig, errors.New("no default upstream servers configured") </s> add return proxyConfig, errors.Error("no default upstream servers configured") </s> remove defer agherr.Annotate("normalizing %q: %w", &err, hostname) </s> add defer func() { err = errors.Annotate(err, "normalizing %q: %w", hostname) }() </s> remove defer agherr.Annotate("validating label %q: %w", &err, label) </s> add defer func() { err = errors.Annotate(err, "validating label %q: %w", label) }() </s> remove defer agherr.Annotate("validating domain name %q: %w", &err, name) </s> add defer func() { err = errors.Annotate(err, "validating domain name %q: %w", name) }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/http.go
return "", false, errors.Error("duplicated separator")
<mask> } <mask> <mask> parts := strings.Split(upstreamStr[2:], "/]") <mask> if len(parts) != 2 { <mask> return "", false, agherr.Error("duplicated separator") <mask> } <mask> <mask> domains := parts[0] <mask> upstream = parts[1] <mask> for i, host := range strings.Split(domains, "/") { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return 0, nil, agherr.Error("need at least three fields") </s> add return 0, nil, errors.Error("need at least three fields") </s> remove return agherr.Error("no dns rewrite rule responses") </s> add return errors.Error("no dns rewrite rule responses") </s> remove defer agherr.Annotate("parsing %q: %w", &err, host) </s> add defer func() { err = errors.Annotate(err, "parsing %q: %w", host) }() </s> remove return agherr.Error("id required") </s> add return errors.Error("id required") </s> remove err := e.Encode(entry) </s> add err = e.Encode(entry)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/http.go
"github.com/AdguardTeam/golibs/errors"
<mask> "net" <mask> "strings" <mask> "sync" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/digineo/go-ipset/v2" <mask> "github.com/mdlayher/netlink" <mask> "github.com/miekg/dns" <mask> "github.com/ti-mo/netfilter" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add "github.com/AdguardTeam/golibs/errors"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/ipset_linux.go
return set, errors.Error("empty response or no family data")
<mask> return set, err <mask> } <mask> <mask> if res == nil || res.Family == nil { <mask> return set, agherr.Error("empty response or no family data") <mask> } <mask> <mask> family := netfilter.ProtoFamily(res.Family.Value) <mask> if family != netfilter.ProtoIPv4 && family != netfilter.ProtoIPv6 { <mask> return set, fmt.Errorf("unexpected ipset family %s", family) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return proxyConfig, errors.New("no default upstream servers configured") </s> add return proxyConfig, errors.Error("no default upstream servers configured") </s> remove return errors.New(data.WarningValidation) </s> add return errors.Error(data.WarningValidation) </s> remove } </s> add } else if err != nil { err = fmt.Errorf("tarReader.Next(): %w", err) </s> remove defer f.Close() fileReadCloser, err := aghio.LimitReadCloser(f, MaxFileSize) </s> add defer func() { derr := f.Close() if derr != nil { log.Error("glinet: closing file: %s", err) } }() fileReader, err := aghio.LimitReader(f, MaxFileSize) </s> remove return agherr.Error("no dns rewrite rule content") </s> add return errors.Error("no dns rewrite rule content")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/ipset_linux.go
var errs []error
<mask> } <mask> <mask> // Close closes the Linux Netfilter connections. <mask> func (c *ipsetCtx) Close() (err error) { <mask> var errors []error <mask> if c.ipv4Conn != nil { <mask> err = c.ipv4Conn.Close() <mask> if err != nil { <mask> errors = append(errors, err) <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove errors = append(errors, err) </s> add errs = append(errs, err) </s> remove errors = append(errors, err) </s> add errs = append(errs, err) </s> remove if len(errors) != 0 { return agherr.Many("closing ipsets", errors...) </s> add if len(errs) != 0 { return errors.List("closing ipsets", errs...) </s> remove defer agherr.Annotate("systemResolvers: %w", &err) </s> add defer func() { err = errors.Annotate(err, "systemResolvers: %w") }() </s> remove defer agherr.Annotate("dhcpv6: %w", &err) </s> add defer func() { err = errors.Annotate(err, "dhcpv6: %w") }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/ipset_linux.go
errs = append(errs, err)
<mask> var errors []error <mask> if c.ipv4Conn != nil { <mask> err = c.ipv4Conn.Close() <mask> if err != nil { <mask> errors = append(errors, err) <mask> } <mask> } <mask> <mask> if c.ipv6Conn != nil { <mask> err = c.ipv6Conn.Close() </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove var errors []error </s> add var errs []error </s> remove errors = append(errors, err) </s> add errs = append(errs, err) </s> remove if len(errors) != 0 { return agherr.Many("closing ipsets", errors...) </s> add if len(errs) != 0 { return errors.List("closing ipsets", errs...) </s> remove defer f.Close() </s> add </s> remove var stdoutLimited io.ReadCloser stdoutLimited, err = aghio.LimitReadCloser(stdout, aghos.MaxCmdOutputSize) </s> add var stdoutLimited io.Reader stdoutLimited, err = aghio.LimitReader(stdout, aghos.MaxCmdOutputSize)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/ipset_linux.go
errs = append(errs, err)
<mask> <mask> if c.ipv6Conn != nil { <mask> err = c.ipv6Conn.Close() <mask> if err != nil { <mask> errors = append(errors, err) <mask> } <mask> } <mask> <mask> if len(errors) != 0 { <mask> return agherr.Many("closing ipsets", errors...) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove if len(errors) != 0 { return agherr.Many("closing ipsets", errors...) </s> add if len(errs) != 0 { return errors.List("closing ipsets", errs...) </s> remove errors = append(errors, err) </s> add errs = append(errs, err) </s> remove var errors []error </s> add var errs []error </s> remove defer f.Close() fileReadCloser, err := aghio.LimitReadCloser(f, MaxFileSize) </s> add defer func() { derr := f.Close() if derr != nil { log.Error("glinet: closing file: %s", err) } }() fileReader, err := aghio.LimitReader(f, MaxFileSize) </s> remove defer r.Close() </s> add defer func() { derr := r.Close() if derr != nil { log.Error("querylog: closing file: %s", err) } }()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/ipset_linux.go
if len(errs) != 0 { return errors.List("closing ipsets", errs...)
<mask> errors = append(errors, err) <mask> } <mask> } <mask> <mask> if len(errors) != 0 { <mask> return agherr.Many("closing ipsets", errors...) <mask> } <mask> <mask> return nil <mask> } <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove errors = append(errors, err) </s> add errs = append(errs, err) </s> remove errors = append(errors, err) </s> add errs = append(errs, err) </s> remove var errors []error </s> add var errs []error </s> remove defer f.Close() fileReadCloser, err := aghio.LimitReadCloser(f, MaxFileSize) </s> add defer func() { derr := f.Close() if derr != nil { log.Error("glinet: closing file: %s", err) } }() fileReader, err := aghio.LimitReader(f, MaxFileSize) </s> remove defer r.Close() </s> add defer func() { derr := r.Close() if derr != nil { log.Error("querylog: closing file: %s", err) } }()
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/dnsforward/ipset_linux.go
defer func() { derr := f.Close() if derr != nil { log.Error("glinet: closing file: %s", err) } }() fileReader, err := aghio.LimitReader(f, MaxFileSize)
<mask> if err != nil { <mask> log.Error("os.Open: %s", err) <mask> return 0 <mask> } <mask> defer f.Close() <mask> <mask> fileReadCloser, err := aghio.LimitReadCloser(f, MaxFileSize) <mask> if err != nil { <mask> log.Error("creating limited reader: %s", err) <mask> <mask> return 0 <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer fileReadCloser.Close() </s> add </s> remove defer r.Close() </s> add defer func() { derr := r.Close() if derr != nil { log.Error("querylog: closing file: %s", err) } }() </s> remove defer f.Close() </s> add defer func() { derr := f.Close() if derr != nil { log.Error("etchostscontainer: closing file: %s", err) } }() </s> remove bs, err := io.ReadAll(fileReadCloser) </s> add bs, err := io.ReadAll(fileReader) </s> remove defer f.Close() </s> add defer func() { err = errors.WithDeferred(err, f.Close()) }()
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/authglinet.go
<mask> log.Error("creating limited reader: %s", err) <mask> <mask> return 0 <mask> } <mask> defer fileReadCloser.Close() <mask> <mask> var dateToken uint32 <mask> <mask> // This use of ReadAll is now safe, because we limited reader. <mask> bs, err := io.ReadAll(fileReadCloser) </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove bs, err := io.ReadAll(fileReadCloser) </s> add bs, err := io.ReadAll(fileReader) </s> remove data, err := io.ReadAll(connReadCloser) </s> add var whoisData []byte whoisData, err = io.ReadAll(r) </s> remove body, err := io.ReadAll(resp.Body) </s> add body, err := io.ReadAll(r) </s> remove defer resp.Body.Close() </s> add </s> remove body, err := io.ReadAll(resp.Body) </s> add body, err := io.ReadAll(r)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/authglinet.go
bs, err := io.ReadAll(fileReader)
<mask> <mask> var dateToken uint32 <mask> <mask> // This use of ReadAll is now safe, because we limited reader. <mask> bs, err := io.ReadAll(fileReadCloser) <mask> if err != nil { <mask> log.Error("reading token: %s", err) <mask> <mask> return 0 <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove defer fileReadCloser.Close() </s> add </s> remove data, err := io.ReadAll(connReadCloser) </s> add var whoisData []byte whoisData, err = io.ReadAll(r) </s> remove body, err := io.ReadAll(resp.Body) </s> add body, err := io.ReadAll(r) </s> remove defer resp.Body.Close() </s> add </s> remove defer resp.Body.Close() </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/authglinet.go
<mask> "strings" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghstrings" <mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd" <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/clients.go
"github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> const clientsUpdatePeriod = 10 * time.Minute <mask> </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "github.com/AdguardTeam/AdGuardHome/internal/agherr" </s> add
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/clients.go
return errors.Error("client is nil")
<mask> // check validates the client. <mask> func (clients *clientsContainer) check(c *Client) (err error) { <mask> switch { <mask> case c == nil: <mask> return agherr.Error("client is nil") <mask> case c.Name == "": <mask> return agherr.Error("invalid name") <mask> case len(c.IDs) == 0: <mask> return agherr.Error("id required") <mask> default: </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("invalid name") </s> add return errors.Error("invalid name") </s> remove return agherr.Error("id required") </s> add return errors.Error("id required") </s> remove return agherr.Error("question is nil") </s> add return errors.Error("question is nil") </s> remove return agherr.Error("more than one question") </s> add return errors.Error("more than one question") </s> remove return agherr.Error("no host in question") </s> add return errors.Error("no host in question")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/clients.go
return errors.Error("invalid name")
<mask> switch { <mask> case c == nil: <mask> return agherr.Error("client is nil") <mask> case c.Name == "": <mask> return agherr.Error("invalid name") <mask> case len(c.IDs) == 0: <mask> return agherr.Error("id required") <mask> default: <mask> // Go on. <mask> } </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("id required") </s> add return errors.Error("id required") </s> remove return agherr.Error("client is nil") </s> add return errors.Error("client is nil") </s> remove return agherr.Error("more than one question") </s> add return errors.Error("more than one question") </s> remove return agherr.Error("question is nil") </s> add return errors.Error("question is nil") </s> remove return agherr.Error("no host in question") </s> add return errors.Error("no host in question")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/clients.go
return errors.Error("id required")
<mask> return agherr.Error("client is nil") <mask> case c.Name == "": <mask> return agherr.Error("invalid name") <mask> case len(c.IDs) == 0: <mask> return agherr.Error("id required") <mask> default: <mask> // Go on. <mask> } <mask> <mask> for i, id := range c.IDs { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("invalid name") </s> add return errors.Error("invalid name") </s> remove return agherr.Error("client is nil") </s> add return errors.Error("client is nil") </s> remove return agherr.Error("more than one question") </s> add return errors.Error("more than one question") </s> remove return agherr.Error("no host in question") </s> add return errors.Error("no host in question") </s> remove return agherr.Error("question is nil") </s> add return errors.Error("question is nil")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/clients.go
return errors.Error("client not found")
<mask> defer clients.lock.Unlock() <mask> <mask> prev, ok := clients.list[name] <mask> if !ok { <mask> return agherr.Error("client not found") <mask> } <mask> <mask> // First, check the name index. <mask> if prev.Name != c.Name { <mask> _, ok = clients.list[c.Name] </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("client already exists") </s> add return errors.Error("client already exists") </s> remove return agherr.Error("client is nil") </s> add return errors.Error("client is nil") </s> remove return agherr.Error("lease not found") </s> add return errors.Error("lease not found") </s> remove return agherr.Error("id required") </s> add return errors.Error("id required") </s> remove var files []string var err2 error var zr io.ReadCloser for _, zf := range r.File { zr, err = zf.Open() </s> add for _, zf := range zrc.File { var name string name, err = zipFileUnpackOne(outDir, zf)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/clients.go
return errors.Error("client already exists")
<mask> // First, check the name index. <mask> if prev.Name != c.Name { <mask> _, ok = clients.list[c.Name] <mask> if ok { <mask> return agherr.Error("client already exists") <mask> } <mask> } <mask> <mask> // Second, check the IP index. <mask> if !equalStringSlices(prev.IDs, c.IDs) { </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove return agherr.Error("client not found") </s> add return errors.Error("client not found") </s> remove return agherr.Error("static lease already exists") </s> add return errors.Error("static lease already exists") </s> remove return agherr.Error("client is nil") </s> add return errors.Error("client is nil") </s> remove return agherr.Error("static lease already exists") </s> add return errors.Error("static lease already exists") </s> remove return errors.New("IP address is already static") </s> add return errors.Error("IP address is already static")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/clients.go
<mask> package home <mask> <mask> import ( <mask> "errors" <mask> "fmt" <mask> "net" <mask> "os" <mask> "path/filepath" <mask> "sync" </s> Pull request: replace agherr with golibs' errors Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <[email protected]> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <[email protected]> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add </s> remove "errors" </s> add
[ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/03a828ef5140f232ee755f62d9c3410242833b38
internal/home/config.go