This message was deleted.
# golang
s
This message was deleted.
b
can you show me what you've tried? you should be able to
ctx.export
the whole slice if needed
m
Copy code
var k3sNodeList []*ec2.Instance

Followed by:

for k,v := range k3sNodeList{
    ctx.export("ip", v.PublicIP)
}
b
you can't export like that, you'll need to export the whole slice
(I think)
a
I don’t think you can have a static name “ip” when iterating an export. Try this below
Copy code
var k3sNodeList []*ec2.Instance
Followed by:
for k,v := range k3sNodeList{
    ctx.export("ip"+strconv.Itoa(k), v.PublicIP)
}
m
Thank you both @agreeable-restaurant-12233 that's perfect, thanks.
s
It’s working exactly as written: exporting each item in the slice as “ip”, so the last one wins. You can export slices and maps (at least, you can in typescript, I assume it works in to), but go lacking generic higher order functions makes that less palatable too. The approach of suffixing an index is ok, or you can make a string slice of IPs and export that.