From 0725bdbbe0c08c67a08346dfdd923b773bc05271 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Aug 2022 11:45:47 +0000 Subject: [PATCH 1/4] Bump golang from 1.18.5 to 1.19.0 Bumps golang from 1.18.5 to 1.19.0. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Dockerfile.dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index 887e26e..318416c 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM golang:1.18.5 AS go +FROM golang:1.19.0 AS go # update together with .github/workflows/ci.yml FROM golangci/golangci-lint:v1.47.3 AS linter From 660ae30a57238508fc8b269a95324769c56c76c3 Mon Sep 17 00:00:00 2001 From: Marat Reymers Date: Wed, 3 Aug 2022 15:27:04 +0300 Subject: [PATCH 2/4] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index a296acd..70cf496 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/maratori/async -go 1.18 +go 1.19 require ( github.com/pkg/errors v0.9.1 From 20d0e40991d27eca02f21cdab590863dc7745f68 Mon Sep 17 00:00:00 2001 From: Marat Reymers Date: Wed, 3 Aug 2022 15:29:26 +0300 Subject: [PATCH 3/4] Update ci --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 559c9b1..20f7f83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: "1.x" + go-version: "1.19.0" - name: Debug with tmate SSH if enabled if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_ssh }} uses: mxschmitt/action-tmate@v3 @@ -38,7 +38,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: "1.x" + go-version: "1.19.0" - uses: golangci/golangci-lint-action@v3 with: version: "v1.47.2" # update together with Dockerfile.dev @@ -50,5 +50,5 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: "1.x" + go-version: "1.19.0" - run: make check-tidy From 20b36ccad1852d473f36074e30c4d217f8a0a2c3 Mon Sep 17 00:00:00 2001 From: Marat Reymers Date: Sun, 7 Aug 2022 13:55:43 +0300 Subject: [PATCH 4/4] Update commets --- async.go | 6 +++--- async_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/async.go b/async.go index 4d985c1..6e7ac82 100644 --- a/async.go +++ b/async.go @@ -36,10 +36,10 @@ func NewExecutor() *Executor { } // Register returns a handler to call a method on the receiver. -// The handler should be registered in jobs processor. +// The handler should be registered in a jobs processor. // // Method is a func that takes receiver as the first input parameter. -// The next input parameter may optionally be context.Context. +// The next input parameter may optionally be [context.Context]. // It optionally may return an error (or a type implementing error interface). // // Receiver should have the same type as the first parameter of the method. @@ -115,7 +115,7 @@ func (e *Executor) Register( //nolint:gocognit // TODO: simplify // Prepare returns jobName and marshaled args to be enqueued. // -// Arguments are serialized to be saved inside jobs storage. +// Arguments are serialized to be saved inside a jobs storage. // It is a bad practice to use domain types as a transport ones directly. // So library limits allowed types as much as possible. // However, it still may be error-prone, see test "using iota is dangerous". diff --git a/async_test.go b/async_test.go index 25952af..95203aa 100644 --- a/async_test.go +++ b/async_test.go @@ -24,10 +24,10 @@ func TestExecutor(t *testing.T) { executor := async.NewExecutor() _, err := executor.Register("job", domainService, DomainService.Struct__MyEnum__Nothing) require.NoError(t, err) - // Under the hood MyEnumB is converted to `2` and is stored for the future execution. - // If someone adds/removes enum const before MyEnumB, it changes numbering (actual values of enums). - // It means that once job enqueued with argument `2` (meaning MyEnumB) will be executed with argument 2. - // But now it means not MyEnumB, but some different enum const. + // Under the hood [MyEnumB] is converted to `2` and is stored for the future execution. + // If someone adds/removes enum const before [MyEnumB], it changes numbering (actual values of enums). + // It means that once job enqueued with argument `2` (meaning [MyEnumB]) will be executed with argument 2. + // But now it means not [MyEnumB], but some different enum const. _, args, err := executor.Prepare(DomainService.Struct__MyEnum__Nothing, MyEnumB) require.NoError(t, err) assert.JSONEq(t, `{"arg0":2,"type0":"int"}`, string(args))