Skip to content

Commit

Permalink
Merge pull request #1 from dc0d/go18lab
Browse files Browse the repository at this point in the history
change to go 1.18
  • Loading branch information
dc0d authored Apr 8, 2022
2 parents 48fb0a1 + cb4fb58 commit 136efa9
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 498 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
continue-on-error: false
continue-on-error: true
timeout-minutes: 5

steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '^1.15'
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '^1.18'

- name: Checkout Code
uses: actions/checkout@v2
- name: Checkout Code
uses: actions/checkout@v2

- name: Lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.40.1
- name: Lint
uses: golangci/golangci-lint-action@v2
with:
version: latest

test:
runs-on: ubuntu-latest
Expand All @@ -29,13 +29,13 @@ jobs:
needs: lint

steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '^1.15'
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '^1.18'

- name: Checkout Code
uses: actions/checkout@v2
- name: Checkout Code
uses: actions/checkout@v2

- name: Test
run: go test -count=1 -timeout 60s ./...
- name: Test
run: go test -count=1 -timeout 60s ./...
116 changes: 0 additions & 116 deletions actor.go

This file was deleted.

14 changes: 6 additions & 8 deletions actor/actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"time"
)

func Start(ctx context.Context, mailbox Mailbox, callbacks Callbacks, options ...Option) {
func Start[T any](ctx context.Context, mailbox Mailbox[T], callbacks Callbacks[T], options ...Option) {
opts := applyOptions(options...)
start(ctx, mailbox, callbacks, opts)
}

func start(ctx context.Context, mailbox Mailbox, callbacks Callbacks, opts actorOptions) {
func start[T any](ctx context.Context, mailbox Mailbox[T], callbacks Callbacks[T], opts actorOptions) {
go func() {
if started != nil {
started(mailbox)
Expand Down Expand Up @@ -69,12 +69,12 @@ func start(ctx context.Context, mailbox Mailbox, callbacks Callbacks, opts actor
}

type (
Callbacks interface {
Callbacks[T any] interface {
Received(T)
Stopped()
}

Mailbox <-chan T
Mailbox[T any] <-chan T

Option func(actorOptions) actorOptions

Expand All @@ -86,8 +86,6 @@ type (

RequestCount int
MailboxSize int

T = interface{}
)

func WithAbsoluteTimeout(timeout time.Duration) Option {
Expand All @@ -111,6 +109,6 @@ func applyOptions(opts ...Option) actorOptions {
}

var (
started func(pool Mailbox)
stopped func(pool Mailbox)
started func(pool interface{})
stopped func(pool interface{})
)
Loading

0 comments on commit 136efa9

Please sign in to comment.