Skip to content

Commit 81623ad

Browse files
authored
fix(iot): register marshalers with pointer types for device and network create responses (#5046)
1 parent 1b698c9 commit 81623ad

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

internal/namespaces/iot/v1/custom.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,14 @@ func GetCommands() *core.Commands {
2020
iot.DeviceStatus(""),
2121
human.EnumMarshalFunc(deviceStatusMarshalSpecs),
2222
)
23-
human.RegisterMarshalerFunc(iot.CreateNetworkResponse{}, iotNetworkCreateResponsedMarshalerFunc)
24-
human.RegisterMarshalerFunc(iot.CreateDeviceResponse{}, iotDeviceCreateResponsedMarshalerFunc)
23+
human.RegisterMarshalerFunc(
24+
&iot.CreateNetworkResponse{},
25+
iotNetworkCreateResponsedMarshalerFunc,
26+
)
27+
human.RegisterMarshalerFunc(
28+
&iot.CreateDeviceResponse{},
29+
iotDeviceCreateResponsedMarshalerFunc,
30+
)
2531

2632
cmds.MustFind("iot", "hub", "create").Override(hubCreateBuilder)
2733

internal/namespaces/iot/v1/custom_device.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var (
3333

3434
func iotDeviceCreateResponsedMarshalerFunc(i any, opt *human.MarshalOpt) (string, error) {
3535
type tmp iot.CreateDeviceResponse
36-
deviceCreateResponse := tmp(i.(iot.CreateDeviceResponse))
36+
deviceCreateResponse := tmp(*i.(*iot.CreateDeviceResponse))
3737

3838
deviceContent, err := human.Marshal(deviceCreateResponse.Device, opt)
3939
if err != nil {

internal/namespaces/iot/v1/custom_network.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func iotNetworkCreateResponsedMarshalerFunc(i any, opt *human.MarshalOpt) (string, error) {
1313
type tmp iot.CreateNetworkResponse
14-
networkCreateResponse := tmp(i.(iot.CreateNetworkResponse))
14+
networkCreateResponse := tmp(*i.(*iot.CreateNetworkResponse))
1515

1616
networkContent, err := human.Marshal(networkCreateResponse.Network, opt)
1717
if err != nil {

0 commit comments

Comments
 (0)