chore: modernize

This commit is contained in:
andig 2026-05-01 17:58:00 +02:00
parent 618314be27
commit 2132d9be98
7 changed files with 16 additions and 16 deletions

View file

@ -36,7 +36,7 @@ func init() {
}
// NewBlueprintFromConfig creates a blueprint charger from generic config
func NewBlueprintFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewBlueprintFromConfig(other map[string]any) (api.Charger, error) {
var cc struct {
URI string
Cache time.Duration

View file

@ -40,7 +40,7 @@ func init() {
}
// NewNRGKickBLEFromConfig creates a NRGKickBLE charger from generic config
func NewNRGKickBLEFromConfig(other map[string]interface{}) (api.Charger, error) {
func NewNRGKickBLEFromConfig(other map[string]any) (api.Charger, error) {
cc := struct{ Device, Mac, PIN string }{
Device: "hci0",
}
@ -115,7 +115,7 @@ func (wb *NRGKickBLE) close() {
}
}
func (wb *NRGKickBLE) read(service string, res interface{}) error {
func (wb *NRGKickBLE) read(service string, res any) error {
wb.mu.Lock()
defer wb.mu.Unlock()
@ -135,7 +135,7 @@ func (wb *NRGKickBLE) read(service string, res interface{}) error {
return err
}
b, err := char.ReadValue(map[string]interface{}{})
b, err := char.ReadValue(map[string]any{})
if err != nil {
wb.close()
return err
@ -145,7 +145,7 @@ func (wb *NRGKickBLE) read(service string, res interface{}) error {
return struc.Unpack(bytes.NewReader(b), res)
}
func (wb *NRGKickBLE) write(service string, val interface{}) error {
func (wb *NRGKickBLE) write(service string, val any) error {
wb.mu.Lock()
defer wb.mu.Unlock()
@ -171,7 +171,7 @@ func (wb *NRGKickBLE) write(service string, val interface{}) error {
return err
}
if err := char.WriteValue(out.Bytes(), map[string]interface{}{}); err != nil {
if err := char.WriteValue(out.Bytes(), map[string]any{}); err != nil {
wb.close()
return err
}

View file

@ -262,7 +262,7 @@ func init() {
// ID: taskTPLink,
// Type: tasks.Http,
// Depends: TaskHttp,
// Config: map[string]interface{}{
// Config: map[string]any{
// "ResponseHeader": map[string]string{
// "Server": "TP-LINK Smart Plug",
// },

View file

@ -15,7 +15,7 @@ func (r TaskHandlerRegistry) Add(name TaskType, factory func(map[string]any) (Ta
r[name] = factory
}
// func (r TaskHandlerRegistry) Get(name string) (func(map[string]interface{}) (TaskHandler, error), error) {
// func (r TaskHandlerRegistry) Get(name string) (func(map[string]any) (TaskHandler, error), error) {
// factory, exists := r[name]
// if !exists {
// return nil, fmt.Errorf("charger type not registered: %s", name)

View file

@ -19,7 +19,7 @@ func init() {
}
// NewBlueprintFromConfig creates a blueprint meter from generic config
func NewBlueprintFromConfig(other map[string]interface{}) (api.Meter, error) {
func NewBlueprintFromConfig(other map[string]any) (api.Meter, error) {
var cc struct {
URI string
Cache time.Duration

View file

@ -50,7 +50,7 @@ func init() {
// count: 2 # number of registers to read (1=U16, 2=S32/U32)
// decode: int32be # int32be | uint32be | int16be | uint16be | float32be
// scale: 1.0 # optional multiplier (default 1.0)
func NewAA55UDPFromConfig(_ context.Context, other map[string]interface{}) (Plugin, error) {
func NewAA55UDPFromConfig(_ context.Context, other map[string]any) (Plugin, error) {
cc := struct {
Host string `mapstructure:"host"`
Id int `mapstructure:"id"`

View file

@ -56,7 +56,7 @@ func init() {
// _fmt_Formatter is an interface wrapper for Formatter type
type _fmt_Formatter struct {
IValue interface{}
IValue any
WFormat func(f fmt.State, verb rune)
}
@ -66,7 +66,7 @@ func (W _fmt_Formatter) Format(f fmt.State, verb rune) {
// _fmt_GoStringer is an interface wrapper for GoStringer type
type _fmt_GoStringer struct {
IValue interface{}
IValue any
WGoString func() string
}
@ -76,7 +76,7 @@ func (W _fmt_GoStringer) GoString() string {
// _fmt_ScanState is an interface wrapper for ScanState type
type _fmt_ScanState struct {
IValue interface{}
IValue any
WRead func(buf []byte) (n int, err error)
WReadRune func() (r rune, size int, err error)
WSkipSpace func()
@ -106,7 +106,7 @@ func (W _fmt_ScanState) Width() (wid int, ok bool) {
// _fmt_Scanner is an interface wrapper for Scanner type
type _fmt_Scanner struct {
IValue interface{}
IValue any
WScan func(state fmt.ScanState, verb rune) error
}
@ -116,7 +116,7 @@ func (W _fmt_Scanner) Scan(state fmt.ScanState, verb rune) error {
// _fmt_State is an interface wrapper for State type
type _fmt_State struct {
IValue interface{}
IValue any
WFlag func(c int) bool
WPrecision func() (prec int, ok bool)
WWidth func() (wid int, ok bool)
@ -138,7 +138,7 @@ func (W _fmt_State) Write(b []byte) (n int, err error) {
// _fmt_Stringer is an interface wrapper for Stringer type
type _fmt_Stringer struct {
IValue interface{}
IValue any
WString func() string
}