Skip to content

Commit

Permalink
Linting.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Jun 18, 2024
1 parent d516834 commit d467a8e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
29 changes: 10 additions & 19 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
# This file is not a configuration example,
# it contains the exhaustive configuration with explanations of the options.

issues:
# Which files to exclude: they will be analyzed, but issues from them won't be reported.
# There is no need to include all autogenerated files,
# we confidently recognize autogenerated files.
# If it's not, please let us know.
# "/" will be replaced by current OS file path separator to properly work on Windows.
# Default: []
exclude-files:
- ".*_ssz\\.go$"

# Options for analysis running.
run:
# The default concurrency value is the number of available CPU.
Expand Down Expand Up @@ -39,15 +49,6 @@ run:
# Default: true
# skip-dirs-use-default: false

# Which files to skip: they will be analyzed, but issues from them won't be reported.
# Default value is empty list,
# but there is no need to include all autogenerated files,
# we confidently recognize autogenerated files.
# If it's not please let us know.
# "/" will be replaced by current OS file path separator to properly work on Windows.
skip-files:
- ".*_ssz\\.go$"

# If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
Expand Down Expand Up @@ -127,14 +128,12 @@ linters:
disable:
- contextcheck
- cyclop
- deadcode
- depguard
- dupl
- err113
- errorlint
- execinquery
- exhaustive
- exhaustivestruct
- exhaustruct
- forbidigo
- forcetypeassert
Expand All @@ -145,29 +144,21 @@ linters:
- gocognit
- goconst
- goheader
- golint
- gomnd
- ifshort
- interfacer
- ireturn
- lll
- maintidx
- maligned
- mnd
- musttag
- nestif
- nilnil
- nlreturn
- nolintlint
- nosnakecase
- perfsprint
- promlinter
- rowserrcheck
- scopelint
- sqlclosecheck
- structcheck
- unparam
- varcheck
- varnamelen
- wastedassign
- wrapcheck
Expand Down
9 changes: 5 additions & 4 deletions cmd/block/analyze/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"bytes"
"context"
"fmt"
"net/http"

eth2client "github.com/attestantio/go-eth2-client"
"github.com/attestantio/go-eth2-client/api"
Expand All @@ -39,7 +40,7 @@ func (c *command) process(ctx context.Context) error {
})
if err != nil {
var apiError *api.Error
if errors.As(err, &apiError) && apiError.StatusCode == 404 {
if errors.As(err, &apiError) && apiError.StatusCode == http.StatusNotFound {
return errors.New("empty beacon block")
}
return errors.Wrap(err, "failed to obtain beacon block")
Expand Down Expand Up @@ -211,7 +212,7 @@ func (c *command) fetchParents(ctx context.Context, block *spec.VersionedSignedB
})
if err != nil {
var apiError *api.Error
if errors.As(err, &apiError) && apiError.StatusCode == 404 {
if errors.As(err, &apiError) && apiError.StatusCode == http.StatusNotFound {
return errors.New("empty beacon block")
}
return err
Expand Down Expand Up @@ -394,7 +395,7 @@ func (c *command) calcHeadCorrect(ctx context.Context, attestation *phase0.Attes
})
if err != nil {
var apiError *api.Error
if errors.As(err, &apiError) && apiError.StatusCode == 404 {
if errors.As(err, &apiError) && apiError.StatusCode == http.StatusNotFound {
if c.debug {
fmt.Printf("No block available for slot %d, assuming not in canonical chain", slot)
}
Expand Down Expand Up @@ -432,7 +433,7 @@ func (c *command) calcTargetCorrect(ctx context.Context, attestation *phase0.Att
})
if err != nil {
var apiError *api.Error
if errors.As(err, &apiError) && apiError.StatusCode == 404 {
if errors.As(err, &apiError) && apiError.StatusCode == http.StatusNotFound {
if c.debug {
fmt.Printf("No block available for slot %d, assuming not in canonical chain", slot)
}
Expand Down

0 comments on commit d467a8e

Please sign in to comment.