satisfy full linter

This commit is contained in:
2026-07-07 23:45:14 +02:00
parent b8e0ee074c
commit 002a390f43
47 changed files with 1206 additions and 1171 deletions

View File

@@ -27,22 +27,20 @@ import (
func esErrorString(err error) error {
msg := err.Error()
switch e := err.(type) {
//nolint:gocritic
switch errVal := err.(type) {
case *types.ElasticsearchError:
var causes strings.Builder
for _, cause := range e.ErrorCause.RootCause {
// FIXME: re-activate linter here, see https://github.com/golangci/golangci-lint/issues/6662
//nolint:staticcheck
causes.WriteString(fmt.Sprintf("%s\n", *cause.Reason))
for _, cause := range errVal.ErrorCause.RootCause {
fmt.Fprintf(&causes, "%s\n", *cause.Reason)
}
if e.ErrorCause.Reason != nil {
msg = *e.ErrorCause.Reason + ": " + causes.String()
if errVal.ErrorCause.Reason != nil {
msg = *errVal.ErrorCause.Reason + ": " + causes.String()
} else {
msg = fmt.Sprintf("http status %d: ", e.Status)
msg = fmt.Sprintf("http status %d: ", errVal.Status)
}
}
return errors.New(msg)