You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2021/04/14 13:20:51 UTC

[plc4x] 01/14: plc4go: use fmt.Stringer on asciiBox.go when available

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 04a451f836fc7dc89d89c5c792cd7c720d9a6867
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Apr 13 22:51:27 2021 +0200

    plc4go: use fmt.Stringer on asciiBox.go when available
---
 plc4go/internal/plc4go/spi/utils/asciiBox.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/plc4go/internal/plc4go/spi/utils/asciiBox.go b/plc4go/internal/plc4go/spi/utils/asciiBox.go
index b35feac..914adb2 100644
--- a/plc4go/internal/plc4go/spi/utils/asciiBox.go
+++ b/plc4go/internal/plc4go/spi/utils/asciiBox.go
@@ -62,6 +62,8 @@ func BoxAnything(name string, anything interface{}, charWidth int) AsciiBox {
 		return AsciiBox(DumpFixedWidth(anything.([]byte), charWidth))
 	case string:
 		return BoxString(name, anything.(string), charWidth)
+	case fmt.Stringer:
+		return BoxString(name, anything.(fmt.Stringer).String(), 0)
 	default:
 		valueOf := reflect.ValueOf(anything)
 		switch valueOf.Kind() {