pulumi/sdk/go/pulumi
Abhinav Gupta 1912563e24
sdk/go: Move Output implementation to internal
**Note to reviewers**:
GitHub's PR view will show a lot more for this change
than the actual code added/removed.
Consider opening a `git diff` of this with,

    git diff -C --diff-algorithm=minimal

This will correctly detect the bulk of the diff as
"copy a file and delete a bunch of stuff from it."

---

In preparation for implementing generic variants of Input and Output
in a pulumix subpackage, move some of the requisite types to internal/
so that we don't have a cyclic dependency between pulumi and pulumix.

This change is largely mechanical with adjustmenets made for
compilation.
For places in pulumi/ where internal state of an output was accessed,
new top-level functions were added to internal/
that expose this information.

Changes were noting explicitly:

- `OutputState` was changed to record dependencies as `[]internal.Resource`
  instead of `[]Resource` because moving `Resource` into internal
  will end up moving most of pulumi/ into internal.
  We cast to/from internal.Resource as needed.
- `internal.AnyOutputType` is a `reflect.Type` filled by sdk/go/pulumi
  at `init()` time.
  This is an annoying hack, but we can't move AnyOutput into internal.
- `internal.FullyResolvedTypes` is similarly filled by sdk/go/pulumi
  at `init()` time.

To add confidence to this change being safe,
I used [apidiff] to compare the API of the go/pulumi package
befor and after this change.
The command reported no changes.

  [apidiff]: https://pkg.go.dev/golang.org/x/exp@v0.0.0-20230713183714-613f0c0eb8a1/cmd/apidiff

On top of that, I also ran `go doc -all .` with the before/after
and ran a text diff on the result. The following changes were reported:

- `Input` is now an alias to `internal.Input`
- `Output` is now an alias to `internal.Output`
- `OutputState` is now an alias to `internal.OutputState`
- `OutputState.ApplyT`, `OutputState.ApplyTWithContext` were deleted
  (except they're present on the alias so they're still available)
- `Resource` now embeds `internal.Resource`

Resolves #13585
2023-07-25 18:13:35 -07:00
..
config Add --secret to config set hints when needed 2023-06-22 17:25:30 +01:00
generate sdk/go: Move Output implementation to internal 2023-07-25 18:13:35 -07:00
internals sdk/internal: pulumi.NewOutput => ctx.NewOutput 2023-01-13 13:31:28 -08:00
provider all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
alias.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
alias_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
asset.go [sdk/{go,dotnet] Unmarshal invalid assets. (#7579) 2021-07-21 13:40:36 -07:00
context.go sdk/go: Move Output implementation to internal 2023-07-25 18:13:35 -07:00
context_test.go [sdk/*] Add support for resource source positions 2023-07-13 16:46:04 -07:00
internals.go sdk/go: Move Output implementation to internal 2023-07-25 18:13:35 -07:00
log.go chore: Update doc comments, coding style, fix lint 2022-10-13 13:50:49 -07:00
mocks.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
printf.go Redesign the Go SDK resource/input/output system. (#3506) 2020-01-18 10:08:37 -05:00
printf_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
provider.go sdk/go: Move Output implementation to internal 2023-07-25 18:13:35 -07:00
provider_linked.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
provider_test.go sdk/go: Propagate more resource options from provider.Construct 2023-04-21 10:58:59 -07:00
resource.go sdk/go: Move Output implementation to internal 2023-07-25 18:13:35 -07:00
resource_set.go unused: Remove unused functions and types 2023-01-12 09:55:34 -08:00
resource_test.go sdk/go: Move Output implementation to internal 2023-07-25 18:13:35 -07:00
rpc.go sdk/go: Move Output implementation to internal 2023-07-25 18:13:35 -07:00
rpc_test.go sdk/go: Move Output implementation to internal 2023-07-25 18:13:35 -07:00
run.go sdk/go: Prefer contract.Assertf over Assert 2023-02-15 10:22:43 -08:00
run_test.go sdk/go: Move Output implementation to internal 2023-07-25 18:13:35 -07:00
stack_reference.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
stack_reference_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
transformation.go Support transformations in Go (#3978) 2020-03-02 13:59:11 -08:00
type_conversions.go [codegen/go] Improve optional params in invoke 2022-02-01 11:44:40 -08:00
types.go sdk/go: Move Output implementation to internal 2023-07-25 18:13:35 -07:00
types_builtins.go sdk/go: Move Output implementation to internal 2023-07-25 18:13:35 -07:00
types_builtins_test.go sdk/go: Move Output implementation to internal 2023-07-25 18:13:35 -07:00
types_contravariance_test.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
types_test.go sdk/go: Move Output implementation to internal 2023-07-25 18:13:35 -07:00
urnset.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00