Skip to content

Commit

Permalink
workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Nov 13, 2022
1 parent eb08ccd commit b8590c7
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
push:

name: Tests
jobs:
golangci:
name: Linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.49.0
args: --timeout=2m --go=1.19
security:
name: Security Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: 'go'
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

14 changes: 14 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
linters:
enable:
- goconst
- gocritic
- gofmt
- govet
- prealloc
- unconvert
- unused
- errcheck
- ineffassign
- containedctx
- tenv

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func dispatcher(ctx context.Context) ([]string, error) {
}
```

`NewTimedPool` receives as arguments 3 handlers: `Dispatcher`, `Worker` and `ErrorHandler`. It's declared like this:
`NewTimedPool` receives as arguments 3 handlers: `Dispatcher`, `Worker` and `ErrorHandler`.

```go
// Worker - worker handler. Calls on task arriving.
Expand All @@ -117,4 +117,6 @@ type Dispatcher[Task any] func(ctx context.Context) ([]Task, error)

// ErrorHandler - the function is called when error occured in dispatcher
type ErrorHandler[Task any] func(ctx context.Context, err error)
```
```

Also it receives 2 integers: workers count and time between dispatcher calls in milliseconds.

0 comments on commit b8590c7

Please sign in to comment.