pulumi/sdk/go/common/util
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
..
archive [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
buildutil [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
ciutil Added a buildkite detector for detecting the correct env vars in CI (#7933) 2021-11-15 09:10:07 -08:00
cmdutil Fix cmdutil.PrintTable to handle ansi escapes and non-byte glyphs (#8344) 2021-11-04 10:06:20 +00:00
contract [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
deepcopy Protect against engine event mutation. (#5003) 2020-07-16 23:52:31 -07:00
executable Skip failing test on windows 2021-08-30 22:53:16 -07:00
fsutil [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
gitutil [cli] check main after master (#8463) 2021-11-19 13:49:59 -08:00
goversion Go generics proof of concept 2021-12-16 17:48:01 -08:00
httputil Set less agressive timeouts for HTTP retries (#8549) 2021-12-09 09:53:10 -08:00
logging [cli, testing, github] Gather code coverage data in CI. (#8260) 2021-11-30 17:24:01 -08:00
mapper [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
result Add String and GoString to Result (#8490) 2021-11-24 17:01:55 +00:00
retry move pkg/util/retry -> sdk/go/common/util/retry 2020-03-18 15:47:01 -07:00
rpcutil Add a convert-trace command. (#7319) 2021-06-17 14:46:05 -07:00