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

green-morning-1318

05/05/2020, 12:21 AM
Copy code
Diagnostics:
  pulumi:pulumi:Stack (marketplace-dev):
    panic: fatal: An assertion has failed: {<nil> <nil> <nil> <nil> 173f6e1d-e6a5-4d4d-9fe0-555c41c9faa0 <nil>}: cannot assign vsphere.virtualMachineClonePtrType to vsphere.VirtualMachineClone
    goroutine 52 [running]:
    <http://github.com/pulumi/pulumi/sdk/v2/go/common/util/contract.failfast(...)|github.com/pulumi/pulumi/sdk/v2/go/common/util/contract.failfast(...)>
        /Users/lstigter/go/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.0.0/go/common/util/contract/failfast.go:23
    <http://github.com/pulumi/pulumi/sdk/v2/go/common/util/contract.Assertf(0x1e5e600|github.com/pulumi/pulumi/sdk/v2/go/common/util/contract.Assertf(0x1e5e600>, 0x1ff289a, 0x1a, 0xc000185490, 0x3, 0x3)
        /Users/lstigter/go/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.0.0/go/common/util/contract/assert.go:33 +0x197
    <http://github.com/pulumi/pulumi/sdk/v2/go/pulumi.marshalInputAndDetermineSecret(0x1e5e6a0|github.com/pulumi/pulumi/sdk/v2/go/pulumi.marshalInputAndDetermineSecret(0x1e5e6a0>, 0xc0002a66c0, 0x211a520, 0x1e5e4a0, 0xc000185501, 0x1094ad2, 0x1de2900, 0x3, 0xc000185628, 0x109327d, ...)
        /Users/lstigter/go/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.0.0/go/pulumi/rpc.go:244 +0x355
    <http://github.com/pulumi/pulumi/sdk/v2/go/pulumi.marshalInput(0x1dda240|github.com/pulumi/pulumi/sdk/v2/go/pulumi.marshalInput(0x1dda240>, 0xc000382660, 0x211a520, 0x1d36320, 0x1dda201, 0xc000382660, 0x194, 0x0, 0x211a520, 0x1d36320, ...)
        /Users/lstigter/go/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.0.0/go/pulumi/rpc.go:144 +0x73
    <http://github.com/pulumi/pulumi/sdk/v2/go/pulumi.marshalInputs(0x20f38e0|github.com/pulumi/pulumi/sdk/v2/go/pulumi.marshalInputs(0x20f38e0>, 0xc0003d0000, 0x2b, 0xc000384c90, 0xc0003c24e0, 0xc0003aa0f0, 0x41, 0x0, 0x0)
        /Users/lstigter/go/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.0.0/go/pulumi/rpc.go:102 +0x492
    <http://github.com/pulumi/pulumi/sdk/v2/go/pulumi.(*Context).prepareResourceInputs(0xc0001e4200|github.com/pulumi/pulumi/sdk/v2/go/pulumi.(*Context).prepareResourceInputs(0xc0001e4200>, 0x20f38e0, 0xc0003d0000, 0x2001f73, 0x2b, 0xc0003c24e0, 0xc0003a32c0, 0x0, 0x0, 0x0)
        /Users/lstigter/go/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.0.0/go/pulumi/context.go:776 +0x23a
    <http://github.com/pulumi/pulumi/sdk/v2/go/pulumi.(*Context).RegisterResource.func1(0xc0003a32c0|github.com/pulumi/pulumi/sdk/v2/go/pulumi.(*Context).RegisterResource.func1(0xc0003a32c0>, 0xc0001e4200, 0x20f38e0, 0xc0003d0000, 0x2001f73, 0x2b, 0xc0003c24e0, 0x1fe7e0a, 0xc, 0x1)
        /Users/lstigter/go/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.0.0/go/pulumi/context.go:453 +0x154
    created by <http://github.com/pulumi/pulumi/sdk/v2/go/pulumi.(*Context).RegisterResource|github.com/pulumi/pulumi/sdk/v2/go/pulumi.(*Context).RegisterResource>
        /Users/lstigter/go/pkg/mod/github.com/pulumi/pulumi/sdk/v2@v2.0.0/go/pulumi/context.go:441 +0x540
    exit status 2
The error indicates that
vsphere.virtualMachineClonePtrType to vsphere.VirtualMachineClone
though according to the syntax thereโ€™s nothing wrong ๐Ÿ˜ž The equivalent of this works flawlessly when I execute it with TypeScript ๐Ÿค”
g

gentle-diamond-70147

05/05/2020, 2:25 AM
In my experience with the Pulumi Go SDK I have yet to need to instance a
...Input
object, so I think you need a different type there.
I think this is what you want there:
Copy code
Clone: &vsphere.VirtualMachineCloneArgs{
		TemplateUuid: pulumi.String("173f6e1d-e6a5-4d4d-9fe0-555c41c9faa0"),
	}
g

green-morning-1318

05/05/2020, 3:25 PM
That works ๐Ÿ™Œ Thanks @gentle-diamond-70147, to be fair Iโ€™m a little confused how that works because the struct says Clone is a
Clone VirtualMachineClonePtrInput
๐Ÿค” perhaps one or two lines of documentation would help developers realize there are a few options ๐Ÿ˜‰
g

gentle-diamond-70147

05/05/2020, 3:27 PM
FWIW, I'm not experienced enough with Go to understand how it works. Those were added to help exactly this. Is there another spot you would expect to see hints like this?
g

green-morning-1318

05/05/2020, 3:30 PM
Hmm ๐Ÿค” that works, though it seems the auto completion of structs in VS Code seems to not show that hint ๐Ÿ˜ž so itโ€™s definitely a โ€œLeonโ€ problem ๐Ÿ˜‰
g

gentle-diamond-70147

05/05/2020, 3:32 PM
Definitely not "just a Leon" problem. ๐Ÿ™‚
3 Views