diff --git a/.circleci/continue_config.yml b/.circleci/continue_config.yml index cb58028..adcc7af 100644 --- a/.circleci/continue_config.yml +++ b/.circleci/continue_config.yml @@ -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: <> go-test: diff --git a/op-ufm/.golangci.yml b/op-ufm/.golangci.yml new file mode 100644 index 0000000..e19ed9b --- /dev/null +++ b/op-ufm/.golangci.yml @@ -0,0 +1,10 @@ +linters-settings: + staticcheck: + checks: ["all"] + +issues: + exclude-rules: + - path: "pkg/provider/roundtrip.go" + linters: + - staticcheck + text: "SA4006" diff --git a/op-ufm/pkg/provider/roundtrip.go b/op-ufm/pkg/provider/roundtrip.go index 6de763c..04b9af0 100644 --- a/op-ufm/pkg/provider/roundtrip.go +++ b/op-ufm/pkg/provider/roundtrip.go @@ -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) diff --git a/op-ufm/pkg/service/healthz_server.go b/op-ufm/pkg/service/healthz_server.go index aed2425..2fceea6 100644 --- a/op-ufm/pkg/service/healthz_server.go +++ b/op-ufm/pkg/service/healthz_server.go @@ -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") + } } diff --git a/op-ufm/pkg/service/service.go b/op-ufm/pkg/service/service.go index 6580de8..c131209 100644 --- a/op-ufm/pkg/service/service.go +++ b/op-ufm/pkg/service/service.go @@ -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 { diff --git a/op-ufm/tools/kmstool/main.go b/op-ufm/tools/kmstool/main.go index 425e761..b5ff40e 100644 --- a/op-ufm/tools/kmstool/main.go +++ b/op-ufm/tools/kmstool/main.go @@ -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