Fix dumping ActionConfig structure (#2029)
This commit is contained in:
parent
8323f2f100
commit
05e3eed893
2 changed files with 6 additions and 2 deletions
|
|
@ -60,8 +60,9 @@ type ActionConfig struct {
|
|||
func (a ActionConfig) String() string {
|
||||
var s []string
|
||||
for k, v := range structs.Map(a) {
|
||||
if v != nil && !reflect.ValueOf(v).IsNil() {
|
||||
s = append(s, fmt.Sprintf("%s:%v", k, v))
|
||||
val := reflect.ValueOf(v)
|
||||
if v != nil && !val.IsNil() {
|
||||
s = append(s, fmt.Sprintf("%s:%v", k, val.Elem()))
|
||||
}
|
||||
}
|
||||
return strings.Join(s, ", ")
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/evcc-io/evcc/api"
|
||||
"github.com/fatih/structs"
|
||||
)
|
||||
|
||||
var truefalse = map[bool]string{false: "false", true: "true"}
|
||||
|
|
@ -174,6 +175,8 @@ func (d *dumper) Dump(name string, v interface{}) {
|
|||
fmt.Fprintf(w, "Capacity:\t%dkWh\n", v.Capacity())
|
||||
if len(v.Identifiers()) > 0 {
|
||||
fmt.Fprintf(w, "Identifiers:\t%v\n", v.Identifiers())
|
||||
}
|
||||
if !structs.IsZero(v.OnIdentified()) {
|
||||
fmt.Fprintf(w, "OnIdentified:\t%s\n", v.OnIdentified())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue