Code refactoring (change interface to any)
This commit is contained in:
@@ -24,7 +24,7 @@ func NewStream(source interface{}) *Stream {
|
||||
prod := &Producer{url: source}
|
||||
s.producers = append(s.producers, prod)
|
||||
return s
|
||||
case []interface{}:
|
||||
case []any:
|
||||
s := new(Stream)
|
||||
for _, source := range source {
|
||||
prod := &Producer{url: source.(string)}
|
||||
@@ -33,7 +33,7 @@ func NewStream(source interface{}) *Stream {
|
||||
return s
|
||||
case *Stream:
|
||||
return source
|
||||
case map[string]interface{}:
|
||||
case map[string]any:
|
||||
return NewStream(source["url"])
|
||||
case nil:
|
||||
return new(Stream)
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
func Init() {
|
||||
var cfg struct {
|
||||
Mod map[string]interface{} `yaml:"streams"`
|
||||
Mod map[string]any `yaml:"streams"`
|
||||
}
|
||||
|
||||
app.LoadConfig(&cfg)
|
||||
@@ -33,7 +33,7 @@ func Get(name string) *Stream {
|
||||
return streams[name]
|
||||
}
|
||||
|
||||
func New(name string, source interface{}) *Stream {
|
||||
func New(name string, source any) *Stream {
|
||||
stream := NewStream(source)
|
||||
streams[name] = stream
|
||||
return stream
|
||||
|
||||
Reference in New Issue
Block a user