-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #193 from foomo/service-goroutine
Add goroutine service
- Loading branch information
Showing
83 changed files
with
1,641 additions
and
457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
.* | ||
*.log | ||
*.out | ||
!.github/ | ||
!.husky/ | ||
!.editorconfig | ||
!.gitignore | ||
!.golangci.yml | ||
!.goreleaser.yml | ||
!.husky.yaml | ||
/coverage.out | ||
/coverage.html | ||
/tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,7 @@ hooks: | |
lint-staged: | ||
'*.go': | ||
- goimports -l -w | ||
- gofmt -l -w | ||
|
||
lint-commit: | ||
email: '^([email protected])$' | ||
types: '^(feat|fix|build|chore|docs|perf|refactor|revert|style|test|wip)$' | ||
header: '^(?P<type>\w+)(\((?P<scope>[\w/.-]+)\))?(?P<breaking>!)?:( +)?(?P<header>.+)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,29 @@ | ||
package keel | ||
|
||
import "context" | ||
|
||
type closer struct { | ||
handle func(context.Context) error | ||
} | ||
|
||
func NewCloserFn(handle func(context.Context) error) closer { | ||
return closer{ | ||
handle: handle, | ||
import ( | ||
"github.com/foomo/keel/interfaces" | ||
) | ||
|
||
func IsCloser(v any) bool { | ||
switch v.(type) { | ||
case interfaces.Closer, | ||
interfaces.ErrorCloser, | ||
interfaces.CloserWithContext, | ||
interfaces.ErrorCloserWithContext, | ||
interfaces.Shutdowner, | ||
interfaces.ErrorShutdowner, | ||
interfaces.ShutdownerWithContext, | ||
interfaces.ErrorShutdownerWithContext, | ||
interfaces.Stopper, | ||
interfaces.ErrorStopper, | ||
interfaces.StopperWithContext, | ||
interfaces.ErrorStopperWithContext, | ||
interfaces.Unsubscriber, | ||
interfaces.ErrorUnsubscriber, | ||
interfaces.UnsubscriberWithContext, | ||
interfaces.ErrorUnsubscriberWithContext: | ||
return true | ||
default: | ||
return false | ||
} | ||
} | ||
|
||
func (h healther) Close(ctx context.Context) error { | ||
return h.handle(ctx) | ||
} | ||
|
||
// Closer interface | ||
type Closer interface { | ||
Close() | ||
} | ||
|
||
// ErrorCloser interface | ||
type ErrorCloser interface { | ||
Close() error | ||
} | ||
|
||
// CloserWithContext interface | ||
type CloserWithContext interface { | ||
Close(ctx context.Context) | ||
} | ||
|
||
// ErrorCloserWithContext interface | ||
type ErrorCloserWithContext interface { | ||
Close(ctx context.Context) error | ||
} |
Oops, something went wrong.