Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.48.0" # update together with Dockerfile.dev
Expand All @@ -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
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -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.48.0 AS linter
Expand Down
6 changes: 3 additions & 3 deletions async.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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".
Expand Down
8 changes: 4 additions & 4 deletions async_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/maratori/async

go 1.18
go 1.19

require (
github.com/pkg/errors v0.9.1
Expand Down