Skip to content

Commit eb16d59

Browse files
committed
fix(sdk/go): Fix compile error on Redis Go SDK
Fixes type error on different versions of Go/TinyGo ``` $ spin build Building component outbound-redis with `tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go` ../../sdk/go/redis/internals.go:167:10: undefined: C._Ctype_union___9 Error: Build command for component outbound-redis failed with status Exited(1) ``` Signed-off-by: Adam Reese <[email protected]>
1 parent 12becdc commit eb16d59

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

sdk/go/redis/internals.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,18 @@ func fromRedisListStr(list *C.outbound_redis_list_string_t) []string {
164164
}
165165

166166
func redisParameter(x RedisParameter) C.outbound_redis_redis_parameter_t {
167-
var val C._Ctype_union___9
167+
168+
var ret C.outbound_redis_redis_parameter_t
168169
switch x.Kind {
169-
case RedisParameterKindInt64: *(*C.int64_t)(unsafe.Pointer(&val)) = x.Val.(int64)
170-
case RedisParameterKindBinary: {
170+
case RedisParameterKindInt64:
171+
*(*C.int64_t)(unsafe.Pointer(&ret.val)) = x.Val.(int64)
172+
case RedisParameterKindBinary:
171173
value := x.Val.([]byte)
172174
payload := C.outbound_redis_payload_t{ptr: &value[0], len: C.size_t(len(value))}
173-
*(*C.outbound_redis_payload_t)(unsafe.Pointer(&val)) = payload
174-
}
175+
*(*C.outbound_redis_payload_t)(unsafe.Pointer(&ret.val)) = payload
175176
}
176-
return C.outbound_redis_redis_parameter_t{tag: C.uint8_t(x.Kind), val: val}
177+
ret.tag = C.uint8_t(x.Kind)
178+
return ret
177179
}
178180

179181
func redisListParameter(xs []RedisParameter) C.outbound_redis_list_redis_parameter_t {

0 commit comments

Comments
 (0)