up: add tests on go1.18 and remove test on go < 1.15

This commit is contained in:
Inhere
2022-04-14 21:35:49 +08:00
parent fe2a1a0dfb
commit 09244d353d
5 changed files with 8 additions and 8 deletions

View File

@@ -12,7 +12,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go_version: [1.13, 1.14, 1.15, 1.16, 1.17]
go_version: [1.15, 1.16, 1.17, 1.18]
os: [ubuntu-latest, macOS-latest]
steps:

View File

@@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: true
matrix:
go: [1.16]
go: [1.17]
steps:
- name: Checkout

View File

@@ -5,7 +5,6 @@ package event
// Event interface
type Event interface {
Name() string
// Target() interface{}
Get(key string) interface{}
Set(key string, val interface{})
Add(key string, val interface{})
@@ -27,7 +26,7 @@ type BasicEvent struct {
aborted bool
}
// NewBasic new an basic event instance
// NewBasic new a basic event instance
func NewBasic(name string, data M) *BasicEvent {
if data == nil {
data = make(map[string]interface{})
@@ -39,7 +38,7 @@ func NewBasic(name string, data M) *BasicEvent {
}
}
// Abort abort event loop exec
// Abort event loop exec
func (e *BasicEvent) Abort(abort bool) {
e.aborted = abort
}
@@ -59,7 +58,7 @@ func (e *BasicEvent) AttachTo(em ManagerFace) {
em.AddEvent(e)
}
// Get get data by index
// Get data by index
func (e *BasicEvent) Get(key string) interface{} {
if v, ok := e.data[key]; ok {
return v

2
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/gookit/event
go 1.13
go 1.15
require (
github.com/davecgh/go-spew v1.1.1 // indirect

View File

@@ -21,7 +21,7 @@ type ManagerFace interface {
AddEvent(Event)
// On listeners: add listeners
On(name string, listener Listener, priority ...int)
// Fire fire event
// Fire event
Fire(name string, params M) (error, Event)
}
@@ -72,6 +72,7 @@ func (em *Manager) Listen(name string, listener Listener, priority ...int) {
}
// On register a event handler/listener. can setting priority.
//
// Usage:
// On("evt0", listener)
// On("evt0", listener, High)