From db8cc43be255073ae829650b0391d246df34d1f1 Mon Sep 17 00:00:00 2001 From: Steven L Date: Fri, 3 Feb 2023 20:11:09 -0600 Subject: [PATCH 1/6] Switched to revive, goimports, re-formatted everything Works pretty well! Using latest tools/go.mod versions (except thrift), and using the server's revive.toml for starting out. Revive is a bit noisy due to some `Id` -> `ID` recommendations, but we probably should actually do that for v2. --- .gen/go/cadence/cadence.go | 6 +- .../cadence/workflowserviceclient/client.go | 8 +- .gen/go/cadence/workflowservicefx/client.go | 3 +- .gen/go/cadence/workflowservicefx/server.go | 3 +- .../cadence/workflowserviceserver/server.go | 6 +- .gen/go/cadence/workflowservicetest/client.go | 4 +- .gen/go/shadower/shadower.go | 10 +- .gen/go/shared/shared.go | 7 +- Makefile | 63 +++++------ activity/activity.go | 3 +- compatibility/thrift2proto.go | 3 +- evictiontest/workflow_cache_eviction_test.go | 7 +- internal/activity.go | 3 +- internal/activity_test.go | 3 +- internal/client.go | 3 +- internal/common/auth/service_wrapper.go | 3 +- internal/common/auth/service_wrapper_test.go | 7 +- internal/common/backoff/retry_test.go | 1 + internal/common/metrics/service_wrapper.go | 3 +- .../common/metrics/service_wrapper_test.go | 3 +- .../common/serializer/history_serializer.go | 4 +- internal/compatibility/adapter.go | 6 +- internal/compatibility/api_test.go | 4 +- internal/compatibility/enum_test.go | 4 +- internal/compatibility/error_test.go | 3 +- internal/compatibility/proto/decision.go | 3 +- internal/compatibility/proto/enum.go | 3 +- internal/compatibility/proto/error.go | 6 +- internal/compatibility/proto/helpers.go | 1 + internal/compatibility/proto/history.go | 3 +- internal/compatibility/proto/request.go | 3 +- internal/compatibility/proto/response.go | 3 +- internal/compatibility/proto/types.go | 3 +- internal/compatibility/testdata/common.go | 1 + internal/compatibility/testdata/domain.go | 1 + internal/compatibility/testdata/error.go | 3 +- internal/compatibility/testdata/service.go | 1 + internal/compatibility/thrift/decision.go | 3 +- internal/compatibility/thrift/enum.go | 3 +- internal/compatibility/thrift/error.go | 8 +- internal/compatibility/thrift/helpers.go | 1 + internal/compatibility/thrift/history.go | 3 +- internal/compatibility/thrift/request.go | 3 +- internal/compatibility/thrift/response.go | 3 +- internal/compatibility/thrift/types.go | 3 +- internal/context.go | 1 + internal/encoded_test.go | 3 +- internal/encoding.go | 1 + internal/error_test.go | 3 +- internal/headers_test.go | 1 + internal/internal_activity.go | 3 +- internal/internal_decision_state_machine.go | 1 + .../internal_decision_state_machine_test.go | 1 + internal/internal_event_handlers.go | 5 +- internal/internal_event_handlers_test.go | 3 +- internal/internal_poller_autoscaler.go | 8 +- internal/internal_poller_autoscaler_test.go | 3 +- internal/internal_pressure_points.go | 3 +- internal/internal_retry_test.go | 1 + internal/internal_task_handlers.go | 3 +- .../internal_task_handlers_interfaces_test.go | 3 +- internal/internal_task_handlers_test.go | 7 +- internal/internal_task_pollers.go | 3 +- internal/internal_utils.go | 3 +- internal/internal_utils_test.go | 1 + internal/internal_worker.go | 5 +- internal/internal_worker_base.go | 7 +- internal/internal_worker_interfaces_test.go | 3 +- internal/internal_worker_test.go | 7 +- internal/internal_workers_test.go | 7 +- internal/internal_workflow.go | 3 +- internal/internal_workflow_client_test.go | 4 +- internal/internal_workflow_test.go | 3 +- internal/internal_workflow_testsuite.go | 5 +- internal/internal_workflow_testsuite_test.go | 5 +- internal/jwt_authorization.go | 4 +- internal/jwt_authorization_test.go | 1 + internal/session.go | 3 +- internal/tools/go.mod | 22 ++-- internal/tools/go.sum | 51 +++++++-- internal/tools/tools.go | 3 +- internal/tracer_test.go | 3 +- internal/worker.go | 3 +- internal/workflow.go | 3 +- internal/workflow_replayer.go | 8 +- internal/workflow_replayer_test.go | 3 +- internal/workflow_shadower.go | 3 +- internal/workflow_shadower_activities.go | 3 +- internal/workflow_shadower_activities_test.go | 3 +- internal/workflow_shadower_test.go | 1 + internal/workflow_shadower_worker.go | 3 +- internal/workflow_shadower_worker_test.go | 5 +- internal/workflow_testsuite.go | 3 +- mocks/Client.go | 1 + mocks/DomainClient.go | 10 +- mocks/HistoryEventIterator.go | 7 +- mocks/WorkflowRun.go | 6 +- mocks/mock_test.go | 4 +- revive.toml | 101 ++++++++++++++++++ test/integration_test.go | 11 +- test/replaytests/replay_test.go | 3 +- test/replaytests/signatureBugWorkflow.go | 26 ++++- test/replaytests/workflows.go | 3 +- test/test_utils.go | 3 +- worker/worker.go | 3 +- workflow/workflow.go | 3 +- 106 files changed, 461 insertions(+), 179 deletions(-) create mode 100644 revive.toml diff --git a/.gen/go/cadence/cadence.go b/.gen/go/cadence/cadence.go index 76793c0a3..8d01964ee 100644 --- a/.gen/go/cadence/cadence.go +++ b/.gen/go/cadence/cadence.go @@ -26,12 +26,14 @@ package cadence import ( errors "errors" fmt "fmt" - shared "go.uber.org/cadence/.gen/go/shared" + strings "strings" + multierr "go.uber.org/multierr" thriftreflect "go.uber.org/thriftrw/thriftreflect" wire "go.uber.org/thriftrw/wire" zapcore "go.uber.org/zap/zapcore" - strings "strings" + + shared "go.uber.org/cadence/.gen/go/shared" ) // ThriftModule represents the IDL file used to generate this package. diff --git a/.gen/go/cadence/workflowserviceclient/client.go b/.gen/go/cadence/workflowserviceclient/client.go index 599b6c51c..84eb010a3 100644 --- a/.gen/go/cadence/workflowserviceclient/client.go +++ b/.gen/go/cadence/workflowserviceclient/client.go @@ -25,13 +25,15 @@ package workflowserviceclient import ( context "context" - cadence "go.uber.org/cadence/.gen/go/cadence" - shared "go.uber.org/cadence/.gen/go/shared" + reflect "reflect" + wire "go.uber.org/thriftrw/wire" yarpc "go.uber.org/yarpc" transport "go.uber.org/yarpc/api/transport" thrift "go.uber.org/yarpc/encoding/thrift" - reflect "reflect" + + cadence "go.uber.org/cadence/.gen/go/cadence" + shared "go.uber.org/cadence/.gen/go/shared" ) // Interface is a client for the WorkflowService service. diff --git a/.gen/go/cadence/workflowservicefx/client.go b/.gen/go/cadence/workflowservicefx/client.go index 1168e115c..c4bfa5f2e 100644 --- a/.gen/go/cadence/workflowservicefx/client.go +++ b/.gen/go/cadence/workflowservicefx/client.go @@ -24,12 +24,13 @@ package workflowservicefx import ( - workflowserviceclient "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" fx "go.uber.org/fx" yarpc "go.uber.org/yarpc" transport "go.uber.org/yarpc/api/transport" restriction "go.uber.org/yarpc/api/x/restriction" thrift "go.uber.org/yarpc/encoding/thrift" + + workflowserviceclient "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" ) // Params defines the dependencies for the WorkflowService client. diff --git a/.gen/go/cadence/workflowservicefx/server.go b/.gen/go/cadence/workflowservicefx/server.go index 5ccadbc4d..813ca9759 100644 --- a/.gen/go/cadence/workflowservicefx/server.go +++ b/.gen/go/cadence/workflowservicefx/server.go @@ -24,10 +24,11 @@ package workflowservicefx import ( - workflowserviceserver "go.uber.org/cadence/.gen/go/cadence/workflowserviceserver" fx "go.uber.org/fx" transport "go.uber.org/yarpc/api/transport" thrift "go.uber.org/yarpc/encoding/thrift" + + workflowserviceserver "go.uber.org/cadence/.gen/go/cadence/workflowserviceserver" ) // ServerParams defines the dependencies for the WorkflowService server. diff --git a/.gen/go/cadence/workflowserviceserver/server.go b/.gen/go/cadence/workflowserviceserver/server.go index a9c4343e1..ce4bdcd68 100644 --- a/.gen/go/cadence/workflowserviceserver/server.go +++ b/.gen/go/cadence/workflowserviceserver/server.go @@ -25,12 +25,14 @@ package workflowserviceserver import ( context "context" - cadence "go.uber.org/cadence/.gen/go/cadence" - shared "go.uber.org/cadence/.gen/go/shared" + wire "go.uber.org/thriftrw/wire" transport "go.uber.org/yarpc/api/transport" thrift "go.uber.org/yarpc/encoding/thrift" yarpcerrors "go.uber.org/yarpc/yarpcerrors" + + cadence "go.uber.org/cadence/.gen/go/cadence" + shared "go.uber.org/cadence/.gen/go/shared" ) // Interface is the server-side interface for the WorkflowService service. diff --git a/.gen/go/cadence/workflowservicetest/client.go b/.gen/go/cadence/workflowservicetest/client.go index fe187b937..064e02c8f 100644 --- a/.gen/go/cadence/workflowservicetest/client.go +++ b/.gen/go/cadence/workflowservicetest/client.go @@ -25,10 +25,12 @@ package workflowservicetest import ( context "context" + gomock "github.com/golang/mock/gomock" + yarpc "go.uber.org/yarpc" + workflowserviceclient "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" shared "go.uber.org/cadence/.gen/go/shared" - yarpc "go.uber.org/yarpc" ) // MockClient implements a gomock-compatible mock client for service diff --git a/.gen/go/shadower/shadower.go b/.gen/go/shadower/shadower.go index a03b76020..4f437ac59 100644 --- a/.gen/go/shadower/shadower.go +++ b/.gen/go/shadower/shadower.go @@ -28,14 +28,16 @@ import ( base64 "encoding/base64" json "encoding/json" fmt "fmt" - shared "go.uber.org/cadence/.gen/go/shared" + math "math" + strconv "strconv" + strings "strings" + multierr "go.uber.org/multierr" thriftreflect "go.uber.org/thriftrw/thriftreflect" wire "go.uber.org/thriftrw/wire" zapcore "go.uber.org/zap/zapcore" - math "math" - strconv "strconv" - strings "strings" + + shared "go.uber.org/cadence/.gen/go/shared" ) const ErrNonRetryableType string = "com.uber.cadence.internal.shadowing.NonRetryableException" diff --git a/.gen/go/shared/shared.go b/.gen/go/shared/shared.go index 21b3f58fd..9b2035347 100644 --- a/.gen/go/shared/shared.go +++ b/.gen/go/shared/shared.go @@ -29,14 +29,15 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + math "math" + strconv "strconv" + strings "strings" + multierr "go.uber.org/multierr" ptr "go.uber.org/thriftrw/ptr" thriftreflect "go.uber.org/thriftrw/thriftreflect" wire "go.uber.org/thriftrw/wire" zapcore "go.uber.org/zap/zapcore" - math "math" - strconv "strconv" - strings "strings" ) type AccessDeniedError struct { diff --git a/Makefile b/Makefile index 91540c49f..447a867a8 100644 --- a/Makefile +++ b/Makefile @@ -142,8 +142,11 @@ $(BIN)/thriftrw: internal/tools/go.mod $(BIN)/thriftrw-plugin-yarpc: internal/tools/go.mod $(call go_build_tool,go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc) -$(BIN)/golint: internal/tools/go.mod - $(call go_build_tool,golang.org/x/lint/golint) +$(BIN)/goimports: internal/tools/go.mod + $(call go_build_tool,golang.org/x/tools/cmd/goimports) + +$(BIN)/revive: internal/tools/go.mod + $(call go_build_tool,github.com/mgechev/revive) $(BIN)/staticcheck: internal/tools/go.mod $(call go_build_tool,honnef.co/go/tools/cmd/staticcheck) @@ -217,27 +220,11 @@ $(THRIFT_GEN): $(THRIFT_FILES) $(BIN)/thriftrw $(BIN)/thriftrw-plugin-yarpc # other intermediates # ==================================== -# golint fails to report many lint failures if it is only given a single file -# to work on at a time, and it can't handle multiple packages at once, *and* -# we can't exclude files from its checks, so for best results we need to give -# it a whitelist of every file in every package that we want linted, per package. -# -# so lint + this golint func works like: -# - iterate over all lintable dirs (outputs "./folder/") -# - find .go files in a dir (via wildcard, so not recursively) -# - filter to only files in LINT_SRC -# - if it's not empty, run golint against the list -define lint_if_present -test -n "$1" && $(BIN)/golint -set_exit_status $1 -endef - -# TODO: replace this with revive, like the server. -# keep in sync with `lint` -$(BUILD)/lint: $(BIN)/golint $(ALL_SRC) - $Q $(foreach pkg, \ - $(sort $(dir $(LINT_SRC))), \ - $(call lint_if_present,$(filter $(wildcard $(pkg)*.go),$(LINT_SRC))) || ERR=1; \ - ) test -z "$$ERR"; touch $@; exit $$ERR +# note that LINT_SRC is fairly fake as a prerequisite. +# it's a coarse "you probably don't need to re-lint" filter, nothing more. +$(BUILD)/lint: $(LINT_SRC) $(BIN)/revive | $(BUILD) + $Q $(BIN)/revive -config revive.toml -exclude './vendor/...' -exclude './.gen/...' -formatter stylish ./... + $Q touch $@ # fmt and copyright are mutually cyclic with their inputs, so if a copyright header is modified: # - copyright -> makes changes @@ -253,11 +240,10 @@ $(BUILD)/lint: $(BIN)/golint $(ALL_SRC) MAYBE_TOUCH_COPYRIGHT= # TODO: switch to goimports, so we can pin the version -$(BUILD)/fmt: $(ALL_SRC) - $Q echo "gofmt..." +$(BUILD)/fmt: $(ALL_SRC) $(BIN)/goimports + $Q echo "goimports..." $Q # use FRESH_ALL_SRC so it won't miss any generated files produced earlier - $Q gofmt -w $(ALL_SRC) - $Q # ideally, mimic server: $(BIN)/goimports -local "go.uber.org/cadence" -w $(FRESH_ALL_SRC) + $Q $(BIN)/goimports -local "go.uber.org/cadence" -w $(FRESH_ALL_SRC) $Q touch $@ $Q $(MAYBE_TOUCH_COPYRIGHT) @@ -274,22 +260,25 @@ $(BUILD)/copyright: $(ALL_SRC) $(BIN)/copyright # this way the effort is shared with future `make` runs. # ==================================== +# "re-make" a target by deleting and re-building book-keeping target(s). +# the + is necessary for parallelism flags to be propagated +define remake +$Q rm -f $(addprefix $(BUILD)/,$(1)) +$Q +$(MAKE) --no-print-directory $(addprefix $(BUILD)/,$(1)) +endef + .PHONY: build build: $(BUILD)/dummy ## ensure all packages build .PHONY: lint -# useful to actually re-run to get output again, as the intermediate will not be run unless necessary. -# dummy is used only because it occurs before $(BUILD)/lint, fmt would likely be sufficient too. -# keep in sync with `$(BUILD)/lint` -lint: $(BUILD)/dummy $(BIN)/golint ## (re)run golint - $Q $(foreach pkg, \ - $(sort $(dir $(LINT_SRC))), \ - $(call lint_if_present,$(filter $(wildcard $(pkg)*.go),$(LINT_SRC))) || ERR=1; \ - ) test -z "$$ERR"; touch $(BUILD)/lint; exit $$ERR +# useful to actually re-run to get output again. +# reuse the intermediates for simplicity and consistency. +lint: ## (re)run the linter + $(call remake,lint) .PHONY: fmt -# intentionally not re-making, gofmt is slow and it's clear when it's unnecessary -fmt: $(BUILD)/fmt ## run gofmt +# intentionally not re-making, it's clear when it's unnecessary +fmt: $(BUILD)/fmt ## run goimports .PHONY: copyright # not identical to the intermediate target, but does provide the same codegen (or more). diff --git a/activity/activity.go b/activity/activity.go index 31d274b6f..23fad3583 100644 --- a/activity/activity.go +++ b/activity/activity.go @@ -24,8 +24,9 @@ import ( "context" "github.com/uber-go/tally" - "go.uber.org/cadence/internal" "go.uber.org/zap" + + "go.uber.org/cadence/internal" ) type ( diff --git a/compatibility/thrift2proto.go b/compatibility/thrift2proto.go index c64e74096..203839d4c 100644 --- a/compatibility/thrift2proto.go +++ b/compatibility/thrift2proto.go @@ -21,9 +21,10 @@ package compatibility import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" internal "go.uber.org/cadence/internal/compatibility" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) // NewThrift2ProtoAdapter creates an adapter for mapping calls from Thrift to Protobuf types. diff --git a/evictiontest/workflow_cache_eviction_test.go b/evictiontest/workflow_cache_eviction_test.go index e81f5137b..e9a494451 100644 --- a/evictiontest/workflow_cache_eviction_test.go +++ b/evictiontest/workflow_cache_eviction_test.go @@ -37,14 +37,15 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" "go.uber.org/atomic" + "go.uber.org/yarpc" + "go.uber.org/zap/zaptest" + "golang.org/x/net/context" + "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" m "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/worker" - "go.uber.org/yarpc" - "go.uber.org/zap/zaptest" - "golang.org/x/net/context" ) // copied from internal/test_helpers_test.go diff --git a/internal/activity.go b/internal/activity.go index 18db1ad01..9c4b20ce5 100644 --- a/internal/activity.go +++ b/internal/activity.go @@ -28,9 +28,10 @@ import ( "github.com/opentracing/opentracing-go" "github.com/uber-go/tally" - "go.uber.org/cadence/.gen/go/shared" "go.uber.org/zap" "go.uber.org/zap/zapcore" + + "go.uber.org/cadence/.gen/go/shared" ) type ( diff --git a/internal/activity_test.go b/internal/activity_test.go index a220d2e82..88e731533 100644 --- a/internal/activity_test.go +++ b/internal/activity_test.go @@ -27,10 +27,11 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.uber.org/yarpc" + "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" - "go.uber.org/yarpc" ) type activityTestSuite struct { diff --git a/internal/client.go b/internal/client.go index 9679becb0..1167ce004 100644 --- a/internal/client.go +++ b/internal/client.go @@ -28,11 +28,12 @@ import ( "github.com/opentracing/opentracing-go" "github.com/uber-go/tally" + "go.uber.org/zap" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" s "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common/auth" "go.uber.org/cadence/internal/common/metrics" - "go.uber.org/zap" ) const ( diff --git a/internal/common/auth/service_wrapper.go b/internal/common/auth/service_wrapper.go index 4dc02a3ac..badf036d2 100644 --- a/internal/common/auth/service_wrapper.go +++ b/internal/common/auth/service_wrapper.go @@ -23,9 +23,10 @@ package auth import ( "context" + "go.uber.org/yarpc" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/.gen/go/shared" - "go.uber.org/yarpc" ) const ( diff --git a/internal/common/auth/service_wrapper_test.go b/internal/common/auth/service_wrapper_test.go index e58b4e8b2..e266ade88 100644 --- a/internal/common/auth/service_wrapper_test.go +++ b/internal/common/auth/service_wrapper_test.go @@ -22,12 +22,15 @@ package auth import ( "fmt" - "github.com/uber/tchannel-go/thrift" - "go.uber.org/cadence/.gen/go/shared" "testing" "time" + "github.com/uber/tchannel-go/thrift" + + "go.uber.org/cadence/.gen/go/shared" + "github.com/golang/mock/gomock" + "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" "github.com/stretchr/testify/suite" diff --git a/internal/common/backoff/retry_test.go b/internal/common/backoff/retry_test.go index 01f770e63..91912fdbf 100644 --- a/internal/common/backoff/retry_test.go +++ b/internal/common/backoff/retry_test.go @@ -27,6 +27,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "go.uber.org/cadence/.gen/go/shared" ) diff --git a/internal/common/metrics/service_wrapper.go b/internal/common/metrics/service_wrapper.go index f62b0e827..40eedfb9a 100644 --- a/internal/common/metrics/service_wrapper.go +++ b/internal/common/metrics/service_wrapper.go @@ -26,9 +26,10 @@ import ( "time" "github.com/uber-go/tally" + "go.uber.org/yarpc" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/.gen/go/shared" - "go.uber.org/yarpc" ) type ( diff --git a/internal/common/metrics/service_wrapper_test.go b/internal/common/metrics/service_wrapper_test.go index 8deee2955..e5ea638e6 100644 --- a/internal/common/metrics/service_wrapper_test.go +++ b/internal/common/metrics/service_wrapper_test.go @@ -32,10 +32,11 @@ import ( "github.com/stretchr/testify/require" "github.com/uber-go/tally" "github.com/uber/tchannel-go/thrift" + "go.uber.org/yarpc" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" s "go.uber.org/cadence/.gen/go/shared" - "go.uber.org/yarpc" ) var ( diff --git a/internal/common/serializer/history_serializer.go b/internal/common/serializer/history_serializer.go index 1ee7ba10e..abe0be549 100644 --- a/internal/common/serializer/history_serializer.go +++ b/internal/common/serializer/history_serializer.go @@ -25,9 +25,11 @@ import ( "encoding/json" "errors" "fmt" - "go.uber.org/cadence/.gen/go/shared" + "go.uber.org/thriftrw/protocol" "go.uber.org/thriftrw/wire" + + "go.uber.org/cadence/.gen/go/shared" ) type ( diff --git a/internal/compatibility/adapter.go b/internal/compatibility/adapter.go index 57c27bfe6..5a7709b11 100644 --- a/internal/compatibility/adapter.go +++ b/internal/compatibility/adapter.go @@ -23,12 +23,14 @@ package compatibility import ( "context" - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" + "go.uber.org/yarpc" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/compatibility/proto" "go.uber.org/cadence/internal/compatibility/thrift" - "go.uber.org/yarpc" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) type thrift2protoAdapter struct { diff --git a/internal/compatibility/api_test.go b/internal/compatibility/api_test.go index cb2b87d88..161408ac8 100644 --- a/internal/compatibility/api_test.go +++ b/internal/compatibility/api_test.go @@ -25,12 +25,14 @@ import ( gogo "github.com/gogo/protobuf/types" "github.com/stretchr/testify/assert" - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" + "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/internal/compatibility/proto" "go.uber.org/cadence/internal/compatibility/testdata" "go.uber.org/cadence/internal/compatibility/thrift" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func TestActivityLocalDispatchInfo(t *testing.T) { diff --git a/internal/compatibility/enum_test.go b/internal/compatibility/enum_test.go index 1d972d4eb..366f23133 100644 --- a/internal/compatibility/enum_test.go +++ b/internal/compatibility/enum_test.go @@ -24,10 +24,12 @@ import ( "testing" "github.com/stretchr/testify/assert" - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" + "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/compatibility/proto" "go.uber.org/cadence/internal/compatibility/thrift" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) const UnknownValue = 9999 diff --git a/internal/compatibility/error_test.go b/internal/compatibility/error_test.go index 7f9843e8c..6b26d1dcc 100644 --- a/internal/compatibility/error_test.go +++ b/internal/compatibility/error_test.go @@ -25,10 +25,11 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.uber.org/yarpc/yarpcerrors" + "go.uber.org/cadence/internal/compatibility/proto" "go.uber.org/cadence/internal/compatibility/testdata" "go.uber.org/cadence/internal/compatibility/thrift" - "go.uber.org/yarpc/yarpcerrors" ) func TestErrors(t *testing.T) { diff --git a/internal/compatibility/proto/decision.go b/internal/compatibility/proto/decision.go index 520cf8bdd..e33de03bf 100644 --- a/internal/compatibility/proto/decision.go +++ b/internal/compatibility/proto/decision.go @@ -21,8 +21,9 @@ package proto import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/shared" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func DecisionArray(t []*shared.Decision) []*apiv1.Decision { diff --git a/internal/compatibility/proto/enum.go b/internal/compatibility/proto/enum.go index 1033fa162..d5ed89211 100644 --- a/internal/compatibility/proto/enum.go +++ b/internal/compatibility/proto/enum.go @@ -21,8 +21,9 @@ package proto import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/shared" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func TaskListKind(t *shared.TaskListKind) apiv1.TaskListKind { diff --git a/internal/compatibility/proto/error.go b/internal/compatibility/proto/error.go index 52565e10e..8f0d3273b 100644 --- a/internal/compatibility/proto/error.go +++ b/internal/compatibility/proto/error.go @@ -21,10 +21,12 @@ package proto import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" - "go.uber.org/cadence/.gen/go/shared" "go.uber.org/yarpc/encoding/protobuf" "go.uber.org/yarpc/yarpcerrors" + + "go.uber.org/cadence/.gen/go/shared" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func Error(err error) error { diff --git a/internal/compatibility/proto/helpers.go b/internal/compatibility/proto/helpers.go index f7bf99b9e..09965fb58 100644 --- a/internal/compatibility/proto/helpers.go +++ b/internal/compatibility/proto/helpers.go @@ -24,6 +24,7 @@ import ( "time" gogo "github.com/gogo/protobuf/types" + "go.uber.org/cadence/internal/common" ) diff --git a/internal/compatibility/proto/history.go b/internal/compatibility/proto/history.go index d2dc41799..2a9f8cd47 100644 --- a/internal/compatibility/proto/history.go +++ b/internal/compatibility/proto/history.go @@ -21,8 +21,9 @@ package proto import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/shared" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func History(t *shared.History) *apiv1.History { diff --git a/internal/compatibility/proto/request.go b/internal/compatibility/proto/request.go index 49332eae0..368040994 100644 --- a/internal/compatibility/proto/request.go +++ b/internal/compatibility/proto/request.go @@ -21,8 +21,9 @@ package proto import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/shared" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func CountWorkflowExecutionsRequest(t *shared.CountWorkflowExecutionsRequest) *apiv1.CountWorkflowExecutionsRequest { diff --git a/internal/compatibility/proto/response.go b/internal/compatibility/proto/response.go index 6ed13158f..2fc755e96 100644 --- a/internal/compatibility/proto/response.go +++ b/internal/compatibility/proto/response.go @@ -21,8 +21,9 @@ package proto import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/shared" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func CountWorkflowExecutionsResponse(t *shared.CountWorkflowExecutionsResponse) *apiv1.CountWorkflowExecutionsResponse { diff --git a/internal/compatibility/proto/types.go b/internal/compatibility/proto/types.go index 9652ac049..b902117a7 100644 --- a/internal/compatibility/proto/types.go +++ b/internal/compatibility/proto/types.go @@ -21,8 +21,9 @@ package proto import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/shared" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func Payload(data []byte) *apiv1.Payload { diff --git a/internal/compatibility/testdata/common.go b/internal/compatibility/testdata/common.go index 15cce9877..c6f715960 100644 --- a/internal/compatibility/testdata/common.go +++ b/internal/compatibility/testdata/common.go @@ -24,6 +24,7 @@ import ( "time" gogo "github.com/gogo/protobuf/types" + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) diff --git a/internal/compatibility/testdata/domain.go b/internal/compatibility/testdata/domain.go index e909c2b00..7bcebadc7 100644 --- a/internal/compatibility/testdata/domain.go +++ b/internal/compatibility/testdata/domain.go @@ -24,6 +24,7 @@ import ( "time" gogo "github.com/gogo/protobuf/types" + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) diff --git a/internal/compatibility/testdata/error.go b/internal/compatibility/testdata/error.go index 4062d786a..56b4eb3fb 100644 --- a/internal/compatibility/testdata/error.go +++ b/internal/compatibility/testdata/error.go @@ -21,9 +21,10 @@ package testdata import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/yarpc/encoding/protobuf" "go.uber.org/yarpc/yarpcerrors" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) const ( diff --git a/internal/compatibility/testdata/service.go b/internal/compatibility/testdata/service.go index 14395465e..df1534cc8 100644 --- a/internal/compatibility/testdata/service.go +++ b/internal/compatibility/testdata/service.go @@ -22,6 +22,7 @@ package testdata import ( gogo "github.com/gogo/protobuf/types" + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) diff --git a/internal/compatibility/thrift/decision.go b/internal/compatibility/thrift/decision.go index 6a3ae6ff1..22e763d41 100644 --- a/internal/compatibility/thrift/decision.go +++ b/internal/compatibility/thrift/decision.go @@ -21,8 +21,9 @@ package thrift import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/shared" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func DecisionArray(t []*apiv1.Decision) []*shared.Decision { diff --git a/internal/compatibility/thrift/enum.go b/internal/compatibility/thrift/enum.go index a86a7924c..676d209b4 100644 --- a/internal/compatibility/thrift/enum.go +++ b/internal/compatibility/thrift/enum.go @@ -21,8 +21,9 @@ package thrift import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/shared" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func TaskListKind(t apiv1.TaskListKind) *shared.TaskListKind { diff --git a/internal/compatibility/thrift/error.go b/internal/compatibility/thrift/error.go index 865e239bc..9b21d9166 100644 --- a/internal/compatibility/thrift/error.go +++ b/internal/compatibility/thrift/error.go @@ -23,11 +23,13 @@ package thrift import ( "errors" - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" - "go.uber.org/cadence/.gen/go/shared" - "go.uber.org/cadence/internal/common" "go.uber.org/yarpc/encoding/protobuf" "go.uber.org/yarpc/yarpcerrors" + + "go.uber.org/cadence/.gen/go/shared" + "go.uber.org/cadence/internal/common" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func Error(err error) error { diff --git a/internal/compatibility/thrift/helpers.go b/internal/compatibility/thrift/helpers.go index 4d3ff7e7c..2e93f52d4 100644 --- a/internal/compatibility/thrift/helpers.go +++ b/internal/compatibility/thrift/helpers.go @@ -24,6 +24,7 @@ import ( "time" gogo "github.com/gogo/protobuf/types" + "go.uber.org/cadence/internal/common" ) diff --git a/internal/compatibility/thrift/history.go b/internal/compatibility/thrift/history.go index d64a92d29..758f088b7 100644 --- a/internal/compatibility/thrift/history.go +++ b/internal/compatibility/thrift/history.go @@ -21,9 +21,10 @@ package thrift import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func History(t *apiv1.History) *shared.History { diff --git a/internal/compatibility/thrift/request.go b/internal/compatibility/thrift/request.go index e0d026c97..8810198ea 100644 --- a/internal/compatibility/thrift/request.go +++ b/internal/compatibility/thrift/request.go @@ -21,8 +21,9 @@ package thrift import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/shared" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func CountWorkflowExecutionsRequest(t *apiv1.CountWorkflowExecutionsRequest) *shared.CountWorkflowExecutionsRequest { diff --git a/internal/compatibility/thrift/response.go b/internal/compatibility/thrift/response.go index e2069c955..365ebd3ab 100644 --- a/internal/compatibility/thrift/response.go +++ b/internal/compatibility/thrift/response.go @@ -21,8 +21,9 @@ package thrift import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/shared" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func CountWorkflowExecutionsResponse(t *apiv1.CountWorkflowExecutionsResponse) *shared.CountWorkflowExecutionsResponse { diff --git a/internal/compatibility/thrift/types.go b/internal/compatibility/thrift/types.go index f6b80e0b1..79a370fea 100644 --- a/internal/compatibility/thrift/types.go +++ b/internal/compatibility/thrift/types.go @@ -21,9 +21,10 @@ package thrift import ( - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func Payload(p *apiv1.Payload) []byte { diff --git a/internal/context.go b/internal/context.go index 2d10aadb7..4248fcf7d 100644 --- a/internal/context.go +++ b/internal/context.go @@ -26,6 +26,7 @@ import ( "time" "github.com/opentracing/opentracing-go" + "go.uber.org/cadence/.gen/go/shared" ) diff --git a/internal/encoded_test.go b/internal/encoded_test.go index 66f6afbe5..d23abaaf9 100644 --- a/internal/encoded_test.go +++ b/internal/encoded_test.go @@ -24,9 +24,10 @@ import ( "bytes" "encoding/gob" "fmt" - "github.com/stretchr/testify/require" "reflect" "testing" + + "github.com/stretchr/testify/require" ) func testDataConverterFunction(t *testing.T, dc DataConverter, f interface{}, args ...interface{}) string { diff --git a/internal/encoding.go b/internal/encoding.go index 1a2d2ccf5..52c6213be 100644 --- a/internal/encoding.go +++ b/internal/encoding.go @@ -28,6 +28,7 @@ import ( "reflect" "github.com/apache/thrift/lib/go/thrift" + "go.uber.org/cadence/internal/common" ) diff --git a/internal/error_test.go b/internal/error_test.go index eff218072..a3cbd0ffa 100644 --- a/internal/error_test.go +++ b/internal/error_test.go @@ -26,9 +26,10 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" + "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" - "go.uber.org/zap/zaptest" ) const ( diff --git a/internal/headers_test.go b/internal/headers_test.go index b0b091a6b..51b0f111f 100644 --- a/internal/headers_test.go +++ b/internal/headers_test.go @@ -24,6 +24,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "go.uber.org/cadence/.gen/go/shared" ) diff --git a/internal/internal_activity.go b/internal/internal_activity.go index a854b0e24..ed0e5c835 100644 --- a/internal/internal_activity.go +++ b/internal/internal_activity.go @@ -32,9 +32,10 @@ import ( "github.com/opentracing/opentracing-go" "github.com/uber-go/tally" + "go.uber.org/zap" + "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" - "go.uber.org/zap" ) type ( diff --git a/internal/internal_decision_state_machine.go b/internal/internal_decision_state_machine.go index 479dad0bb..20d7aa06a 100644 --- a/internal/internal_decision_state_machine.go +++ b/internal/internal_decision_state_machine.go @@ -23,6 +23,7 @@ package internal import ( "container/list" "fmt" + s "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/internal/common/util" diff --git a/internal/internal_decision_state_machine_test.go b/internal/internal_decision_state_machine_test.go index 172bcf988..c700a8fe6 100644 --- a/internal/internal_decision_state_machine_test.go +++ b/internal/internal_decision_state_machine_test.go @@ -24,6 +24,7 @@ import ( "testing" "github.com/stretchr/testify/require" + s "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" ) diff --git a/internal/internal_event_handlers.go b/internal/internal_event_handlers.go index 9aa473b1c..e72142a89 100644 --- a/internal/internal_event_handlers.go +++ b/internal/internal_event_handlers.go @@ -33,12 +33,13 @@ import ( "github.com/opentracing/opentracing-go" "github.com/uber-go/tally" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "go.uber.org/cadence/.gen/go/shared" m "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/internal/common/metrics" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) const ( diff --git a/internal/internal_event_handlers_test.go b/internal/internal_event_handlers_test.go index 10b40f222..2a97272f3 100644 --- a/internal/internal_event_handlers_test.go +++ b/internal/internal_event_handlers_test.go @@ -26,10 +26,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - s "go.uber.org/cadence/.gen/go/shared" "go.uber.org/zap" "go.uber.org/zap/zapcore" "go.uber.org/zap/zaptest/observer" + + s "go.uber.org/cadence/.gen/go/shared" ) func TestReplayAwareLogger(t *testing.T) { diff --git a/internal/internal_poller_autoscaler.go b/internal/internal_poller_autoscaler.go index e6d6d19b1..333f03933 100644 --- a/internal/internal_poller_autoscaler.go +++ b/internal/internal_poller_autoscaler.go @@ -23,12 +23,14 @@ package internal import ( "context" "errors" + "sync" + "time" + "github.com/marusama/semaphore/v2" "go.uber.org/atomic" - "go.uber.org/cadence/internal/common/autoscaler" "go.uber.org/zap" - "sync" - "time" + + "go.uber.org/cadence/internal/common/autoscaler" ) // defaultPollerScalerCooldownInSeconds diff --git a/internal/internal_poller_autoscaler_test.go b/internal/internal_poller_autoscaler_test.go index f313fb2d6..48337284b 100644 --- a/internal/internal_poller_autoscaler_test.go +++ b/internal/internal_poller_autoscaler_test.go @@ -28,9 +28,10 @@ import ( "github.com/stretchr/testify/assert" "go.uber.org/atomic" + "go.uber.org/zap/zaptest" + s "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common/autoscaler" - "go.uber.org/zap/zaptest" ) func Test_pollerAutoscaler(t *testing.T) { diff --git a/internal/internal_pressure_points.go b/internal/internal_pressure_points.go index 4d0c8a830..901a474dc 100644 --- a/internal/internal_pressure_points.go +++ b/internal/internal_pressure_points.go @@ -27,8 +27,9 @@ import ( "strconv" "time" - "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/zap" + + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" ) // ** This is for internal stress testing framework ** diff --git a/internal/internal_retry_test.go b/internal/internal_retry_test.go index 50c5ab79b..a5fd8a01a 100644 --- a/internal/internal_retry_test.go +++ b/internal/internal_retry_test.go @@ -25,6 +25,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + s "go.uber.org/cadence/.gen/go/shared" ) diff --git a/internal/internal_task_handlers.go b/internal/internal_task_handlers.go index a7b65aae8..067da830b 100644 --- a/internal/internal_task_handlers.go +++ b/internal/internal_task_handlers.go @@ -36,6 +36,8 @@ import ( "time" "github.com/opentracing/opentracing-go" + "go.uber.org/zap" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" s "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" @@ -43,7 +45,6 @@ import ( "go.uber.org/cadence/internal/common/cache" "go.uber.org/cadence/internal/common/metrics" "go.uber.org/cadence/internal/common/util" - "go.uber.org/zap" ) const ( diff --git a/internal/internal_task_handlers_interfaces_test.go b/internal/internal_task_handlers_interfaces_test.go index 3ff7615d8..7438b1d9e 100644 --- a/internal/internal_task_handlers_interfaces_test.go +++ b/internal/internal_task_handlers_interfaces_test.go @@ -27,10 +27,11 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" "github.com/uber/tchannel-go/thrift" + "golang.org/x/net/context" + "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" m "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" - "golang.org/x/net/context" ) type ( diff --git a/internal/internal_task_handlers_test.go b/internal/internal_task_handlers_test.go index 747d49850..ac719775f 100644 --- a/internal/internal_task_handlers_test.go +++ b/internal/internal_task_handlers_test.go @@ -37,12 +37,13 @@ import ( "github.com/pborman/uuid" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" - s "go.uber.org/cadence/.gen/go/shared" - "go.uber.org/cadence/internal/common" "go.uber.org/goleak" "go.uber.org/zap" "go.uber.org/zap/zaptest" + + "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" + s "go.uber.org/cadence/.gen/go/shared" + "go.uber.org/cadence/internal/common" ) const ( diff --git a/internal/internal_task_pollers.go b/internal/internal_task_pollers.go index 27b393618..5ba6a9c24 100644 --- a/internal/internal_task_pollers.go +++ b/internal/internal_task_pollers.go @@ -33,13 +33,14 @@ import ( "github.com/opentracing/opentracing-go" "github.com/pborman/uuid" "github.com/uber-go/tally" + "go.uber.org/zap" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" s "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/internal/common/backoff" "go.uber.org/cadence/internal/common/metrics" "go.uber.org/cadence/internal/common/serializer" - "go.uber.org/zap" ) const ( diff --git a/internal/internal_utils.go b/internal/internal_utils.go index 987b3dcd6..d6b45b227 100644 --- a/internal/internal_utils.go +++ b/internal/internal_utils.go @@ -34,10 +34,11 @@ import ( "github.com/pborman/uuid" "github.com/uber-go/tally" + "go.uber.org/yarpc" + s "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/internal/common/metrics" - "go.uber.org/yarpc" ) const ( diff --git a/internal/internal_utils_test.go b/internal/internal_utils_test.go index 211df8fdf..d6a268619 100644 --- a/internal/internal_utils_test.go +++ b/internal/internal_utils_test.go @@ -26,6 +26,7 @@ import ( "time" "github.com/stretchr/testify/require" + s "go.uber.org/cadence/.gen/go/shared" ) diff --git a/internal/internal_worker.go b/internal/internal_worker.go index 38e72c1ac..3220f8ce0 100644 --- a/internal/internal_worker.go +++ b/internal/internal_worker.go @@ -41,14 +41,15 @@ import ( "github.com/opentracing/opentracing-go" "github.com/pborman/uuid" "github.com/uber-go/tally" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common/auth" "go.uber.org/cadence/internal/common/backoff" "go.uber.org/cadence/internal/common/metrics" "go.uber.org/cadence/internal/common/util" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) var startVersionMetric sync.Once diff --git a/internal/internal_worker_base.go b/internal/internal_worker_base.go index c3d667b6d..6341f73cb 100644 --- a/internal/internal_worker_base.go +++ b/internal/internal_worker_base.go @@ -33,13 +33,14 @@ import ( "time" "github.com/uber-go/tally" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "golang.org/x/time/rate" + "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common/backoff" "go.uber.org/cadence/internal/common/metrics" "go.uber.org/cadence/internal/common/util" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - "golang.org/x/time/rate" ) const ( diff --git a/internal/internal_worker_interfaces_test.go b/internal/internal_worker_interfaces_test.go index ac65c5aab..e204b9647 100644 --- a/internal/internal_worker_interfaces_test.go +++ b/internal/internal_worker_interfaces_test.go @@ -30,9 +30,10 @@ import ( "github.com/golang/mock/gomock" "github.com/opentracing/opentracing-go" "github.com/stretchr/testify/suite" + "go.uber.org/zap/zaptest" + "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" m "go.uber.org/cadence/.gen/go/shared" - "go.uber.org/zap/zaptest" ) const ( diff --git a/internal/internal_worker_test.go b/internal/internal_worker_test.go index 96d364b74..4e4332a61 100644 --- a/internal/internal_worker_test.go +++ b/internal/internal_worker_test.go @@ -36,12 +36,13 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "github.com/uber-go/tally" - "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" - "go.uber.org/cadence/.gen/go/shared" - "go.uber.org/cadence/internal/common" "go.uber.org/yarpc" "go.uber.org/zap" "go.uber.org/zap/zaptest" + + "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" + "go.uber.org/cadence/.gen/go/shared" + "go.uber.org/cadence/internal/common" ) func testInternalWorkerRegister(r *registry) { diff --git a/internal/internal_workers_test.go b/internal/internal_workers_test.go index 6fe38bfb1..d68140911 100644 --- a/internal/internal_workers_test.go +++ b/internal/internal_workers_test.go @@ -30,12 +30,13 @@ import ( "github.com/golang/mock/gomock" "github.com/pborman/uuid" "github.com/stretchr/testify/suite" - "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" - m "go.uber.org/cadence/.gen/go/shared" - "go.uber.org/cadence/internal/common" "go.uber.org/yarpc" "go.uber.org/zap" "go.uber.org/zap/zaptest" + + "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" + m "go.uber.org/cadence/.gen/go/shared" + "go.uber.org/cadence/internal/common" ) // ActivityTaskHandler never returns response diff --git a/internal/internal_workflow.go b/internal/internal_workflow.go index 6ad765ab7..be203fa70 100644 --- a/internal/internal_workflow.go +++ b/internal/internal_workflow.go @@ -35,12 +35,13 @@ import ( "github.com/robfig/cron" "go.uber.org/atomic" + "go.uber.org/zap" + "go.uber.org/cadence/.gen/go/shared" s "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/internal/common/metrics" "go.uber.org/cadence/internal/common/util" - "go.uber.org/zap" ) const ( diff --git a/internal/internal_workflow_client_test.go b/internal/internal_workflow_client_test.go index c8be2a956..166509054 100644 --- a/internal/internal_workflow_client_test.go +++ b/internal/internal_workflow_client_test.go @@ -29,9 +29,10 @@ import ( "testing" "time" - "go.uber.org/cadence/internal/common/serializer" "go.uber.org/yarpc" + "go.uber.org/cadence/internal/common/serializer" + "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" @@ -39,6 +40,7 @@ import ( "github.com/golang/mock/gomock" "github.com/pborman/uuid" "github.com/stretchr/testify/suite" + "go.uber.org/cadence/internal/common/metrics" ) diff --git a/internal/internal_workflow_test.go b/internal/internal_workflow_test.go index 797ee3efd..fd705197a 100644 --- a/internal/internal_workflow_test.go +++ b/internal/internal_workflow_test.go @@ -31,8 +31,9 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "go.uber.org/cadence/internal/common/metrics" "go.uber.org/zap/zaptest" + + "go.uber.org/cadence/internal/common/metrics" ) type WorkflowUnitTest struct { diff --git a/internal/internal_workflow_testsuite.go b/internal/internal_workflow_testsuite.go index 1d13b0298..ae4f1adfc 100644 --- a/internal/internal_workflow_testsuite.go +++ b/internal/internal_workflow_testsuite.go @@ -36,13 +36,14 @@ import ( "github.com/robfig/cron" "github.com/stretchr/testify/mock" "github.com/uber-go/tally" + "go.uber.org/yarpc" + "go.uber.org/zap" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/internal/common/metrics" - "go.uber.org/yarpc" - "go.uber.org/zap" ) const ( diff --git a/internal/internal_workflow_testsuite_test.go b/internal/internal_workflow_testsuite_test.go index aff4f55e2..31812f543 100644 --- a/internal/internal_workflow_testsuite_test.go +++ b/internal/internal_workflow_testsuite_test.go @@ -33,10 +33,11 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" - "go.uber.org/cadence/.gen/go/shared" - "go.uber.org/cadence/internal/common" "go.uber.org/zap" "go.uber.org/zap/zaptest" + + "go.uber.org/cadence/.gen/go/shared" + "go.uber.org/cadence/internal/common" ) type WorkflowTestSuiteUnitTest struct { diff --git a/internal/jwt_authorization.go b/internal/jwt_authorization.go index 9091eb881..b63741413 100644 --- a/internal/jwt_authorization.go +++ b/internal/jwt_authorization.go @@ -21,10 +21,12 @@ package internal import ( + "time" + "github.com/cristalhq/jwt/v3" + "go.uber.org/cadence/internal/common/auth" "go.uber.org/cadence/internal/common/util" - "time" ) type JWTAuthProvider struct { diff --git a/internal/jwt_authorization_test.go b/internal/jwt_authorization_test.go index f869454d3..771df4022 100644 --- a/internal/jwt_authorization_test.go +++ b/internal/jwt_authorization_test.go @@ -27,6 +27,7 @@ import ( "github.com/cristalhq/jwt/v3" "github.com/stretchr/testify/suite" + "go.uber.org/cadence/internal/common/auth" "go.uber.org/cadence/internal/common/util" ) diff --git a/internal/session.go b/internal/session.go index 43c1876b4..9ff9fec1a 100644 --- a/internal/session.go +++ b/internal/session.go @@ -28,8 +28,9 @@ import ( "time" "github.com/pborman/uuid" - "go.uber.org/cadence/internal/common/backoff" "go.uber.org/zap" + + "go.uber.org/cadence/internal/common/backoff" ) type ( diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 397d20cfd..0adb09c1b 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -3,32 +3,42 @@ module go.uber.org/cadence/internal/tools go 1.19 require ( - github.com/kisielk/errcheck v1.5.0 github.com/mattn/goveralls v0.0.11 + github.com/kisielk/errcheck v1.6.3 + github.com/mgechev/revive v1.2.5 go.uber.org/thriftrw v1.25.0 go.uber.org/yarpc v1.55.0 - golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 - honnef.co/go/tools v0.3.2 + golang.org/x/tools v0.5.0 + honnef.co/go/tools v0.4.0 ) require ( github.com/BurntSushi/toml v1.2.1 // indirect github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 // indirect + github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348 // indirect + github.com/fatih/color v1.14.1 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/golang/mock v1.5.0 // indirect github.com/jessevdk/go-flags v1.4.0 // indirect github.com/kr/pretty v0.3.0 // indirect - github.com/stretchr/testify v1.8.1 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/rivo/uniseg v0.4.3 // indirect github.com/uber/tchannel-go v1.32.1 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/fx v1.13.1 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.17.0 // indirect - golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e // indirect + golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9 // indirect + golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect golang.org/x/mod v0.7.0 // indirect golang.org/x/sys v0.4.0 // indirect golang.org/x/text v0.6.0 // indirect - golang.org/x/tools v0.5.0 // indirect google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect google.golang.org/grpc v1.46.2 // indirect google.golang.org/protobuf v1.28.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index ad3784166..f1ef06a5c 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -20,6 +20,8 @@ github.com/cactus/go-statsd-client/statsd v0.0.0-20191106001114-12b4e2b38748/go. github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348 h1:cy5GCEZLUCshCGCRRUjxHrDUqkB4l5cuUt3ShEckQEo= +github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348/go.mod h1:f/miWtG3SSuTxKsNK3o58H1xl+XV6ZIfbC6p7lPPB8U= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -39,6 +41,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= +github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= github.com/fatih/structtag v1.0.0/go.mod h1:IKitwq45uXL/yqi5mYghiD3w9H6eTOvI9vnk8tXMphA= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= @@ -97,8 +101,8 @@ github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/errcheck v1.5.0 h1:e8esj/e4R+SAOwFwN+n3zr0nYeCyeweozKfO23MvHzY= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/errcheck v1.6.3 h1:dEKh+GLHcWm2oN34nMvDzn1sqI0i0WxPvrgiJA5JuM8= +github.com/kisielk/errcheck v1.6.3/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -111,17 +115,33 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= +github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= github.com/mattn/goveralls v0.0.11 h1:eJXea6R6IFlL1QMKNMzDvvHv/hwGrnvyig4N+0+XiMM= github.com/mattn/goveralls v0.0.11/go.mod h1:gU8SyhNswsJKchEV93xRQxX6X3Ei4PJdQk/6ZHvrvRk= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 h1:zpIH83+oKzcpryru8ceC6BxnoG8TBrhgAvRg8obzup0= +github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= +github.com/mgechev/revive v1.2.5 h1:UF9AR8pOAuwNmhXj2odp4mxv9Nx2qUIwVz8ZsU+Mbec= +github.com/mgechev/revive v1.2.5/go.mod h1:nFOXent79jMTISAfOAasKfy0Z2Ejq0WX7Qn/KAdYopI= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -152,6 +172,9 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.0.9 h1:DksSrntiTPE63NQuxGcFa1OS/odKfwJu3PJHrhKAy7Q= github.com/prometheus/procfs v0.0.9/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= +github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= @@ -186,7 +209,7 @@ github.com/uber/ringpop-go v0.8.5/go.mod h1:zVI6eGO6L7pG14GkntHsSOfmUAWQ7B4lvmzl github.com/uber/tchannel-go v1.16.0/go.mod h1:Rrgz1eL8kMjW/nEzZos0t+Heq0O4LhnUJVA32OvWKHo= github.com/uber/tchannel-go v1.32.1 h1:0Pu5kdZceabAt7Rr4pUC4YRpMJkE/tTfReMZdlvDjnU= github.com/uber/tchannel-go v1.32.1/go.mod h1:yT2EUp6YperZ0Tb/jwDX9gVEeiSG74r/L3CjF7zNJHs= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -223,9 +246,10 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e h1:qyrTQ++p1afMkO4DPEeLGq/3oTsdlvdH4vqZUBWzUKM= -golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9 h1:6WHiuFL9FNjg8RljAaT7FNUuKDbvMqS1i5cr2OE2sLQ= +golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -238,6 +262,7 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -250,10 +275,11 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -263,6 +289,7 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -279,7 +306,11 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -288,6 +319,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -309,7 +342,7 @@ golang.org/x/tools v0.0.0-20191226212025-6b505debf4bc/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200117215004-fe56e6335763/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200216192241-b320d3a0f5a2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.5.0 h1:+bSpV5HIeWkuvgaMfI3UmKRThoTA5ODJTUd8T17NO+4= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -371,7 +404,7 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.3.2 h1:ytYb4rOqyp1TSa2EPvNVwtPQJctSELKaMyLfqNP4+34= -honnef.co/go/tools v0.3.2/go.mod h1:jzwdWgg7Jdq75wlfblQxO4neNaFFSvgc1tD5Wv8U0Yw= +honnef.co/go/tools v0.4.0 h1:lyXVV1c8wUBJRKqI8JgIpT8TW1VDagfYYaxbKa/HoL8= +honnef.co/go/tools v0.4.0/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/internal/tools/tools.go b/internal/tools/tools.go index 322e84c8a..0af967dcf 100644 --- a/internal/tools/tools.go +++ b/internal/tools/tools.go @@ -26,8 +26,9 @@ package tools import ( _ "github.com/kisielk/errcheck" _ "github.com/mattn/goveralls" + _ "github.com/mgechev/revive" _ "go.uber.org/thriftrw" _ "go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc" - _ "golang.org/x/lint/golint" + _ "golang.org/x/tools/cmd/goimports" _ "honnef.co/go/tools/cmd/staticcheck" ) diff --git a/internal/tracer_test.go b/internal/tracer_test.go index 76fcf820f..7c0432b67 100644 --- a/internal/tracer_test.go +++ b/internal/tracer_test.go @@ -28,8 +28,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" jaeger_config "github.com/uber/jaeger-client-go/config" - "go.uber.org/cadence/.gen/go/shared" "go.uber.org/zap" + + "go.uber.org/cadence/.gen/go/shared" ) func TestTracingContextPropagator(t *testing.T) { diff --git a/internal/worker.go b/internal/worker.go index 43900f335..7a8386101 100644 --- a/internal/worker.go +++ b/internal/worker.go @@ -27,10 +27,11 @@ import ( "github.com/opentracing/opentracing-go" "github.com/uber-go/tally" + "go.uber.org/zap" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common/auth" - "go.uber.org/zap" ) type ( diff --git a/internal/workflow.go b/internal/workflow.go index 21da0042a..bbe26e6a9 100644 --- a/internal/workflow.go +++ b/internal/workflow.go @@ -29,10 +29,11 @@ import ( "time" "github.com/uber-go/tally" + "go.uber.org/zap" + s "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/internal/common/backoff" - "go.uber.org/zap" ) var ( diff --git a/internal/workflow_replayer.go b/internal/workflow_replayer.go index b5e8d014d..d802ea399 100644 --- a/internal/workflow_replayer.go +++ b/internal/workflow_replayer.go @@ -26,19 +26,21 @@ import ( "encoding/json" "errors" "fmt" + "io/ioutil" + "math" + "github.com/golang/mock/gomock" "github.com/opentracing/opentracing-go" "github.com/pborman/uuid" "github.com/uber-go/tally" + "go.uber.org/zap" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/internal/common/backoff" "go.uber.org/cadence/internal/common/serializer" - "go.uber.org/zap" - "io/ioutil" - "math" ) const ( diff --git a/internal/workflow_replayer_test.go b/internal/workflow_replayer_test.go index 3ab1dad62..90c7c52e6 100644 --- a/internal/workflow_replayer_test.go +++ b/internal/workflow_replayer_test.go @@ -29,9 +29,10 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.uber.org/zap" + "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" - "go.uber.org/zap" ) type workflowReplayerSuite struct { diff --git a/internal/workflow_shadower.go b/internal/workflow_shadower.go index 42e19c60c..d6fb281b3 100644 --- a/internal/workflow_shadower.go +++ b/internal/workflow_shadower.go @@ -31,11 +31,12 @@ import ( "time" "github.com/facebookgo/clock" + "go.uber.org/zap" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/.gen/go/shadower" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/internal/common/util" - "go.uber.org/zap" ) const ( diff --git a/internal/workflow_shadower_activities.go b/internal/workflow_shadower_activities.go index 0d294f4cd..b96eed461 100644 --- a/internal/workflow_shadower_activities.go +++ b/internal/workflow_shadower_activities.go @@ -26,13 +26,14 @@ import ( "strings" "time" + "go.uber.org/zap" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/.gen/go/shadower" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/internal/common/backoff" "go.uber.org/cadence/internal/common/metrics" - "go.uber.org/zap" ) type ( diff --git a/internal/workflow_shadower_activities_test.go b/internal/workflow_shadower_activities_test.go index bf22547c4..88d052abd 100644 --- a/internal/workflow_shadower_activities_test.go +++ b/internal/workflow_shadower_activities_test.go @@ -30,11 +30,12 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.uber.org/zap/zaptest" + "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" "go.uber.org/cadence/.gen/go/shadower" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" - "go.uber.org/zap/zaptest" ) type workflowShadowerActivitiesSuite struct { diff --git a/internal/workflow_shadower_test.go b/internal/workflow_shadower_test.go index b9150e084..865fd9a4b 100644 --- a/internal/workflow_shadower_test.go +++ b/internal/workflow_shadower_test.go @@ -29,6 +29,7 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" diff --git a/internal/workflow_shadower_worker.go b/internal/workflow_shadower_worker.go index a5722ddf9..5669dcfd9 100644 --- a/internal/workflow_shadower_worker.go +++ b/internal/workflow_shadower_worker.go @@ -25,12 +25,13 @@ import ( "github.com/opentracing/opentracing-go" "github.com/pborman/uuid" + "go.uber.org/zap" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/.gen/go/shadower" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/internal/common/backoff" - "go.uber.org/zap" ) type ( diff --git a/internal/workflow_shadower_worker_test.go b/internal/workflow_shadower_worker_test.go index 1dc9c9e22..29b38983c 100644 --- a/internal/workflow_shadower_worker_test.go +++ b/internal/workflow_shadower_worker_test.go @@ -27,13 +27,14 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.uber.org/yarpc" + "go.uber.org/zap/zaptest" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" "go.uber.org/cadence/.gen/go/shadower" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" - "go.uber.org/yarpc" - "go.uber.org/zap/zaptest" ) type shadowWorkerSuite struct { diff --git a/internal/workflow_testsuite.go b/internal/workflow_testsuite.go index ef0e1571b..19e5ae3ee 100644 --- a/internal/workflow_testsuite.go +++ b/internal/workflow_testsuite.go @@ -29,8 +29,9 @@ import ( "github.com/stretchr/testify/mock" "github.com/uber-go/tally" - "go.uber.org/cadence/.gen/go/shared" "go.uber.org/zap" + + "go.uber.org/cadence/.gen/go/shared" ) type ( diff --git a/mocks/Client.go b/mocks/Client.go index 4463dcac3..e62808aa9 100644 --- a/mocks/Client.go +++ b/mocks/Client.go @@ -25,6 +25,7 @@ import ( context "context" mock "github.com/stretchr/testify/mock" + internal "go.uber.org/cadence/internal" shared "go.uber.org/cadence/.gen/go/shared" diff --git a/mocks/DomainClient.go b/mocks/DomainClient.go index b993594fa..815544320 100644 --- a/mocks/DomainClient.go +++ b/mocks/DomainClient.go @@ -21,9 +21,13 @@ // Code generated by mockery v1.0.0 package mocks -import context "context" -import mock "github.com/stretchr/testify/mock" -import shared "go.uber.org/cadence/.gen/go/shared" +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + + shared "go.uber.org/cadence/.gen/go/shared" +) // DomainClient is an autogenerated mock type for the DomainClient type type DomainClient struct { diff --git a/mocks/HistoryEventIterator.go b/mocks/HistoryEventIterator.go index e9af182a9..77cf1ba77 100644 --- a/mocks/HistoryEventIterator.go +++ b/mocks/HistoryEventIterator.go @@ -21,8 +21,11 @@ // Code generated by mockery v1.0.0. DO NOT EDIT. package mocks -import mock "github.com/stretchr/testify/mock" -import shared "go.uber.org/cadence/.gen/go/shared" +import ( + mock "github.com/stretchr/testify/mock" + + shared "go.uber.org/cadence/.gen/go/shared" +) // HistoryEventIterator is an autogenerated mock type for the HistoryEventIterator type type HistoryEventIterator struct { diff --git a/mocks/WorkflowRun.go b/mocks/WorkflowRun.go index 8e7b1d038..ff55ba221 100644 --- a/mocks/WorkflowRun.go +++ b/mocks/WorkflowRun.go @@ -21,9 +21,11 @@ // Code generated by mockery v1.0.0. DO NOT EDIT. package mocks -import context "context" +import ( + context "context" -import mock "github.com/stretchr/testify/mock" + mock "github.com/stretchr/testify/mock" +) // WorkflowRun is an autogenerated mock type for the WorkflowRun type type WorkflowRun struct { diff --git a/mocks/mock_test.go b/mocks/mock_test.go index 8495c3587..aba5e8e06 100644 --- a/mocks/mock_test.go +++ b/mocks/mock_test.go @@ -22,11 +22,13 @@ package mocks import ( "context" - "go.uber.org/cadence/.gen/go/shared" "testing" + "go.uber.org/cadence/.gen/go/shared" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "go.uber.org/cadence/client" "go.uber.org/cadence/workflow" ) diff --git a/revive.toml b/revive.toml new file mode 100644 index 000000000..4dab338ff --- /dev/null +++ b/revive.toml @@ -0,0 +1,101 @@ +# config for https://github.com/mgechev/revive +ignoreGeneratedHeader = false +severity = "error" +confidence = 0.8 +errorCode = 1 +warningCode = 0 + +[directive.specify-disable-reason] + severity = "error" + +#### roughly what golint does. probably only disable noisy ones. + +[rule.blank-imports] +[rule.context-as-argument] +[rule.context-keys-type] +[rule.dot-imports] +[rule.error-naming] +[rule.error-return] +[rule.error-strings] +[rule.errorf] +# [rule.exported] # disabled due to lack of value / encouraging bad habits. it complains about internal packages. +[rule.if-return] +[rule.increment-decrement] +[rule.indent-error-flow] +# [rule.package-comments] # disabled due to lack of value / encouraging bad habits. it complains about internal packages. +[rule.range] +[rule.receiver-naming] +[rule.time-naming] +[rule.unexported-return] +[rule.var-declaration] +[rule.var-naming] # noisy, but would be good to fix these in v2 + +#### higher value stuff + +# this is basically errcheck, warns on errs that are not checked. +# strongly desired, but disabled due to 300 failures (to be tackled incrementally). +# [rule.unhandled-error] + +# general defer gotchas. +# +# in particular: "recover" warns about unsafe use of recover(). +# this has caught bugs that can allow crashes while seemingly safe, and are *extremely* hard to catch in review. +# +# the arguments are excluding only "call-chain", which would disallow `defer someFn(...)()` which is both useful and in use. +[rule.defer] +arguments=[["loop","method-call","recover","return", "immediate-recover"]] + +# string(int) is almost always a bug. +# go vet considers this a fatal error, but only in 1.15 or newer, and go.mod currently targets 1.13 +[rule.string-of-int] + +#### added because we currently have zero violations, and they seem decent enough to retain + +[rule.atomic] # correct use of sync code, important +[rule.call-to-gc] # beneficial +[rule.constant-logical-expr] # minor code simplifier +[rule.identical-branches] # code simplifier / failures are pretty dubious +[rule.modifies-parameter] # beneficial +[rule.modifies-value-receiver] # probably beneficial, prevents subtle bugs +[rule.range-val-address] # beneficial +[rule.range-val-in-closure] # beneficial +[rule.unconditional-recursion] # probably a good idea +[rule.unreachable-code] # code simplifier +[rule.waitgroup-by-value] # correct use of sync code, important + +#### unused utilities + +# [rule.file-header] # could possibly replace `copyright -verifyOnly`? +# [rule.imports-blacklist] # simple way to ban imports / enforce wrappers, likely useful + +#### disabled but maybe desirable + +# [rule.bare-return] # probably beneficial as it's slightly error-prone, but 2,000 failures +# [rule.bool-literal-in-expr] # minor code simplifier, few failures +# [rule.confusing-results] # maybe beneficial, only a few failures +# [rule.deep-exit] # probably a good idea in most code, some failures, but not trivial to adopt +# [rule.duplicated-imports] # minor, but may be worthwhile. failures are weird but harmless +# [rule.early-return] # minor code simplifier, a handful of failures +# [rule.get-return] # existing failures are intentional + desirable, but in principle it's a fine idea +# [rule.import-shadowing] # probably beneficial, but 750 failures +# [rule.redefines-builtin-id] # probably beneficial, few failures +# [rule.struct-tag] # probably beneficial, a few failures +# [rule.superfluous-else] # minor code simplifier, a few failures +# [rule.unexported-naming] # probably beneficial, but 300 failures +# [rule.unused-parameter] # minor code simplifier / clarifier, but 250 failures +# [rule.unused-receiver] # minor code simplifier / clarifier, but 500 failures + +#### probably undesirable + +# [rule.add-constant] # extremely noisy. 18,000 failures, overwhelmingly for tests or 0/1 which seem totally fine +# [rule.argument-limit] # too arbitrary +# [rule.cognitive-complexity] # dubious value, but possibly interesting +# [rule.confusing-naming] # dubious value, ~50 failures +# [rule.cyclomatic] # dubious value, but possibly interesting +# [rule.empty-block] # easily noticed in code review, but also warns on documented no-op branches, which seem fine +# [rule.empty-lines] # low value, many failures +# [rule.flag-parameter] # interesting, but very noisy +# [rule.function-result-limit] # too arbitrary, easily noticed in code review +# [rule.line-length-limit] # too arbitrary +# [rule.max-public-structs] # too arbitrary +# [rule.unnecessary-stmt] # dubious value diff --git a/test/integration_test.go b/test/integration_test.go index 0c3aa8c48..d19bed948 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -24,25 +24,28 @@ package test import ( "context" "fmt" - "github.com/uber-go/tally" - "go.uber.org/cadence/internal" "net" "strings" "sync" "testing" "time" + "github.com/uber-go/tally" + + "go.uber.org/cadence/internal" + "github.com/pborman/uuid" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "go.uber.org/goleak" + "go.uber.org/zap/zaptest" + "go.uber.org/cadence" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/client" "go.uber.org/cadence/interceptors" "go.uber.org/cadence/worker" "go.uber.org/cadence/workflow" - "go.uber.org/goleak" - "go.uber.org/zap/zaptest" ) type IntegrationTestSuite struct { diff --git a/test/replaytests/replay_test.go b/test/replaytests/replay_test.go index 8258660ad..b239465d7 100644 --- a/test/replaytests/replay_test.go +++ b/test/replaytests/replay_test.go @@ -25,10 +25,11 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" + "go.uber.org/cadence/activity" "go.uber.org/cadence/worker" "go.uber.org/cadence/workflow" - "go.uber.org/zap/zaptest" ) func TestReplayWorkflowHistoryFromFile(t *testing.T) { diff --git a/test/replaytests/signatureBugWorkflow.go b/test/replaytests/signatureBugWorkflow.go index c4a2ebb44..657db5061 100644 --- a/test/replaytests/signatureBugWorkflow.go +++ b/test/replaytests/signatureBugWorkflow.go @@ -1,10 +1,32 @@ +// Copyright (c) 2017-2021 Uber Technologies Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + package replaytests import ( "fmt" - "go.uber.org/cadence/workflow" - "go.uber.org/zap" "time" + + "go.uber.org/zap" + + "go.uber.org/cadence/workflow" ) // greetingWorkflow demonstrates the normal case where we are executing multiple acitivities and expect a certain result. diff --git a/test/replaytests/workflows.go b/test/replaytests/workflows.go index 1e62765e8..a440751f7 100644 --- a/test/replaytests/workflows.go +++ b/test/replaytests/workflows.go @@ -25,10 +25,11 @@ import ( "errors" "time" + "go.uber.org/zap" + "go.uber.org/cadence/activity" "go.uber.org/cadence/client" "go.uber.org/cadence/workflow" - "go.uber.org/zap" ) // Workflow workflow decider diff --git a/test/test_utils.go b/test/test_utils.go index 7a2af15f1..4d6e4311c 100644 --- a/test/test_utils.go +++ b/test/test_utils.go @@ -31,10 +31,11 @@ import ( "go.uber.org/yarpc/transport/grpc" "go.uber.org/yarpc/transport/tchannel" - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/compatibility" "go.uber.org/cadence/workflow" + + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) type ( diff --git a/worker/worker.go b/worker/worker.go index 9598c8b46..6332a2605 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -25,13 +25,14 @@ package worker import ( "context" + "go.uber.org/zap" + "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/activity" "go.uber.org/cadence/internal" "go.uber.org/cadence/internal/common/auth" "go.uber.org/cadence/workflow" - "go.uber.org/zap" ) type ( diff --git a/workflow/workflow.go b/workflow/workflow.go index e837386b5..fe27cdbbb 100644 --- a/workflow/workflow.go +++ b/workflow/workflow.go @@ -22,9 +22,10 @@ package workflow import ( "github.com/uber-go/tally" + "go.uber.org/zap" + "go.uber.org/cadence/encoded" "go.uber.org/cadence/internal" - "go.uber.org/zap" ) type ( From 81ed30cc0e9c4c54b0ceded18f68cbf688970191 Mon Sep 17 00:00:00 2001 From: Steven L Date: Mon, 20 Mar 2023 12:20:37 -0500 Subject: [PATCH 2/6] Reformat after merge --- test/replaytests/activity_check.go | 6 ++++-- test/replaytests/signature_bug.go | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/test/replaytests/activity_check.go b/test/replaytests/activity_check.go index 47a65654d..97ebd9d14 100644 --- a/test/replaytests/activity_check.go +++ b/test/replaytests/activity_check.go @@ -21,9 +21,11 @@ package replaytests import ( - "go.uber.org/cadence/workflow" - "go.uber.org/zap" "time" + + "go.uber.org/zap" + + "go.uber.org/cadence/workflow" ) // greetingsWorkflowActivity demonstrates the case in replayer where if an activity name is changed in a workflow or if a new activity is introdced in a workflow then the shdower fails. diff --git a/test/replaytests/signature_bug.go b/test/replaytests/signature_bug.go index 19eeff0be..42f69a919 100644 --- a/test/replaytests/signature_bug.go +++ b/test/replaytests/signature_bug.go @@ -22,9 +22,11 @@ package replaytests import ( "fmt" - "go.uber.org/cadence/workflow" - "go.uber.org/zap" "time" + + "go.uber.org/zap" + + "go.uber.org/cadence/workflow" ) // greetingWorkflow demonstrates the normal case where we are executing multiple acitivities and expect a certain result. From 54cedf4115d5e769754a1ebf12a6e1f8ba3a29e7 Mon Sep 17 00:00:00 2001 From: Steven L Date: Mon, 20 Mar 2023 12:55:14 -0500 Subject: [PATCH 3/6] Manually compact some import-groups so goimports will maintain them more nicely Somewhat surprisingly, goimports does not have a way to forcefully merge groups into its 3-tier structure. Personally I'd like to do that for consistency, allowing separate groups only if documented. But meh. They're kinda unlikely to degrade, and it doesn't really matter if they do. --- internal/common/auth/service_wrapper_test.go | 9 +++------ internal/compatibility/enum_test.go | 3 +-- internal/compatibility/proto/error.go | 3 +-- internal/compatibility/thrift/error.go | 3 +-- internal/internal_workflow_client_test.go | 11 ++++------- test/integration_test.go | 6 ++---- 6 files changed, 12 insertions(+), 23 deletions(-) diff --git a/internal/common/auth/service_wrapper_test.go b/internal/common/auth/service_wrapper_test.go index e266ade88..2db357ab0 100644 --- a/internal/common/auth/service_wrapper_test.go +++ b/internal/common/auth/service_wrapper_test.go @@ -25,15 +25,12 @@ import ( "testing" "time" - "github.com/uber/tchannel-go/thrift" - - "go.uber.org/cadence/.gen/go/shared" - "github.com/golang/mock/gomock" + "github.com/stretchr/testify/suite" + "github.com/uber/tchannel-go/thrift" "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" - - "github.com/stretchr/testify/suite" + "go.uber.org/cadence/.gen/go/shared" ) type ( diff --git a/internal/compatibility/enum_test.go b/internal/compatibility/enum_test.go index 366f23133..b9a55e53c 100644 --- a/internal/compatibility/enum_test.go +++ b/internal/compatibility/enum_test.go @@ -24,12 +24,11 @@ import ( "testing" "github.com/stretchr/testify/assert" + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/compatibility/proto" "go.uber.org/cadence/internal/compatibility/thrift" - - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) const UnknownValue = 9999 diff --git a/internal/compatibility/proto/error.go b/internal/compatibility/proto/error.go index 8f0d3273b..fd40f4396 100644 --- a/internal/compatibility/proto/error.go +++ b/internal/compatibility/proto/error.go @@ -21,12 +21,11 @@ package proto import ( + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/yarpc/encoding/protobuf" "go.uber.org/yarpc/yarpcerrors" "go.uber.org/cadence/.gen/go/shared" - - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func Error(err error) error { diff --git a/internal/compatibility/thrift/error.go b/internal/compatibility/thrift/error.go index 9b21d9166..334613760 100644 --- a/internal/compatibility/thrift/error.go +++ b/internal/compatibility/thrift/error.go @@ -23,13 +23,12 @@ package thrift import ( "errors" + apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" "go.uber.org/yarpc/encoding/protobuf" "go.uber.org/yarpc/yarpcerrors" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" - - apiv1 "github.com/uber/cadence-idl/go/proto/api/v1" ) func Error(err error) error { diff --git a/internal/internal_workflow_client_test.go b/internal/internal_workflow_client_test.go index 166509054..96642e40e 100644 --- a/internal/internal_workflow_client_test.go +++ b/internal/internal_workflow_client_test.go @@ -29,19 +29,16 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/pborman/uuid" + "github.com/stretchr/testify/suite" "go.uber.org/yarpc" - "go.uber.org/cadence/internal/common/serializer" - "go.uber.org/cadence/.gen/go/cadence/workflowservicetest" "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/internal/common" - - "github.com/golang/mock/gomock" - "github.com/pborman/uuid" - "github.com/stretchr/testify/suite" - "go.uber.org/cadence/internal/common/metrics" + "go.uber.org/cadence/internal/common/serializer" ) const ( diff --git a/test/integration_test.go b/test/integration_test.go index d19bed948..ccfad8957 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -30,13 +30,10 @@ import ( "testing" "time" - "github.com/uber-go/tally" - - "go.uber.org/cadence/internal" - "github.com/pborman/uuid" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "github.com/uber-go/tally" "go.uber.org/goleak" "go.uber.org/zap/zaptest" @@ -44,6 +41,7 @@ import ( "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/client" "go.uber.org/cadence/interceptors" + "go.uber.org/cadence/internal" "go.uber.org/cadence/worker" "go.uber.org/cadence/workflow" ) From 6d3dcb67640a979eeabc5edede019f7fd82b6753 Mon Sep 17 00:00:00 2001 From: Steven L Date: Mon, 20 Mar 2023 14:20:52 -0500 Subject: [PATCH 4/6] document similarity to server --- revive.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/revive.toml b/revive.toml index 4dab338ff..ca2a217d4 100644 --- a/revive.toml +++ b/revive.toml @@ -1,4 +1,7 @@ # config for https://github.com/mgechev/revive +# +# largely the same reasoning as https://github.com/uber/cadence , but not intended to be identical. +# libraries have different needs / goals than applications, so some drift is desirable. ignoreGeneratedHeader = false severity = "error" confidence = 0.8 From 1539d8c3299297d082c3ca80b828e3df24fbb9a7 Mon Sep 17 00:00:00 2001 From: Steven L Date: Tue, 28 Mar 2023 20:50:20 -0500 Subject: [PATCH 5/6] format new files --- test/replaytests/branch_workflow.go | 3 ++- test/replaytests/parallel_workflow.go | 3 ++- test/replaytests/replay_test.go | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/replaytests/branch_workflow.go b/test/replaytests/branch_workflow.go index 8a55ec17c..380660fa7 100644 --- a/test/replaytests/branch_workflow.go +++ b/test/replaytests/branch_workflow.go @@ -22,8 +22,9 @@ package replaytests import ( "fmt" - "go.uber.org/cadence/workflow" "time" + + "go.uber.org/cadence/workflow" ) /** diff --git a/test/replaytests/parallel_workflow.go b/test/replaytests/parallel_workflow.go index 2f3573bfe..e3d7263c9 100644 --- a/test/replaytests/parallel_workflow.go +++ b/test/replaytests/parallel_workflow.go @@ -25,8 +25,9 @@ import ( "fmt" "time" - "go.uber.org/cadence/workflow" "go.uber.org/zap" + + "go.uber.org/cadence/workflow" ) /** diff --git a/test/replaytests/replay_test.go b/test/replaytests/replay_test.go index 194155433..057526f63 100644 --- a/test/replaytests/replay_test.go +++ b/test/replaytests/replay_test.go @@ -21,10 +21,11 @@ package replaytests import ( - "github.com/stretchr/testify/assert" "strings" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" From 5b1673eae671c3116297605922f7fcfc466f8c48 Mon Sep 17 00:00:00 2001 From: Steven L Date: Tue, 28 Mar 2023 21:21:17 -0500 Subject: [PATCH 6/6] tidy --- internal/tools/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 0adb09c1b..d887806e0 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -3,8 +3,8 @@ module go.uber.org/cadence/internal/tools go 1.19 require ( - github.com/mattn/goveralls v0.0.11 github.com/kisielk/errcheck v1.6.3 + github.com/mattn/goveralls v0.0.11 github.com/mgechev/revive v1.2.5 go.uber.org/thriftrw v1.25.0 go.uber.org/yarpc v1.55.0