You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2020/10/09 15:47:39 UTC
[plc4x] branch feature/plc4go updated: - Fixed the Go typeSwitch
issue
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/plc4go
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/feature/plc4go by this push:
new caed258 - Fixed the Go typeSwitch issue
caed258 is described below
commit caed25859946202f60bbd281a943b55a40a877af
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Fri Oct 9 17:47:28 2020 +0200
- Fixed the Go typeSwitch issue
---
.../language-go/src/main/resources/templates/go/model-template.ftlh | 2 +-
sandbox/plc4go/generated-sources/plc4go/modbus/readwrite/ModbusPDU.go | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/build-utils/language-go/src/main/resources/templates/go/model-template.ftlh b/build-utils/language-go/src/main/resources/templates/go/model-template.ftlh
index ccc862d..7ed231b 100644
--- a/build-utils/language-go/src/main/resources/templates/go/model-template.ftlh
+++ b/build-utils/language-go/src/main/resources/templates/go/model-template.ftlh
@@ -718,7 +718,7 @@ func (m ${type.name}) Serialize(io spi.WriteBuffer) {
<#assign switchField = field>
// Switch field (Depending on the discriminator values, passes the serialization to a sub-type)
- switch m.(type) {
+ switch I${type.name}(m).(type) {
<#list switchField.cases as case>
case I${case.name}:
I${case.name}(m).Serialize(io)
diff --git a/sandbox/plc4go/generated-sources/plc4go/modbus/readwrite/ModbusPDU.go b/sandbox/plc4go/generated-sources/plc4go/modbus/readwrite/ModbusPDU.go
index e230cf2..dbd5eb7 100644
--- a/sandbox/plc4go/generated-sources/plc4go/modbus/readwrite/ModbusPDU.go
+++ b/sandbox/plc4go/generated-sources/plc4go/modbus/readwrite/ModbusPDU.go
@@ -187,7 +187,7 @@ func (m ModbusPDU) Serialize(io spi.WriteBuffer) {
io.WriteUint8(7, (functionFlag))
// Switch field (Depending on the discriminator values, passes the serialization to a sub-type)
- switch m.(type) {
+ switch IModbusPDU(m).(type) {
case IModbusPDUError:
IModbusPDUError(m).Serialize(io)
case IModbusPDUReadDiscreteInputsRequest: