https://pulumi.com logo
#golang
Title
# golang
c

crooked-jelly-50877

04/21/2020, 8:09 PM
Looking at the GKE go sample, I see that it uses pulumi specific types for things like Strings and Arrays instead of using native go types. Is that just a case of the sample not being updated, or is that working as intended?
l

lemon-agent-27707

04/21/2020, 8:24 PM
This is indeed as intended. The reason is due to the lack of generics in Go. Due to the async nature of the cloud, we model a given input to a cloud resource as
Input<T> = T | Output<T>
where T is your plain string type, and
Output<T>
is a future/promise that will eventually produce a T. In languages like Typescript and C#, we can use generics to represent this and allow using native types. In go we have to create this custom
pulumi.String
<http://pulumi.Int|pulumi.Int>
etc, to work around this. If you'd like a high level overview I recommend watching this: https://www.crowdcast.io/e/2020-04-14-PNW-Go or

https://www.youtube.com/watch?v=s91qF5MLy14&amp;t=10s

c

crooked-jelly-50877

04/21/2020, 8:40 PM
we found the async nature in TS very hard to work with at times…
It would be really nice if this could be abstracted out… but easier said than done I suppose
that video is super helpful - thx for sharing
👍 2
l

lemon-agent-27707

04/21/2020, 9:31 PM
Agreed, the async nature can be a little bit of a mind bender.
Definitely a learning curve, but it is very powerful and enables much faster deployments through parallelization than would otherwise be possible.
3 Views