feat: fix linting errors, and add golangci-lint config
This commit is contained in:
parent
2df8ba2490
commit
38b6f1b043
@ -227,7 +227,11 @@ jobs:
|
||||
- run:
|
||||
name: run lint
|
||||
command: |
|
||||
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint -e "errors.As" -e "errors.Is" --timeout "3m0s" ./...
|
||||
if [ -f .golangci.yml ]; then
|
||||
golangci-lint run -c .golangci.yml -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint -e "errors.As" -e "errors.Is" --timeout "3m0s" ./...
|
||||
else
|
||||
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint -e "errors.As" -e "errors.Is" --timeout "3m0s" ./...
|
||||
fi
|
||||
working_directory: <<parameters.module>>
|
||||
|
||||
go-test:
|
||||
|
10
op-ufm/.golangci.yml
Normal file
10
op-ufm/.golangci.yml
Normal file
@ -0,0 +1,10 @@
|
||||
linters-settings:
|
||||
staticcheck:
|
||||
checks: ["all"]
|
||||
|
||||
issues:
|
||||
exclude-rules:
|
||||
- path: "pkg/provider/roundtrip.go"
|
||||
linters:
|
||||
- staticcheck
|
||||
text: "SA4006"
|
@ -37,6 +37,7 @@ func (p *Provider) RoundTrip(ctx context.Context) {
|
||||
p.txPool.ExclusiveSend.Lock()
|
||||
defer p.txPool.ExclusiveSend.Unlock()
|
||||
|
||||
// lint:ignore SA4006 txHash is set and used within tx sending loop
|
||||
txHash := common.Hash{}
|
||||
attempt := 0
|
||||
nonce := uint64(0)
|
||||
|
@ -6,6 +6,8 @@ import (
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/rs/cors"
|
||||
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
type HealthzServer struct {
|
||||
@ -33,5 +35,8 @@ func (h *HealthzServer) Shutdown() error {
|
||||
}
|
||||
|
||||
func (h *HealthzServer) Handle(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("OK"))
|
||||
_, err := w.Write([]byte("OK"))
|
||||
if err != nil {
|
||||
log.Error("error handling HealthzServer response")
|
||||
}
|
||||
}
|
||||
|
@ -91,11 +91,15 @@ func (s *Service) Start(ctx context.Context) {
|
||||
func (s *Service) Shutdown() {
|
||||
log.Info("service shutting down")
|
||||
if s.Config.Healthz.Enabled {
|
||||
s.Healthz.Shutdown()
|
||||
if err := s.Healthz.Shutdown(); err != nil {
|
||||
log.Error("Error shutting down healthz server", err)
|
||||
}
|
||||
log.Info("healthz stopped")
|
||||
}
|
||||
if s.Config.Metrics.Enabled {
|
||||
s.Metrics.Shutdown()
|
||||
if err := s.Metrics.Shutdown(); err != nil {
|
||||
log.Error("Error shutting down metrics server", err)
|
||||
}
|
||||
log.Info("metrics stopped")
|
||||
}
|
||||
for name, provider := range s.Providers {
|
||||
|
@ -57,7 +57,7 @@ func resolveAddr(ctx context.Context, client *kms.KeyManagementClient, keyName s
|
||||
}
|
||||
_, err = asn1.Unmarshal(block.Bytes, &info)
|
||||
if err != nil {
|
||||
return common.Address{}, fmt.Errorf("google kms public key %q pem block %q: %v", keyName, block.Type, err)
|
||||
return common.Address{}, fmt.Errorf("google kms public key %q pem block %q: %w", keyName, block.Type, err)
|
||||
}
|
||||
|
||||
return pubKeyAddr(info.Key.Bytes), nil
|
||||
|
Loading…
Reference in New Issue
Block a user