pulumi/sdk/go/common
Joe Duffy fc26844856 Go generics proof of concept
This is a basic proof of concept for using Go generics in our Go
SDK. There were a number of "on the fly" design decisions made:

* Replace Input altogether.

* Keep Output[T], but it needs to be a struct largely due to the
  lack of generics support in the Go reflection library.

* Introduce AnyOutput as a base interface that all Output[*]s
  implement, which lets us treat any "outputtish" things uniformly.

This is enough to get the basic hello, world working:

  package main

  import (
      "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
  )

  func main() {
      pulumi.Run(func(ctx *pulumi.Context) error {
          var bucket Bucket
          if err := ctx.RegisterResource("aws:s3/bucket:Bucket", "myBucket", pulumi.Map{}, &bucket); err != nil {
              return err
          }

          ctx.Export("bucketName", bucket.Bucket)

          nameLength := pulumi.Apply(bucket.Bucket, func(name string) int {
              return len(name)
          })
          ctx.Export("bucketNameLength", nameLength)

          return nil
      })
  }

There are plenty of embarassing hacks needed to get this to work,
and some blatent omissions too. For instance, I doubt Any works, and
obviously the tests won't run clean. Nevertheless, I wanted to save/
archive/share this work in the event that it's helpful to someone.
2021-12-16 17:48:01 -08:00
..
apitype Adding a Log3rdPartyDecryptionEventType for logging 3rd party secrets provider decryption (#8554) 2021-12-07 23:21:27 +02:00
constant expose execution kind via update metadata (#5258) 2020-08-31 09:07:59 -07:00
diag reformat error message string (#8284) 2021-10-26 14:55:25 -06:00
encoding Improve error message and add test for #1440 (#8268) 2021-10-26 16:55:52 +01:00
resource [codegen/python] emit `pulumiplugin.json` by default (#8527) 2021-12-01 18:07:23 -08:00
testing Update pkg -> sdk dependency (#8346) 2021-11-03 11:25:20 -07:00
tokens [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
tools [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
util Go generics proof of concept 2021-12-16 17:48:01 -08:00
version move pkg/version -> sdk/go/common/version 2020-03-18 15:25:25 -07:00
workspace Opt language hosts out of `PULUMI_IGNORE_AMBIENT_PLUGINS` (#8576) 2021-12-10 13:23:54 -08:00