pulumi/sdk
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
..
dotnet Fix 7422 - NullPointerException race on Urn property in C# SDK (#8495) 2021-12-10 11:22:42 -05:00
go Go generics proof of concept 2021-12-16 17:48:01 -08:00
nodejs [cli, testing, github] Gather code coverage data in CI. (#8260) 2021-11-30 17:24:01 -08:00
proto Add monitor feature for output values (#7870) 2021-09-15 14:16:00 -07:00
python Use $(PYTHON) for makefile (#8564) 2021-12-08 13:39:39 -08:00
README.md Updating .NET references 2020-04-27 12:42:11 -07:00
go.mod Go generics proof of concept 2021-12-16 17:48:01 -08:00
go.sum Fix cmdutil.PrintTable to handle ansi escapes and non-byte glyphs (#8344) 2021-11-04 10:06:20 +00:00

README.md

Pulumi Language SDKs

This directory contains the Pulumi SDKs for all supported languages.

Please see the respective READMEs for information about installing and using these libraries:

The language providers work by implementing gRPC interfaces defined in proto/.