refactor: enable errorlint and refactor code (#14110)

* refactor: enable errorlint and refactor code

* revert

* revert

* add bazel

* gofmt

* gofmt

* gofmt

* gofmt

* gci

* lint

---------

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
Khanh Hoa
2024-07-05 05:40:13 +07:00
committed by GitHub
parent 8070fc8ece
commit 7a394062e1
106 changed files with 279 additions and 304 deletions

View File

@@ -5,6 +5,7 @@ import (
"os"
"strings"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/v5/crypto/hash"
"gopkg.in/yaml.v2"
@@ -32,7 +33,8 @@ func ParseGraffitiFile(f string) (*Graffiti, error) {
}
g := &Graffiti{}
if err := yaml.UnmarshalStrict(yamlFile, g); err != nil {
if _, ok := err.(*yaml.TypeError); !ok {
var typeError *yaml.TypeError
if !errors.As(err, &typeError) {
return nil, err
} else {
log.WithError(err).Error("There were some issues parsing graffiti from a yaml file.")